From c1c14cccfa3d6541aadef8f5b5df7601b54baff6 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Tue, 16 Oct 2012 16:36:34 +0200 Subject: [PATCH] Update tests --- .../Phrasea/Controller/Prod/ExportTest.php | 2 +- .../Phrasea/Controller/Prod/QueryTest.php | 19 +++++++------------ .../Controller/User/NotificationsTest.php | 6 ++++-- .../Controller/User/PreferencesTest.php | 6 ++++-- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/tests/Alchemy/Phrasea/Controller/Prod/ExportTest.php b/tests/Alchemy/Phrasea/Controller/Prod/ExportTest.php index 1a88e7010c..f8df2cf5a0 100644 --- a/tests/Alchemy/Phrasea/Controller/Prod/ExportTest.php +++ b/tests/Alchemy/Phrasea/Controller/Prod/ExportTest.php @@ -39,7 +39,7 @@ class ExportTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testDisplayMultiExport() { - self::$DI['client']->request('GET', '/prod/export/multi-export/', array('lst' => self::$DI['record_1']->get_serialize_key())); + self::$DI['client']->request('POST', '/prod/export/multi-export/', array('lst' => self::$DI['record_1']->get_serialize_key())); $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); unset($response); diff --git a/tests/Alchemy/Phrasea/Controller/Prod/QueryTest.php b/tests/Alchemy/Phrasea/Controller/Prod/QueryTest.php index ddd4b94d64..7f24886a3b 100644 --- a/tests/Alchemy/Phrasea/Controller/Prod/QueryTest.php +++ b/tests/Alchemy/Phrasea/Controller/Prod/QueryTest.php @@ -14,19 +14,18 @@ class QueryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testQueryAnswerTrain() { - + \phrasea::start(self::$DI['app']['phraseanet.configuration']); $auth = new \Session_Authentication_None(self::$DI['user']); self::$DI['app']->openAccount($auth); - + self::$DI['record_story_1']; $options = new \searchEngine_options(); $serializedOptions = serialize($options); - self::$DI['record_story_1']; - $response = self::$DI['client']->request('POST', '/prod/query/answer-train/', array( + self::$DI['client']->request('POST', '/prod/query/answer-train/', array( 'options_serial' => $serializedOptions, 'pos' => 1, 'query' => '' )); - + $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('current', $datas); @@ -38,16 +37,12 @@ class QueryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testQueryRegTrain() { - $request = Request::create('/prod/query/reg-train/', 'POST', array( - 'pos' => 1, - 'cont' => self::$DI['record_story_1']->get_serialize_key() - )); - - $response = self::$DI['client']->request('POST', '/prod/query/reg-train/', array( + self::$DI['client']->request('POST', '/prod/query/reg-train/', array( 'pos' => 1, 'cont' => self::$DI['record_story_1']->get_serialize_key() )); + $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); - unset($request, $response); + unset($response); } } diff --git a/tests/Alchemy/Phrasea/Controller/User/NotificationsTest.php b/tests/Alchemy/Phrasea/Controller/User/NotificationsTest.php index ae7fc87348..0465bfa960 100644 --- a/tests/Alchemy/Phrasea/Controller/User/NotificationsTest.php +++ b/tests/Alchemy/Phrasea/Controller/User/NotificationsTest.php @@ -14,7 +14,8 @@ class NotificationsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testListNotifications() { - $response = $this->XMLHTTPRequest('GET', '/user/notifications/'); + $this->XMLHTTPRequest('GET', '/user/notifications/'); + $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); unset($response); } @@ -42,9 +43,10 @@ class NotificationsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testSetNotificationsReaded() { - $response = $this->XMLHTTPRequest('POST', '/user/notifications/read/', array( + $this->XMLHTTPRequest('POST', '/user/notifications/read/', array( 'notifications' => array() )); + $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas); diff --git a/tests/Alchemy/Phrasea/Controller/User/PreferencesTest.php b/tests/Alchemy/Phrasea/Controller/User/PreferencesTest.php index 6433b2f74b..c4d665efda 100644 --- a/tests/Alchemy/Phrasea/Controller/User/PreferencesTest.php +++ b/tests/Alchemy/Phrasea/Controller/User/PreferencesTest.php @@ -24,7 +24,8 @@ class PreferencesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract ->with($this->equalTo('prop_test'), $this->equalTo('val_test')) ->will($this->returnValue(true)); - $response = $this->XMLHTTPRequest('POST', '/user/preferences/', array('prop' => 'prop_test', 'value' => 'val_test')); + $this->XMLHTTPRequest('POST', '/user/preferences/', array('prop' => 'prop_test', 'value' => 'val_test')); + $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas); @@ -56,7 +57,8 @@ class PreferencesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract */ public function testSaveTemporaryPref() { - $response = $this->XMLHTTPRequest('POST', "/user/preferences/temporary/", array('prop' => 'prop_test', 'value' => 'val_test')); + $this->XMLHTTPRequest('POST', "/user/preferences/temporary/", array('prop' => 'prop_test', 'value' => 'val_test')); + $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas);