PathInfoBuilderTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Tests\Route;
  11. use Sonata\AdminBundle\Route\PathInfoBuilder;
  12. use Sonata\AdminBundle\Route\RouteCollection;
  13. class PathInfoBuilderTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function testBuild()
  16. {
  17. $audit = $this->getMock('Sonata\AdminBundle\Model\AuditManagerInterface');
  18. $audit->expects($this->once())->method('hasReader')->will($this->returnValue(true));
  19. $admin = $this->getMock('Sonata\AdminBundle\Admin\AdminInterface');
  20. $admin->expects($this->once())->method('getChildren')->will($this->returnValue(array()));
  21. $routeCollection = new RouteCollection('base.Code.Route', 'baseRouteName', 'baseRoutePattern', 'baseControllerName');
  22. $pathBuilder = new PathInfoBuilder($audit);
  23. $pathBuilder->build($admin, $routeCollection);
  24. $this->assertCount(9, $routeCollection->getElements());
  25. }
  26. }