Esempio n. 1
0
 /**
  * Construct object
  *
  * @since 1.1.0
  *
  * @param |WP_Post|integer $post
  */
 public function __construct($post)
 {
     $this->meta_key = \ingot\testing\utility\posts::meta_key();
     $this->set_post($post);
     if ($this->post) {
         $this->set_groups();
     }
 }
 /**
  * Test that we can overwrite assoiation
  *
  * @since 1.1.0
  *
  * @group group
  * @group objects
  * @group posts_object
  *
  * @covers \ingot\testing\object\posts::add()
  */
 public function testOverwrite()
 {
     $groups = [5, 3, 7];
     $groups_2 = [9, 4, 7, 12];
     $obj = new \ingot\testing\object\posts($this->the_post);
     $obj->add($groups);
     $obj->add($groups_2, true);
     $this->assertEquals(array_values($groups_2), array_values($obj->get_groups()));
     $this->assertEquals(array_values($groups_2), array_values(get_post_meta($this->the_post->ID, \ingot\testing\utility\posts::meta_key(), false)));
 }