diff --git a/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php b/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php index 4f1de157c1..a2fb433fe2 100644 --- a/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php +++ b/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php @@ -171,7 +171,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract $this->evaluateResponse200(self::$DI['client']->getResponse()); $this->evaluateMeta200($content); - $this->assertArrayHasKey('databoxes', $content['response']); foreach ($content['response']['databoxes'] as $databox) { $this->assertTrue(is_array($databox), 'Une databox est un objet'); @@ -1188,7 +1187,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract } $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE')); - $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(array('status' => $tochange)), array(), array('HTTP_Accept' => $this->getAcceptMimeType())); $content = $this->unserialize(self::$DI['client']->getResponse()->getContent()); @@ -1706,7 +1704,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract $created_entry = \Feed_Entry_Adapter::create(self::$DI['app'], $created_feed, $publisher, $entry_title, $entry_subtitle, $author, $author_email); $created_item = \Feed_Entry_Item::create(self::$DI['app']['phraseanet.appbox'], $created_entry, self::$DI['record_1']); - $this->setToken(self::$token); $route = '/api/v1/feeds/content/'; @@ -1718,7 +1715,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract $this->evaluateResponse200(self::$DI['client']->getResponse()); $this->evaluateMeta200($content); - $this->assertArrayHasKey('total_entries', $content['response']); $this->assertArrayHasKey('offset_start', $content['response']); $this->assertArrayHasKey('per_page', $content['response']); @@ -2567,7 +2563,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract $this->assertArrayHasKey('results', $response); $this->assertArrayHasKey('query', $response); - $this->assertTrue(is_int($response['available_results']), 'Le nombre de results dispo est un int'); $this->assertTrue(is_int($response['total_results']), 'Le nombre de results est un int'); $this->assertTrue(is_string($response['error']), 'Error est une string'); diff --git a/tests/Alchemy/Tests/Phrasea/Application/ApiRootTest.php b/tests/Alchemy/Tests/Phrasea/Application/ApiRootTest.php index cc49d8b06b..395dd3b51b 100644 --- a/tests/Alchemy/Tests/Phrasea/Application/ApiRootTest.php +++ b/tests/Alchemy/Tests/Phrasea/Application/ApiRootTest.php @@ -2,8 +2,6 @@ namespace Alchemy\Tests\Phrasea\Application; -use Alchemy\Phrasea\Border\File; -use Alchemy\Phrasea\Border\Manager; use Symfony\Component\HttpKernel\Client; use Symfony\Component\HttpFoundation\Response; diff --git a/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php b/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php index 4e86c9923e..f1402a24cf 100644 --- a/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php +++ b/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php @@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { - function testDatafilesRouteAuthenticated() + public function testDatafilesRouteAuthenticated() { $crawler = self::$DI['client']->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/'); $response = self::$DI['client']->getResponse(); @@ -19,14 +19,14 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac $this->assertEquals(self::$DI['record_1']->get_preview()->get_size(), $response->headers->get('content-length')); } - function testDatafilesNonExistentSubdef() + public function testDatafilesNonExistentSubdef() { self::$DI['client']->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/asubdefthatdoesnotexists/'); $this->assertNotFoundResponse(self::$DI['client']->getResponse()); } - function testEtag() + public function testEtag() { $tmp = tempnam(sys_get_temp_dir(), 'testEtag'); copy(__DIR__ . '/../../../../files/cestlafete.jpg', $tmp); @@ -53,7 +53,7 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac unlink($tmp); } - function testDatafilesRouteNotAuthenticated() + public function testDatafilesRouteNotAuthenticated() { self::$DI['app']['authentication']->closeAccount(); self::$DI['client']->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/'); @@ -61,7 +61,7 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac $this->assertForbiddenResponse(self::$DI['client']->getResponse()); } - function testDatafilesRouteNotAuthenticatedUnknownSubdef() + public function testDatafilesRouteNotAuthenticatedUnknownSubdef() { self::$DI['app']['authentication']->closeAccount(); self::$DI['client']->request('GET', '/datafiles/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/notfoundreview/'); @@ -69,7 +69,7 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac $this->assertForbiddenResponse(self::$DI['client']->getResponse()); } - function testPermalinkAuthenticated() + public function testPermalinkAuthenticated() { $this->assertTrue(self::$DI['app']['authentication']->isAuthenticated()); $this->get_a_permalinkBCcompatibility(array("Content-Type" => "image/jpeg")); @@ -78,7 +78,7 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac $this->get_a_permaview(array("Content-Type" => "text/html; charset=UTF-8")); } - function testPermalinkNotAuthenticated() + public function testPermalinkNotAuthenticated() { self::$DI['app']['authentication']->closeAccount(); $this->assertFalse(self::$DI['app']['authentication']->isAuthenticated()); @@ -88,20 +88,20 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac $this->get_a_permaview(array("Content-Type" => "text/html; charset=UTF-8")); } - function testCaptionAuthenticated() + public function testCaptionAuthenticated() { $this->assertTrue(self::$DI['app']['authentication']->isAuthenticated()); $this->get_a_caption(array("Content-Type" => "application/json")); } - function testCaptionNotAuthenticated() + public function testCaptionNotAuthenticated() { self::$DI['app']['authentication']->closeAccount(); $this->assertFalse(self::$DI['app']['authentication']->isAuthenticated()); $this->get_a_caption(array("Content-Type" => "application/json")); } - function testCaptionWithaWrongToken() + public function testCaptionWithaWrongToken() { $this->assertTrue(self::$DI['app']['authentication']->isAuthenticated()); $token = "unexisting_token"; @@ -113,7 +113,7 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac $this->assertEquals(404, $response->getStatusCode()); } - function testCaptionWithaWrongRecord() + public function testCaptionWithaWrongRecord() { $this->assertTrue(self::$DI['app']['authentication']->isAuthenticated()); $url = '/permalink/v1/unexisting_record/unexisting_id/caption/?token=unexisting_token'; diff --git a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php index 9f5257083c..efa71ccc58 100644 --- a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php +++ b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php @@ -281,7 +281,6 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract $app = new Application('test'); $app->get('/', function(Application $app, Request $request) { - return $app['locale']; }); unset($app['exception_handler']); diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php index 8ec6450d5a..c2c13b2e60 100644 --- a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php +++ b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php @@ -143,6 +143,7 @@ class FailureManagerTest extends \PHPUnit_Framework_TestCase $failure->expects($phpunit->once()) ->method('setLocked') ->with($phpunit->equalTo(false)); + return $failure; }, 10); @@ -207,7 +208,7 @@ class FailureManagerTest extends \PHPUnit_Framework_TestCase $em = $this->getMockBuilder('Doctrine\ORM\EntityManager') ->disableOriginalConstructor() ->getMock(); - + $recaptcha = $this->getReCaptchaMock(null); $manager = new FailureManager($em, $recaptcha, 2); diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php index 1a6fe6f2a8..be5da60285 100644 --- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php +++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php @@ -255,7 +255,6 @@ class GooglePlusTest extends ProviderTestCase ->disableOriginalConstructor() ->getMock(); - $google = new GooglePlus($this->getUrlGeneratorMock(), $this->getMockSession(), $googleMock, $this->getGuzzleMock()); $google->setGooglePlusService($plus); diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php index 925abee18b..cf6c73c14a 100644 --- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php +++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php @@ -63,12 +63,10 @@ class LinkedinTest extends ProviderTestCase ->method('post') ->will($this->returnValue($requestPost)); - $provider2 = $this->getProvider(); $provider2->setGuzzleClient($mock); $provider2->getSession()->set('linkedin.provider.state', $state); - return array( array($this->getProvider(), $this->getRequestMock()), array($provider1, $request), diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php index 241513d13a..1cf3619d76 100644 --- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php +++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php @@ -89,6 +89,7 @@ class TwitterTest extends ProviderTestCase ); $first = false; + return 200; } })); @@ -113,7 +114,7 @@ class TwitterTest extends ProviderTestCase $provider->getTwitterClient()->expects($this->any()) ->method('request') ->will($this->returnCallback(function ($method) use ($provider, $phpunit) { - switch($method) { + switch ($method) { case 'POST': $provider->getTwitterClient()->response = array( 'response' => array( diff --git a/tests/Alchemy/Tests/Phrasea/Cache/ApcCacheTest.php b/tests/Alchemy/Tests/Phrasea/Cache/ApcCacheTest.php index a421bdf7b7..468898af4a 100644 --- a/tests/Alchemy/Tests/Phrasea/Cache/ApcCacheTest.php +++ b/tests/Alchemy/Tests/Phrasea/Cache/ApcCacheTest.php @@ -45,4 +45,3 @@ class ApcCacheTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/tests/Alchemy/Tests/Phrasea/Cache/ArrayCacheTest.php b/tests/Alchemy/Tests/Phrasea/Cache/ArrayCacheTest.php index 913ac15cca..5d67d499de 100644 --- a/tests/Alchemy/Tests/Phrasea/Cache/ArrayCacheTest.php +++ b/tests/Alchemy/Tests/Phrasea/Cache/ArrayCacheTest.php @@ -42,4 +42,3 @@ class ArrayCacheTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/tests/Alchemy/Tests/Phrasea/Cache/MemcacheCacheTest.php b/tests/Alchemy/Tests/Phrasea/Cache/MemcacheCacheTest.php index 654633df81..82ff9aa9b9 100644 --- a/tests/Alchemy/Tests/Phrasea/Cache/MemcacheCacheTest.php +++ b/tests/Alchemy/Tests/Phrasea/Cache/MemcacheCacheTest.php @@ -53,4 +53,3 @@ class MemcacheCacheTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/tests/Alchemy/Tests/Phrasea/Cache/RedisCacheTest.php b/tests/Alchemy/Tests/Phrasea/Cache/RedisCacheTest.php index c2d3b0d02b..7b49a4c211 100644 --- a/tests/Alchemy/Tests/Phrasea/Cache/RedisCacheTest.php +++ b/tests/Alchemy/Tests/Phrasea/Cache/RedisCacheTest.php @@ -16,7 +16,7 @@ class RedisTest extends \PhraseanetPHPUnitAbstract } catch (\Exception $e) { $ok = false; } - if ( ! $ok) { + if (! $ok) { $this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis'); } } else { diff --git a/tests/Alchemy/Tests/Phrasea/Cache/XcacheCacheTest.php b/tests/Alchemy/Tests/Phrasea/Cache/XcacheCacheTest.php index d7ab635136..269bcb82b0 100644 --- a/tests/Alchemy/Tests/Phrasea/Cache/XcacheCacheTest.php +++ b/tests/Alchemy/Tests/Phrasea/Cache/XcacheCacheTest.php @@ -46,4 +46,3 @@ class XcacheCacheTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php index 35211ed991..8a0518083b 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php @@ -463,8 +463,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract , :type, :sha256, :uuid , :originalname, :mime)'; - - $stmt = $databox->get_connection()->prepare($sql); $i = 0; while ($i < 502) { @@ -502,7 +500,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract } } - if ( ! $found) { + if (! $found) { $this->fail('Task for empty collection has not been created'); } } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxesTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxesTest.php index 613ae3ab45..32e41b8f1a 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxesTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxesTest.php @@ -61,7 +61,6 @@ class DataboxesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertTrue(self::$DI['client']->getResponse()->isRedirect()); } - /** * @covers \Alchemy\Phrasea\Controller\Admin\Database::databaseMount */ @@ -81,7 +80,6 @@ class DataboxesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertTrue($response->isRedirect()); $uriRedirect = $response->headers->get('location'); - $this->assertTrue(!!strrpos($uriRedirect, 'success=1')); $explode = explode('/', $uriRedirect); $databoxId = $explode[3]; diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php index 54263c9cee..c502e92ab2 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/FieldsTest.php @@ -111,7 +111,7 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertGreaterThan(90, count($data)); - foreach($data as $tag) { + foreach ($data as $tag) { $this->assertArrayHasKey('id', $tag); $this->assertArrayHasKey('label', $tag); $this->assertArrayHasKey('value', $tag); @@ -162,7 +162,7 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract 'vocabulary-restricted' => false, )); - foreach($fields as $fieldData) { + foreach ($fields as $fieldData) { $field = \databox_field::create(self::$DI['app'], $databox, $fieldData['name'], $fieldData['multi']); $field ->set_thumbtitle($fieldData['thumbtitle']) @@ -204,7 +204,7 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(array_splice($body, -2), array_splice($data, -2)); // delete created fields - foreach($fieldObjects as $field) { + foreach ($fieldObjects as $field) { $field->delete(); } } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/PublicationTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/PublicationTest.php index dd52be9933..cfb615bbcb 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/PublicationTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/PublicationTest.php @@ -112,7 +112,6 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic , '/admin/publications/list/' ) === 0); - $feed = new \Feed_Adapter(self::$DI['app'], $feed->get_id()); $collection = $feed->get_collection(); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php index d76137da3d..9574fbd3c4 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/SubdefsTest.php @@ -31,7 +31,6 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertTrue(self::$DI['client']->getResponse()->isOk()); } - public function testPostRouteAddSubdef() { $name = $this->getSubdefName(); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/TaskManagerTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/TaskManagerTest.php index ce5ece94c4..7dc80c5619 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/TaskManagerTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/TaskManagerTest.php @@ -2,9 +2,10 @@ namespace Alchemy\Tests\Phrasea\Controller\Admin; -class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { - - public function testRouteTaskManager() { +class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract +{ + public function testRouteTaskManager() + { /** * get /admin/task-manager/ should redirect to /admin/task-manager/tasks */ @@ -14,7 +15,8 @@ class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { $this->assertTrue(self::$DI['client']->getResponse()->isRedirect('/admin/task-manager/tasks/')); } - public function testRouteTaskManager_tasks() { + public function testRouteTaskManager_tasks() + { $task_manager = self::$DI['app']['task-manager']; $crawler = self::$DI['client']->request( @@ -35,7 +37,8 @@ class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { $this->assertEquals(count($task_manager->getTasks()), count(get_object_vars($json->tasks))); } - public function testRouteTaskManager_task_create() { + public function testRouteTaskManager_task_create() + { $task_manager = self::$DI['app']['task-manager']; $nTasks0 = count($task_manager->getTasks()); @@ -67,7 +70,8 @@ class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { $this->assertEquals($nTasks2, $nTasks0); } - public function testRouteTaskManager_scheduler_log() { + public function testRouteTaskManager_scheduler_log() + { self::$DI['client']->request('GET', '/admin/task-manager/scheduler/log'); $response = self::$DI['client']->getResponse(); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/BasketTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/BasketTest.php index 8e08ffcbe2..208d10f771 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/BasketTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/BasketTest.php @@ -8,7 +8,6 @@ class ControllerBasketTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { protected $client; - public static function setUpBeforeClass() { parent::setUpBeforeClass(); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/BridgeTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/BridgeTest.php index 5560e83913..7589d91649 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/BridgeTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/BridgeTest.php @@ -312,7 +312,6 @@ class BridgeApplication extends \PhraseanetWebTestCaseAuthenticatedAbstract self::$DI['client']->request('GET', $url); $this->assertTrue(self::$DI['client']->getResponse()->isOk()); - \Bridge_Api_Apitest::$hasException = true; $url = sprintf("/prod/bridge/action/%s/createcontainer/%s/", self::$account->get_id(), self::$account->get_api()->get_connector()->get_default_element_type()); self::$DI['client']->request('POST', $url); @@ -403,7 +402,7 @@ class BridgeApplication extends \PhraseanetWebTestCaseAuthenticatedAbstract try { \Bridge_Account::load_account(self::$DI['app'], $account->get_id()); $this->fail('Account is not deleted'); - } catch(\Bridge_Exception_AccountNotFound $e) { + } catch (\Bridge_Exception_AccountNotFound $e) { } unset($account, $response); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/DoDownloadTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/DoDownloadTest.php index 23eae82915..15fd2211db 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/DoDownloadTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/DoDownloadTest.php @@ -338,7 +338,6 @@ class DoDownloadTest extends \PhraseanetWebTestCaseAuthenticatedAbstract unset($response); } - private function getToken($datas = array()) { return self::$DI['app']['tokens']->getUrlToken( @@ -356,6 +355,7 @@ class DoDownloadTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $row = $stmt->fetch(); $stmt->closeCursor(); unset($stmt); + return $row['nb_log']; } } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/ExportTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/ExportTest.php index 7d247486a9..df3fd335e3 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/ExportTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/ExportTest.php @@ -12,7 +12,7 @@ class ExportTest extends \PhraseanetWebTestCaseAuthenticatedAbstract public function tearDown() { - if(self::$GV_activeFTP) { + if (self::$GV_activeFTP) { self::$DI['app']['phraseanet.registry']->set('GV_activeFTP', true, \registry::TYPE_BOOLEAN); } @@ -144,7 +144,6 @@ class ExportTest extends \PhraseanetWebTestCaseAuthenticatedAbstract ); } - /** * @covers Alchemy\Phrasea\Controller\Prod\Export::exportFtp */ diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/FeedTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/FeedTest.php index b4feb613b3..0b6b9ef15c 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/FeedTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/FeedTest.php @@ -86,7 +86,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract { if ($this->feed instanceof \Feed_Adapter) { $this->feed->delete(); - } else if ($this->entry instanceof \Feed_Entry_Adapter) { + } elseif ($this->entry instanceof \Feed_Entry_Adapter) { $this->entry->delete(); if ($this->publisher instanceof \Feed_Publisher_Adapter) { $this->publisher->delete(); @@ -250,7 +250,6 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract ); $newfeed->set_collection(self::$DI['collection_no_access']); - $params = array( "feed_id" => $newfeed->get_id(), "title" => "dog", diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php index f93544bc89..e071742360 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php @@ -15,7 +15,7 @@ class RecordsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract public static function tearDownAfterClass() { - if(self::$feed instanceof \Feed_Adapter){ + if (self::$feed instanceof \Feed_Adapter) { self::$feed->delete(); } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/StoryTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/StoryTest.php index d29a38e959..f88dc50f59 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/StoryTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/StoryTest.php @@ -148,7 +148,7 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract self::$DI['record_2'] ); - foreach($records as $record) { + foreach ($records as $record) { $story->appendChild($record); } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/TooltipTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/TooltipTest.php index 1b8f863bee..600f61c683 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/TooltipTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/TooltipTest.php @@ -166,7 +166,6 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { $databox = self::$DI['record_story_1']->get_databox(); - $route = '/prod/tooltip/Story/' . $databox->get_sbas_id() . '/' . self::$DI['record_story_1']->get_record_id() . '/'; diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/UsrListsTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/UsrListsTest.php index 6f1d81dd5b..a186d312ff 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/UsrListsTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/UsrListsTest.php @@ -130,7 +130,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertFalse($datas['success']); - self::$DI['client']->request('POST', $route, array('name' => 'New NAME')); $response = self::$DI['client']->getResponse(); @@ -244,7 +243,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertBadResponse($response); $this->assertEquals('UTF-8', $response->getCharset()); - $route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/'; self::$DI['client']->request('POST', $route, array('role' => 'general')); @@ -263,7 +261,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('UTF-8', $response->getCharset()); - $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas); @@ -294,7 +291,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('UTF-8', $response->getCharset()); - $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas); @@ -308,8 +304,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(2, $list->getOwners()->count()); - - $route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/'; self::$DI['client']->request('POST', $route); @@ -348,7 +342,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('UTF-8', $response->getCharset()); - $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas); @@ -356,8 +349,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertTrue($datas['success']); - - $route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user']->get_id() . '/'; self::$DI['client']->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_USER)); @@ -367,7 +358,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('UTF-8', $response->getCharset()); - $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas); @@ -375,8 +365,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertFalse($datas['success']); - - $route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/'; self::$DI['client']->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_USER)); @@ -386,7 +374,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals('UTF-8', $response->getCharset()); - $datas = (array) json_decode($response->getContent()); $this->assertArrayHasKey('success', $datas); @@ -394,16 +381,12 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertTrue($datas['success']); - - $repository = self::$DI['app']['EM']->getRepository('Entities\UsrList'); $list = $repository->find($list->getId()); $this->assertEquals(2, $list->getOwners()->count()); - - $route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/'; self::$DI['client']->request('POST', $route); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/WorkZoneTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/WorkZoneTest.php index 5425910187..2b1e649824 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/WorkZoneTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/WorkZoneTest.php @@ -159,7 +159,6 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals(1, $count); - //detach self::$DI['client']->request('POST', $route); $response = self::$DI['client']->getResponse(); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php index 73c5298279..8b304a51b9 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/RSSFeedTest.php @@ -142,7 +142,6 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract self::$feed_4_entries[] = $entry; } - self::$public_feeds = \Feed_Collection::load_public_feeds(self::$DI['app']); self::$private_feeds = \Feed_Collection::load_all(self::$DI['app'], self::$DI['user']); self::$DI['app']['session']->clear(); @@ -398,6 +397,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract /** * XML is not verified due to Validator Service bug */ + return; try { @@ -410,7 +410,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract } } - function verifyRSS(\Feed_Adapter $feed, $xml_string) + public function verifyRSS(\Feed_Adapter $feed, $xml_string) { $dom_doc = new \DOMDocument(); $dom_doc->loadXML($xml_string); @@ -423,7 +423,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract $this->checkRSSEntryNode($xpath, $feed); } - function checkRSSRootNode(\DOMXPath $xpath, \Feed_Adapter $feed) + public function checkRSSRootNode(\DOMXPath $xpath, \Feed_Adapter $feed) { $channel = $xpath->query("/rss/channel"); foreach ($channel->item(0)->childNodes as $child) { @@ -463,7 +463,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract } } - function checkRSSEntryNode(\DOMXPath $xpath, \Feed_Adapter $feed) + public function checkRSSEntryNode(\DOMXPath $xpath, \Feed_Adapter $feed) { $list_entries = $xpath->query("/rss/channel/item"); $count = 0; @@ -512,7 +512,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract $this->assertEquals($feed->get_count_total_entries(), $count); } - function checkRSSEntryItemsNode(\DOMXPath $xpath, \Feed_Entry_Adapter $entry, $count) + public function checkRSSEntryItemsNode(\DOMXPath $xpath, \Feed_Entry_Adapter $entry, $count) { $content = $entry->get_content(); $available_medium = array('image', 'audio', 'video'); @@ -684,7 +684,6 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract ) ); - foreach ($fields as $key_field => $field) { $role = true; @@ -830,12 +829,10 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract $content = $entry->get_content(); - $available_medium = array('image', 'audio', 'video'); array_walk($content, $this->removeBadItems($content, $available_medium)); - $media_group = $xpath->query("/Atom:feed/Atom:entry[0]/media:group"); if ($media_group->length > 0) { diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php index 7f8f345e87..174527ef36 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php @@ -5,7 +5,6 @@ namespace Alchemy\Tests\Phrasea\Controller\Root; use Alchemy\Phrasea\Application; use Symfony\Component\HttpKernel\Client; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; use Symfony\Component\BrowserKit\Cookie as BrowserCookie; use Symfony\Component\BrowserKit\CookieJar; @@ -19,7 +18,7 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $found = false; - foreach($response->headers->getCookies() as $cookie) { + foreach ($response->headers->getCookies() as $cookie) { if ('locale' === $cookie->getName()) { if ('fr_CA' === $cookie->getValue()) { $found = true; diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Utils/ConnectionTestTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Utils/ConnectionTestTest.php index ac13d77836..00ddfcdc42 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Utils/ConnectionTestTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Utils/ConnectionTestTest.php @@ -90,4 +90,3 @@ class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract $this->assertFalse($content->database); } } - diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriberTest.php b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriberTest.php index c008f656a8..0f0643ac33 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriberTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriberTest.php @@ -131,6 +131,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract if ($locale) { $cookieJar->set(new BrowserCookie('locale', $locale)); } + return new Client($app, array(), null, $cookieJar); } } diff --git a/tests/Alchemy/Tests/Phrasea/Core/Service/Orm/DoctrineTest.php b/tests/Alchemy/Tests/Phrasea/Core/Service/Orm/DoctrineTest.php index 41af9e233e..e37175a964 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Service/Orm/DoctrineTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Service/Orm/DoctrineTest.php @@ -130,8 +130,7 @@ class DoctrineTest extends \PhraseanetPHPUnitAbstract elseif ($key === "result") $this->assertEquals("xcache", $service->getType()); } - } - else { + } else { try { $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( self::$DI['app'], $this->options diff --git a/tests/Alchemy/Tests/Phrasea/Core/ServiceBuilder/LogBuilderTest.php b/tests/Alchemy/Tests/Phrasea/Core/ServiceBuilder/LogBuilderTest.php index aefaf3e217..392434d902 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/ServiceBuilder/LogBuilderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/ServiceBuilder/LogBuilderTest.php @@ -2,7 +2,6 @@ namespace Alchemy\Tests\Phrasea\Core\ServiceBuilder; -use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Service\Builder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php index 0ead42811b..0ccdd39ee2 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php @@ -27,7 +27,7 @@ class MailSuccessFTPSenderTest extends MailTestCase try { $mail->getSubject(); $this->fail('Should have raised an exception'); - }catch(LogicException $e) { + } catch (LogicException $e) { } } diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaConfigurationPanelTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaConfigurationPanelTest.php index 9e9a51e17d..e0e6d08d31 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaConfigurationPanelTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaConfigurationPanelTest.php @@ -20,4 +20,4 @@ class PhraseaConfigurationPanelTest extends ConfigurationPanelAbstractTest { return new ConfigurationPanel(new PhraseaEngine(self::$DI['app'])); } -} \ No newline at end of file +} diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php index cbe3aef7cd..e6e7a4d18d 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/PhraseaEngineTest.php @@ -37,7 +37,7 @@ class PhraseaEngineTest extends SearchEngineAbstractTest . ' -b=' . $appbox->get_dbname() . ' -u=' . $appbox->get_user() . ' -p=' . $appbox->get_passwd() . ' --default-character-set=utf8 -n -o --quit'; - if(($stemms = implode(',', $stemms)) !== '') { + if (($stemms = implode(',', $stemms)) !== '') { $cmd .= ' --stem='.$stemms; } $process = new Process($cmd); @@ -145,4 +145,3 @@ class PhraseaEngineTest extends SearchEngineAbstractTest } } } - diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/SearchEngineAbstractTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/SearchEngineAbstractTest.php index a38cf0c039..51ed3dd85c 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/SearchEngineAbstractTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/SearchEngineAbstractTest.php @@ -8,7 +8,7 @@ use Alchemy\Phrasea\SearchEngine\SearchEngineInterface; abstract class SearchEngineAbstractTest extends \PhraseanetPHPUnitAuthenticatedAbstract { - protected $options; + protected $options; protected static $searchEngine; protected static $initialized = false; @@ -162,7 +162,6 @@ abstract class SearchEngineAbstractTest extends \PhraseanetPHPUnitAuthenticatedA $record->set_metadatas($toupdate); } - return $date_field; } diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchConfigurationPanelTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchConfigurationPanelTest.php index d29717a341..7adfdcffc9 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchConfigurationPanelTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchConfigurationPanelTest.php @@ -41,4 +41,4 @@ class SphinxSearchConfigurationPanelTest extends ConfigurationPanelAbstractTest $this->assertInternalType('string', $conf); } -} \ No newline at end of file +} diff --git a/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php b/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php index aff15af35c..562cafd442 100644 --- a/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php +++ b/tests/Alchemy/Tests/Phrasea/SearchEngine/SphinxSearchEngineTest.php @@ -40,7 +40,7 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest $configuration = self::$searchEngine->getConfigurationPanel()->getConfiguration(); $configuration['date_fields'] = array(); - foreach($appbox->get_databoxes() as $databox) { + foreach ($appbox->get_databoxes() as $databox) { foreach ($databox->get_meta_structure() as $databox_field) { if ($databox_field->get_type() != \databox_field::TYPE_DATE) { continue; @@ -66,7 +66,8 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest self::$searchEngine = new SphinxSearchEngine($app, '127.0.0.1', 19306, '127.0.0.1', 19308); } - public function setUp() { + public function setUp() + { parent::setUp(); if (self::$skipped) { $this->markTestSkipped('SphinxSearch is not present on system'); @@ -157,4 +158,3 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest return $this; } } - diff --git a/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php b/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php index febe32f8d7..107c3b99a4 100644 --- a/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php +++ b/tests/Alchemy/Tests/Phrasea/Setup/ConfigurationTesterTest.php @@ -157,6 +157,7 @@ class ConfigurationTesterTest extends AbstractSetupTester private function getTester(Application $app = null) { $app = $app? : new Application('test'); + return new ConfigurationTester($app); } }