/** * 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(); }
/** * 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); }
/** * @covers tfrommen\MetaTaxonomy\Taxonomy\Taxonomy::get_name * * @return void */ public function test_get_name() { $testee = new Testee(); $this->assertSame('meta', $testee->get_name()); }