From b0ac5f3f03a5d092b8d62665d92b4426335da912 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 5 Sep 2013 09:24:22 +0200 Subject: [PATCH 1/2] add more test on DefaultController --- .../Controller/DefaultControllerTest.php | 54 +++++++++++++++++-- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php index fda569435..cecbb0e68 100755 --- a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php +++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php @@ -43,7 +43,7 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($request->attributes->get('_view'), "index"); } - public function testNoActionWithQuery() + public function testNoActionWithGetParam() { $defaultController = new DefaultController(); $request = new Request(array( @@ -55,15 +55,59 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($request->attributes->get('_view'), 'foo'); } - public function testNoActionWithRequest() + public function testNoActionWithPostParam() { $defaultController = new DefaultController(); - $request = new Request(array(), array( - "view" => "foo" - )); + $request = new Request( + array(), + array("view" => "foo") + ); $defaultController->noAction($request); $this->assertEquals($request->attributes->get('_view'), 'foo'); } + + + public function testNoActionWithAttribute() + { + $defaultController = new DefaultController(); + $request = new Request( + array(), + array(), + array("_view" => "foo") + ); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'foo'); + } + + public function testNoActionWithAttributeAndQuery() + { + $defaultController = new DefaultController(); + $request = new Request( + array("view" => "bar"), + array(), + array("_view" => "foo") + ); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'bar'); + } + + public function testNoActionWithAttirbuteAndRequest() + { + $defaultController = new DefaultController(); + $request = new Request( + array(), + array("view" => "bar"), + array("_view" => "foo") + ); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'bar'); + } } From b70f5b1d6836bc6a7e40fdb078af099999c163d2 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Thu, 5 Sep 2013 09:25:15 +0200 Subject: [PATCH 2/2] fix typo in method name --- core/lib/Thelia/Tests/Controller/DefaultControllerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php index cecbb0e68..33ea807e3 100755 --- a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php +++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php @@ -97,7 +97,7 @@ class DefaultControllerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($request->attributes->get('_view'), 'bar'); } - public function testNoActionWithAttirbuteAndRequest() + public function testNoActionWithAttributeAndRequest() { $defaultController = new DefaultController(); $request = new Request(