From aab82edda30acabc2ba7e977d08cd40e92ba1ff6 Mon Sep 17 00:00:00 2001 From: Strift Date: Wed, 4 Dec 2024 19:48:33 +0800 Subject: [PATCH] Update tests based on PHPstan feedback --- src/Contracts/BatchesQuery.php | 17 ----------------- tests/Endpoints/BatchesTest.php | 10 +++++----- tests/Endpoints/TasksTest.php | 2 +- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/Contracts/BatchesQuery.php b/src/Contracts/BatchesQuery.php index 9f119c61..08fd36b3 100644 --- a/src/Contracts/BatchesQuery.php +++ b/src/Contracts/BatchesQuery.php @@ -17,11 +17,6 @@ class BatchesQuery */ private ?int $limit = null; - /** - * @var non-empty-list|null - */ - private ?array $canceledBy = null; - private ?bool $reverse = null; /** @@ -34,18 +29,6 @@ public function setFrom(int $from): self return $this; } - /** - * @param non-empty-list $canceledBy - * - * @return $this - */ - public function setCanceledBy(array $canceledBy): self - { - $this->canceledBy = $canceledBy; - - return $this; - } - /** * @return $this */ diff --git a/tests/Endpoints/BatchesTest.php b/tests/Endpoints/BatchesTest.php index d673436f..fc6d0780 100644 --- a/tests/Endpoints/BatchesTest.php +++ b/tests/Endpoints/BatchesTest.php @@ -22,7 +22,7 @@ protected function setUp(): void public function testGetAllBatches(): void { $response = $this->client->getBatches(); - self::assertIsArray($response->getResults()); + self::assertGreaterThan(0, $response->getTotal()); } public function testGetAllBatchesWithIndexUidFilters(): void @@ -37,7 +37,7 @@ public function testGetAllBatchesWithTasksFilters(): void { $tasks = $this->client->getTasks(new TasksQuery())->getResults(); $response = $this->client->getBatches((new BatchesQuery())->setUids([$tasks[0]['uid']])); - self::assertNotNull($response->getResults()); + self::assertGreaterThan(0, $response->getTotal()); } public function testGetAllBatchesInReverseOrder(): void @@ -45,11 +45,11 @@ public function testGetAllBatchesInReverseOrder(): void $startDate = new \DateTimeImmutable('now'); $batches = $this->client->getBatches((new BatchesQuery()) - ->setAfterEnqueuedAt($startDate) + ->setAfterEnqueuedAt($startDate) ); $reversedBatches = $this->client->getBatches((new BatchesQuery()) - ->setAfterEnqueuedAt($startDate) - ->setReverse(true) + ->setAfterEnqueuedAt($startDate) + ->setReverse(true) ); self::assertSame($batches->getResults(), array_reverse($reversedBatches->getResults())); } diff --git a/tests/Endpoints/TasksTest.php b/tests/Endpoints/TasksTest.php index d41cd5f8..61cc3c67 100644 --- a/tests/Endpoints/TasksTest.php +++ b/tests/Endpoints/TasksTest.php @@ -85,7 +85,7 @@ public function getAllTasksClientWithBatchFilter(): void ->setBatchUid($task['uid']) ); - self::assertIsArray($response->getResults()); + self::assertGreaterThan(0, $response->getTotal()); } public function testGetOneTaskIndex(): void