public function changeset_post_id() { if (!isset($this->_changeset_post_id)) { $post_id = $this->find_changeset_post_id($this->_changeset_uuid); if (!$post_id) { $post_id = false; } $this->_changeset_post_id = $post_id; } if (false === $this->_changeset_post_id) { return null; } return $this->_changeset_post_id; }
/** * Test WP_Customize_Manager::changeset_post_id(). * * @ticket 30937 * @covers WP_Customize_Manager::changeset_post_id() */ function test_changeset_post_id() { $uuid = wp_generate_uuid4(); $wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid)); $this->assertNull($wp_customize->changeset_post_id()); $uuid = wp_generate_uuid4(); $wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid)); $post_id = $this->factory()->post->create(array('post_name' => $uuid, 'post_type' => 'customize_changeset', 'post_status' => 'auto-draft', 'post_content' => '{}')); $this->assertEquals($post_id, $wp_customize->changeset_post_id()); }