Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added a unit test

  • Loading branch information...
commit 63d960a31f6a8013af38f5083549c4e4a5c017cf 1 parent 30ecb12
@bamarni bamarni authored
View
3  composer.json
@@ -39,5 +39,6 @@
"branch-alias": {
"dev-master": "2.0.x-dev"
}
- }
+ },
+ "minimum-stability": "dev"
}
View
12 tests/Knp/Menu/Tests/Silex/RouterAwareFactoryTest.php
@@ -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'));
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.