Browse Source

tests for TreeRepository::getLeafs function

gediminasm 14 years ago
parent
commit
5d3736d63a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      tests/Gedmo/Tree/RepositoryTest.php

+ 11 - 0
tests/Gedmo/Tree/RepositoryTest.php

@@ -126,6 +126,17 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('Food', $path[0]->getTitle());
         $this->assertEquals('Vegitables', $path[1]->getTitle());
         $this->assertEquals('Carrots', $path[2]->getTitle());
+        
+        // leafs
+        
+        $leafs = $this->em->getRepository(self::TEST_ENTITY_CATEGORY)
+            ->getLeafs();
+
+        $this->assertEquals(4, count($leafs));
+        $this->assertEquals('Fruits', $leafs[0]->getTitle());
+        $this->assertEquals('Carrots', $leafs[1]->getTitle());
+        $this->assertEquals('Potatoes', $leafs[2]->getTitle());
+        $this->assertEquals('Sports', $leafs[3]->getTitle());
     }
     
     public function testAdvancedFunctions()