public function parent() { if (!$this->parent && $this->post->parent()) { $this->parent = new TimberProxy($this->post->parent()); } return $this->parent; }
function testPostParent() { $parent_id = $this->factory->post->create(); $child_id = $this->factory->post->create(array('post_parent' => $parent_id)); $child_post = new TimberPost($child_id); $this->assertEquals($parent_id, $child_post->parent()->ID); }