X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fsymfony-cmf%2Frouting%2FTests%2FEnhancer%2FFieldMapEnhancerTest.php;fp=vendor%2Fsymfony-cmf%2Frouting%2FTests%2FEnhancer%2FFieldMapEnhancerTest.php;h=825ca5aea1f34ed16a4f27c4f3ef0d8adffb9a15;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/symfony-cmf/routing/Tests/Enhancer/FieldMapEnhancerTest.php b/vendor/symfony-cmf/routing/Tests/Enhancer/FieldMapEnhancerTest.php new file mode 100644 index 000000000..825ca5aea --- /dev/null +++ b/vendor/symfony-cmf/routing/Tests/Enhancer/FieldMapEnhancerTest.php @@ -0,0 +1,68 @@ +request = Request::create('/test'); + $mapping = array('static_pages' => 'cmf_content.controller:indexAction'); + + $this->enhancer = new FieldMapEnhancer('type', '_controller', $mapping); + } + + public function testFieldFoundInMapping() + { + $defaults = array('type' => 'static_pages'); + $expected = array( + 'type' => 'static_pages', + '_controller' => 'cmf_content.controller:indexAction', + ); + $this->assertEquals($expected, $this->enhancer->enhance($defaults, $this->request)); + } + + public function testFieldAlreadyThere() + { + $defaults = array( + 'type' => 'static_pages', + '_controller' => 'custom.controller:indexAction', + ); + $this->assertEquals($defaults, $this->enhancer->enhance($defaults, $this->request)); + } + + public function testNoType() + { + $defaults = array(); + $this->assertEquals(array(), $this->enhancer->enhance($defaults, $this->request)); + } + + public function testNotFoundInMapping() + { + $defaults = array('type' => 'unknown_route'); + $this->assertEquals($defaults, $this->enhancer->enhance($defaults, $this->request)); + } +}