From 23b526392fa46c5d6043c427dd8c422983036e15 Mon Sep 17 00:00:00 2001 From: viktorprogger Date: Thu, 26 Mar 2020 18:58:23 +0300 Subject: [PATCH] Test job statuses --- tests/unit/JobStatusTest.php | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/unit/JobStatusTest.php diff --git a/tests/unit/JobStatusTest.php b/tests/unit/JobStatusTest.php new file mode 100644 index 00000000..b1c623d4 --- /dev/null +++ b/tests/unit/JobStatusTest.php @@ -0,0 +1,54 @@ + [ + 'waiting', + 'isWaiting', + [ + 'isReserved', + 'isDone', + ], + ], + 'reserved' => [ + 'reserved', + 'isReserved', + [ + 'isWaiting', + 'isDone', + ], + ], + 'done' => [ + 'done', + 'isDone', + [ + 'isWaiting', + 'isReserved', + ], + ], + ]; + } + + /** + * @dataProvider getStatusPairs + */ + public function testInstanceValue(string $statusName, string $positiveMethod, array $negatives): void + { + $status = JobStatus::$statusName(); + + $this->assertTrue($status->$positiveMethod(), "$positiveMethod must be true for status $statusName"); + foreach ($negatives as $negative) { + $this->assertFalse($status->$negative(), "$negative must be false for status $statusName"); + } + } +}