/** * Test for the get_answer() method. * * @covers FortuneTeller::get_answer() * @dataProvider provide_get_answer_data * * @param string $expected The expected answer. * @param mixed $money The money spent for the fortune teller. * @param string $oracle_answer The answer given by the oracle. * * @return void */ public function test_get_answer($expected, $money, $oracle_answer) { $oracle = Mockery::mock('Oracle', ['get_answer' => $oracle_answer]); /** @var Oracle $oracle */ $testee = new FortuneTeller($oracle); $this->assertSame($expected, $testee->get_answer($money), 'get_answer() should return the expected answer.'); }
/** * Test for the get_answer() method. * * @covers FortuneTeller::get_answer() * @dataProvider provide_get_answer_data * * @param string $expected The expected answer. * @param mixed $money The money spent for the fortune teller. * @param string $oracle_answer The answer given by the oracle. * * @return void */ public function test_get_answer($expected, $money, $oracle_answer) { $oracle = $this->getMockBuilder('Oracle')->getMock(); $oracle->method('get_answer')->willReturn($oracle_answer); /** @var Oracle $oracle */ $testee = new FortuneTeller($oracle); $this->assertSame($expected, $testee->get_answer($money), 'get_answer() should return the expected answer.'); }