From 64ce29253080df6e2bd382d4361f61d93ce2fe77 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Mon, 18 Feb 2013 15:34:45 +0100 Subject: [PATCH] create unit test for Thelia\Controller\DefaultControllerTest --- .../Controller/DefaultControllerTest.php | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 core/lib/Thelia/Tests/Controller/DefaultControllerTest.php diff --git a/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php new file mode 100644 index 000000000..84bc6c1a7 --- /dev/null +++ b/core/lib/Thelia/Tests/Controller/DefaultControllerTest.php @@ -0,0 +1,64 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Tests\Controller; + +use Symfony\Component\HttpFoundation\Request; +use Thelia\Controller\DefaultController; + +class DefaultControllerTest extends \PHPUnit_Framework_TestCase +{ + + public function testNoAction() + { + $defaultController = new DefaultController(); + $request = new Request(); + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), "index"); + } + + public function testNoActionWithQuery() + { + $defaultController = new DefaultController(); + $request = new Request(array( + "view" => "foo" + )); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'foo'); + } + + public function testNoActionWithRequest() + { + $defaultController = new DefaultController(); + $request = new Request(array(), array( + "view" => "foo" + )); + + $defaultController->noAction($request); + + $this->assertEquals($request->attributes->get('_view'), 'foo'); + } +} \ No newline at end of file