/** * 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); }
/** * Tests an object with the expected arguments is instantiated, and the given filter is being used. * * @since 1.0.0 * * @covers Inpsyde\TopSellingProducts\Query\Product\TopSeller::__construct() * * @return void */ public function test_construction_with_filter() { $filtered_args = ['some', 'filtered', 'args']; $filter = Mockery::mock('Inpsyde\\TopSellingProducts\\Common\\Filter'); $filter->shouldReceive('filter_args')->once()->with(['post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => 12, 'ignore_sticky_posts' => true, 'orderby' => 'modified', 'no_found_rows' => true])->andReturn($filtered_args); Monkey::filters()->expectApplied(Testee::QUERY_ARGS_FILTER)->once()->with($filtered_args); new Testee([], $filter); }