protected function check_post_data($attachment, $data, $context = 'view', $links) { parent::check_post_data($attachment, $data, $context, $links); $this->assertArrayNotHasKey('content', $data); $this->assertArrayNotHasKey('excerpt', $data); $this->assertEquals(get_post_meta($attachment->ID, '_wp_attachment_image_alt', true), $data['alt_text']); if ('edit' === $context) { $this->assertEquals($attachment->post_excerpt, $data['caption']['raw']); $this->assertEquals($attachment->post_content, $data['description']['raw']); } else { $this->assertFalse(isset($data['caption']['raw'])); $this->assertFalse(isset($data['description']['raw'])); } $this->assertTrue(isset($data['media_details'])); if ($attachment->post_parent) { $this->assertEquals($attachment->post_parent, $data['post']); } else { $this->assertNull($data['post']); } $this->assertEquals(wp_get_attachment_url($attachment->ID), $data['source_url']); }
protected function set_post_data($args = array()) { $args = parent::set_post_data($args); $args['type'] = 'page'; return $args; }
public function tearDown() { _unregister_post_type('youseeeme'); if (isset($this->attachment_id)) { $this->remove_added_uploads(); } parent::tearDown(); }
protected function check_post_data($attachment, $data, $context = 'view') { parent::check_post_data($attachment, $data, $context); $this->assertEquals(get_post_meta($attachment->ID, '_wp_attachment_image_alt', true), $data['alt_text']); $this->assertEquals($attachment->post_excerpt, $data['caption']); $this->assertEquals($attachment->post_content, $data['description']); if ($attachment->post_parent) { $this->assertEquals($attachment->post_parent, $data['post']); } else { $this->assertNull($data['post']); } $this->assertEquals(wp_get_attachment_url($attachment->ID), $data['source_url']); }