/**
  * @covers tfrommen\MetaTaxonomy\Taxonomy\Taxonomy::register
  *
  * @return void
  */
 public function test_register()
 {
     $testee = new Testee();
     $text_domain = 'meta-taxonomy';
     WP_Mock::wpPassthruFunction('_x', array('args' => array(Mockery::type('string'), Mockery::type('string'), $text_domain)));
     WP_Mock::wpPassthruFunction('__', array('args' => array(Mockery::type('string'), $text_domain)));
     WP_Mock::wpFunction('register_taxonomy', array('args' => array('meta', array('post'), Mockery::type('array'))));
     $testee->register();
     $this->assertConditionsMet();
 }
Exemple #2
0
 /**
  * Check if the post with the given ID has the meta term with the given ID or slug.
  *
  * @param int        $post_id Post ID.
  * @param int|string $term    Meta term ID or slug.
  *
  * @return bool
  */
 function has_meta_term($post_id, $term)
 {
     $taxonomy = new Taxonomy();
     return is_object_in_term($post_id, $taxonomy->get_name(), $term);
 }
 /**
  * Constructor. Sets up the properties.
  *
  * @param Updater  $updater  Updater.
  * @param \wpdb    $wpdb     Database object.
  * @param Taxonomy $taxonomy Taxonomy model.
  */
 public function __construct(Updater $updater, \wpdb $wpdb, Taxonomy $taxonomy)
 {
     $this->version_option_name = $updater->get_option_name();
     $this->wpdb = $wpdb;
     $this->taxonomy = $taxonomy->get_name();
 }