public function testGetQuote() { $stub = $this->getMock('App\\Service\\Randomizer'); $stub->expects($this->any())->method('getNumber')->will($this->returnValue('0')); $service = new RandomQuote($stub); $quote = $service->getQuote(); $this->assertRegExp('/There are only two ways to live your life./', $quote[0]); }