Permalink
Browse files

added a unit test

  • Loading branch information...
1 parent 30ecb12 commit 63d960a31f6a8013af38f5083549c4e4a5c017cf @bamarni bamarni committed Aug 1, 2012
Showing with 14 additions and 1 deletion.
  1. +2 −1 composer.json
  2. +12 −0 tests/Knp/Menu/Tests/Silex/RouterAwareFactoryTest.php
View
@@ -39,5 +39,6 @@
"branch-alias": {
"dev-master": "2.0.x-dev"
}
- }
+ },
+ "minimum-stability": "dev"
}
@@ -51,4 +51,16 @@ public function testCreateItemWithAbsoluteRoute()
$item = $factory->createItem('test_item', array('route' => 'homepage', 'routeAbsolute' => true));
$this->assertEquals('http://php.net', $item->getUri());
}
+
+ public function testCreateItemAppendsRouteUnderExtras()
+ {
+ $generator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
+ $factory = new RouterAwareFactory($generator);
+
+ $item = $factory->createItem('test_item', array('route' => 'homepage'));
+ $this->assertEquals(array('homepage'), $item->getExtra('routes'));
+
+ $item = $factory->createItem('test_item', array('route' => 'homepage', 'extras' => array('routes' => array('other_page'))));
+ $this->assertContains('homepage', $item->getExtra('routes'));
+ }
}

0 comments on commit 63d960a

Please sign in to comment.