/**
  * 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);
 }
 /**
  * Tests filtering query arguments that come with a tax query already.
  *
  * @since  1.0.0
  *
  * @covers Inpsyde\TopSellingProducts\Filter\TopSellerTerm::__construct()
  * @covers Inpsyde\TopSellingProducts\Filter\TopSellerTerm::filter_args()
  *
  * @return void
  */
 public function test_filtering_args_with_existing_tax_query()
 {
     $tax_query = ['some', 'tax', 'query'];
     $args = ['some' => 'random', 'args' => 'here', 'tax_query' => $tax_query];
     Monkey::functions()->when('taxonomy_exists')->justReturn(true);
     Monkey::functions()->when('term_exists')->justReturn(true);
     $taxonomy = 'some_taxonomy_here';
     $term = 'some_term_here';
     $expected_args = ['some' => 'random', 'args' => 'here', 'tax_query' => [['taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $term], [$tax_query], 'relation' => 'AND']];
     $this->assertSame($expected_args, (new Testee($taxonomy, $term))->filter_args($args));
 }
 /**
  * Tears down the fixture, for example, close a network connection.
  * This method is called after a test is executed.
  */
 protected function tearDown()
 {
     parent::tearDown();
     /**
      * @todo figure out if this works
      * brain/monkey also works upon mockery and therefore
      * calls Mockery::close() but we cannot rely on that.
      */
     Mockery::close();
     Brain\Monkey::tearDownWP();
 }
 protected function tearDown()
 {
     Monkey::setUpWP();
     parent::tearDown();
 }
 public function tearDown()
 {
     Patchwork\undoAll();
     Monkey::tearDownWP();
     parent::tearDown();
 }
 /**
  * Cleans up the test environment after each test.
  *
  * @since 1.0.0
  *
  * @return void
  */
 protected function tearDown()
 {
     Monkey::tearDownWP();
     Mockery::close();
     parent::tearDown();
 }