/** * Tests to see if we can get the children of a given parent * * @return void **/ public function testCanGetChildren() { // Clear that cache here from our earlier request for the same model \Hubzero\Database\Query::purgeCache(); $discussion = Discussion::oneOrFail(1); $children = $discussion->getChildren()->raw(); $this->assertCount(3, $children, 'Discussion 1 should have had 3 children'); foreach ([2, 3, 5] as $expected) { $this->assertArrayHasKey($expected, $children, "Expected a discussion with id {$expected}"); } }