/** * Test for the get_answer() method. * * @covers HookOracle::get_answer() * * @return void */ public function test_get_answer() { $testee = new HookOracle(); $this->assertSame('42', $testee->get_answer(), 'get_answer() should return the expected answer.'); $this->assertSame(1, did_action('give_answer')); $this->assertTrue(Monkey::filters()->applied('the_answer') > 0); }
/** * Test for the get_answer() method. * * @covers HookOracle::get_answer() * * @return void */ public function test_get_answer() { $testee = new HookOracle(); WP_Mock::expectAction('give_answer'); WP_Mock::onFilter('the_answer')->with('42')->reply('4815162342'); $this->assertSame('4815162342', $testee->get_answer(), 'get_answer() should return the expected answer.'); }