コード例 #1
0
 public function testGetAllChildren()
 {
     // Not eager loaded
     $item = CategorySimple::first();
     $this->assertEquals(9, $item->getAllChildren()->count());
     // Eager loaded
     $item = CategorySimple::make()->getAllRoot()->first();
     $this->assertEquals(9, $item->getAllChildren()->count());
 }
コード例 #2
0
 public function testGetAllChildren()
 {
     // Not eager loaded
     $item = CategorySimple::first();
     $this->assertFalse($item->relationLoaded('children'));
     $this->assertEquals(9, $item->getAllChildren()->count());
     // Not eager loaded
     $item = CategorySimple::getAllRoot()->first();
     $this->assertFalse($item->relationLoaded('children'));
     $this->assertEquals(9, $item->getAllChildren()->count());
     // Eager loaded
     $item = CategorySimple::getNested()->first();
     $this->assertTrue($item->relationLoaded('children'));
     $this->assertEquals(9, $item->getAllChildren()->count());
 }