From 17d1b1cce61885162d6ea1541c0a6e0569bd608b Mon Sep 17 00:00:00 2001 From: Ashley Rich Date: Mon, 9 Oct 2017 14:51:37 +0100 Subject: [PATCH] Test Worker class --- tests/TestWorker.php | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/TestWorker.php diff --git a/tests/TestWorker.php b/tests/TestWorker.php new file mode 100644 index 0000000..d07a1ba --- /dev/null +++ b/tests/TestWorker.php @@ -0,0 +1,35 @@ +shouldReceive( 'pop' )->once()->andReturn( $job ); + + $worker = new Worker( $connection ); + $this->assertTrue( $worker->process() ); + } + + public function test_process_fail() { + $connection = Mockery::spy( ConnectionInterface::class ); + $job = Mockery::spy( Job::class ); + $connection->shouldReceive( 'pop' )->once()->andReturn( false ); + + $worker = new Worker( $connection ); + $this->assertFalse( $worker->process() ); + } +} \ No newline at end of file