This commit is contained in:
Romain Neutron
2013-05-29 21:23:36 +02:00
parent 38f38290c8
commit 278eb3c2dc
42 changed files with 53 additions and 98 deletions

View File

@@ -171,7 +171,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->evaluateResponse200(self::$DI['client']->getResponse()); $this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content); $this->evaluateMeta200($content);
$this->assertArrayHasKey('databoxes', $content['response']); $this->assertArrayHasKey('databoxes', $content['response']);
foreach ($content['response']['databoxes'] as $databox) { foreach ($content['response']['databoxes'] as $databox) {
$this->assertTrue(is_array($databox), 'Une databox est un objet'); $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')); $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())); $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()); $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_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']); $created_item = \Feed_Entry_Item::create(self::$DI['app']['phraseanet.appbox'], $created_entry, self::$DI['record_1']);
$this->setToken(self::$token); $this->setToken(self::$token);
$route = '/api/v1/feeds/content/'; $route = '/api/v1/feeds/content/';
@@ -1718,7 +1715,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->evaluateResponse200(self::$DI['client']->getResponse()); $this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content); $this->evaluateMeta200($content);
$this->assertArrayHasKey('total_entries', $content['response']); $this->assertArrayHasKey('total_entries', $content['response']);
$this->assertArrayHasKey('offset_start', $content['response']); $this->assertArrayHasKey('offset_start', $content['response']);
$this->assertArrayHasKey('per_page', $content['response']); $this->assertArrayHasKey('per_page', $content['response']);
@@ -2567,7 +2563,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertArrayHasKey('results', $response); $this->assertArrayHasKey('results', $response);
$this->assertArrayHasKey('query', $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['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_int($response['total_results']), 'Le nombre de results est un int');
$this->assertTrue(is_string($response['error']), 'Error est une string'); $this->assertTrue(is_string($response['error']), 'Error est une string');

View File

@@ -2,8 +2,6 @@
namespace Alchemy\Tests\Phrasea\Application; namespace Alchemy\Tests\Phrasea\Application;
use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Manager;
use Symfony\Component\HttpKernel\Client; use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;

View File

@@ -7,7 +7,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract 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/'); $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(); $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')); $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/'); 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()); $this->assertNotFoundResponse(self::$DI['client']->getResponse());
} }
function testEtag() public function testEtag()
{ {
$tmp = tempnam(sys_get_temp_dir(), 'testEtag'); $tmp = tempnam(sys_get_temp_dir(), 'testEtag');
copy(__DIR__ . '/../../../../files/cestlafete.jpg', $tmp); copy(__DIR__ . '/../../../../files/cestlafete.jpg', $tmp);
@@ -53,7 +53,7 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac
unlink($tmp); unlink($tmp);
} }
function testDatafilesRouteNotAuthenticated() public function testDatafilesRouteNotAuthenticated()
{ {
self::$DI['app']['authentication']->closeAccount(); 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/'); 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()); $this->assertForbiddenResponse(self::$DI['client']->getResponse());
} }
function testDatafilesRouteNotAuthenticatedUnknownSubdef() public function testDatafilesRouteNotAuthenticatedUnknownSubdef()
{ {
self::$DI['app']['authentication']->closeAccount(); 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/'); 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()); $this->assertForbiddenResponse(self::$DI['client']->getResponse());
} }
function testPermalinkAuthenticated() public function testPermalinkAuthenticated()
{ {
$this->assertTrue(self::$DI['app']['authentication']->isAuthenticated()); $this->assertTrue(self::$DI['app']['authentication']->isAuthenticated());
$this->get_a_permalinkBCcompatibility(array("Content-Type" => "image/jpeg")); $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")); $this->get_a_permaview(array("Content-Type" => "text/html; charset=UTF-8"));
} }
function testPermalinkNotAuthenticated() public function testPermalinkNotAuthenticated()
{ {
self::$DI['app']['authentication']->closeAccount(); self::$DI['app']['authentication']->closeAccount();
$this->assertFalse(self::$DI['app']['authentication']->isAuthenticated()); $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")); $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->assertTrue(self::$DI['app']['authentication']->isAuthenticated());
$this->get_a_caption(array("Content-Type" => "application/json")); $this->get_a_caption(array("Content-Type" => "application/json"));
} }
function testCaptionNotAuthenticated() public function testCaptionNotAuthenticated()
{ {
self::$DI['app']['authentication']->closeAccount(); self::$DI['app']['authentication']->closeAccount();
$this->assertFalse(self::$DI['app']['authentication']->isAuthenticated()); $this->assertFalse(self::$DI['app']['authentication']->isAuthenticated());
$this->get_a_caption(array("Content-Type" => "application/json")); $this->get_a_caption(array("Content-Type" => "application/json"));
} }
function testCaptionWithaWrongToken() public function testCaptionWithaWrongToken()
{ {
$this->assertTrue(self::$DI['app']['authentication']->isAuthenticated()); $this->assertTrue(self::$DI['app']['authentication']->isAuthenticated());
$token = "unexisting_token"; $token = "unexisting_token";
@@ -113,7 +113,7 @@ class ApplicationOverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstrac
$this->assertEquals(404, $response->getStatusCode()); $this->assertEquals(404, $response->getStatusCode());
} }
function testCaptionWithaWrongRecord() public function testCaptionWithaWrongRecord()
{ {
$this->assertTrue(self::$DI['app']['authentication']->isAuthenticated()); $this->assertTrue(self::$DI['app']['authentication']->isAuthenticated());
$url = '/permalink/v1/unexisting_record/unexisting_id/caption/?token=unexisting_token'; $url = '/permalink/v1/unexisting_record/unexisting_id/caption/?token=unexisting_token';

View File

@@ -281,7 +281,6 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$app = new Application('test'); $app = new Application('test');
$app->get('/', function(Application $app, Request $request) { $app->get('/', function(Application $app, Request $request) {
return $app['locale']; return $app['locale'];
}); });
unset($app['exception_handler']); unset($app['exception_handler']);

View File

@@ -143,6 +143,7 @@ class FailureManagerTest extends \PHPUnit_Framework_TestCase
$failure->expects($phpunit->once()) $failure->expects($phpunit->once())
->method('setLocked') ->method('setLocked')
->with($phpunit->equalTo(false)); ->with($phpunit->equalTo(false));
return $failure; return $failure;
}, 10); }, 10);
@@ -207,7 +208,7 @@ class FailureManagerTest extends \PHPUnit_Framework_TestCase
$em = $this->getMockBuilder('Doctrine\ORM\EntityManager') $em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$recaptcha = $this->getReCaptchaMock(null); $recaptcha = $this->getReCaptchaMock(null);
$manager = new FailureManager($em, $recaptcha, 2); $manager = new FailureManager($em, $recaptcha, 2);

View File

@@ -255,7 +255,6 @@ class GooglePlusTest extends ProviderTestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$google = new GooglePlus($this->getUrlGeneratorMock(), $this->getMockSession(), $googleMock, $this->getGuzzleMock()); $google = new GooglePlus($this->getUrlGeneratorMock(), $this->getMockSession(), $googleMock, $this->getGuzzleMock());
$google->setGooglePlusService($plus); $google->setGooglePlusService($plus);

View File

@@ -63,12 +63,10 @@ class LinkedinTest extends ProviderTestCase
->method('post') ->method('post')
->will($this->returnValue($requestPost)); ->will($this->returnValue($requestPost));
$provider2 = $this->getProvider(); $provider2 = $this->getProvider();
$provider2->setGuzzleClient($mock); $provider2->setGuzzleClient($mock);
$provider2->getSession()->set('linkedin.provider.state', $state); $provider2->getSession()->set('linkedin.provider.state', $state);
return array( return array(
array($this->getProvider(), $this->getRequestMock()), array($this->getProvider(), $this->getRequestMock()),
array($provider1, $request), array($provider1, $request),

View File

@@ -89,6 +89,7 @@ class TwitterTest extends ProviderTestCase
); );
$first = false; $first = false;
return 200; return 200;
} }
})); }));
@@ -113,7 +114,7 @@ class TwitterTest extends ProviderTestCase
$provider->getTwitterClient()->expects($this->any()) $provider->getTwitterClient()->expects($this->any())
->method('request') ->method('request')
->will($this->returnCallback(function ($method) use ($provider, $phpunit) { ->will($this->returnCallback(function ($method) use ($provider, $phpunit) {
switch($method) { switch ($method) {
case 'POST': case 'POST':
$provider->getTwitterClient()->response = array( $provider->getTwitterClient()->response = array(
'response' => array( 'response' => array(

View File

@@ -45,4 +45,3 @@ class ApcCacheTest extends \PHPUnit_Framework_TestCase
); );
} }
} }

View File

@@ -42,4 +42,3 @@ class ArrayCacheTest extends \PHPUnit_Framework_TestCase
); );
} }
} }

View File

@@ -53,4 +53,3 @@ class MemcacheCacheTest extends \PHPUnit_Framework_TestCase
); );
} }
} }

View File

@@ -16,7 +16,7 @@ class RedisTest extends \PhraseanetPHPUnitAbstract
} catch (\Exception $e) { } catch (\Exception $e) {
$ok = false; $ok = false;
} }
if ( ! $ok) { if (! $ok) {
$this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis'); $this->markTestSkipped('The ' . __CLASS__ . ' requires the use of redis');
} }
} else { } else {

View File

@@ -46,4 +46,3 @@ class XcacheCacheTest extends \PHPUnit_Framework_TestCase
); );
} }
} }

View File

@@ -463,8 +463,6 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
, :type, :sha256, :uuid , :type, :sha256, :uuid
, :originalname, :mime)'; , :originalname, :mime)';
$stmt = $databox->get_connection()->prepare($sql); $stmt = $databox->get_connection()->prepare($sql);
$i = 0; $i = 0;
while ($i < 502) { 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'); $this->fail('Task for empty collection has not been created');
} }
} }

View File

@@ -61,7 +61,6 @@ class DataboxesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect()); $this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
} }
/** /**
* @covers \Alchemy\Phrasea\Controller\Admin\Database::databaseMount * @covers \Alchemy\Phrasea\Controller\Admin\Database::databaseMount
*/ */
@@ -81,7 +80,6 @@ class DataboxesTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($response->isRedirect()); $this->assertTrue($response->isRedirect());
$uriRedirect = $response->headers->get('location'); $uriRedirect = $response->headers->get('location');
$this->assertTrue(!!strrpos($uriRedirect, 'success=1')); $this->assertTrue(!!strrpos($uriRedirect, 'success=1'));
$explode = explode('/', $uriRedirect); $explode = explode('/', $uriRedirect);
$databoxId = $explode[3]; $databoxId = $explode[3];

View File

@@ -111,7 +111,7 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertGreaterThan(90, count($data)); $this->assertGreaterThan(90, count($data));
foreach($data as $tag) { foreach ($data as $tag) {
$this->assertArrayHasKey('id', $tag); $this->assertArrayHasKey('id', $tag);
$this->assertArrayHasKey('label', $tag); $this->assertArrayHasKey('label', $tag);
$this->assertArrayHasKey('value', $tag); $this->assertArrayHasKey('value', $tag);
@@ -162,7 +162,7 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
'vocabulary-restricted' => false, 'vocabulary-restricted' => false,
)); ));
foreach($fields as $fieldData) { foreach ($fields as $fieldData) {
$field = \databox_field::create(self::$DI['app'], $databox, $fieldData['name'], $fieldData['multi']); $field = \databox_field::create(self::$DI['app'], $databox, $fieldData['name'], $fieldData['multi']);
$field $field
->set_thumbtitle($fieldData['thumbtitle']) ->set_thumbtitle($fieldData['thumbtitle'])
@@ -204,7 +204,7 @@ class ControllerFieldsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(array_splice($body, -2), array_splice($data, -2)); $this->assertEquals(array_splice($body, -2), array_splice($data, -2));
// delete created fields // delete created fields
foreach($fieldObjects as $field) { foreach ($fieldObjects as $field) {
$field->delete(); $field->delete();
} }
} }

View File

@@ -112,7 +112,6 @@ class Module_Admin_Route_PublicationTest extends \PhraseanetWebTestCaseAuthentic
, '/admin/publications/list/' , '/admin/publications/list/'
) === 0); ) === 0);
$feed = new \Feed_Adapter(self::$DI['app'], $feed->get_id()); $feed = new \Feed_Adapter(self::$DI['app'], $feed->get_id());
$collection = $feed->get_collection(); $collection = $feed->get_collection();

View File

@@ -31,7 +31,6 @@ class ControllerSubdefsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $this->assertTrue(self::$DI['client']->getResponse()->isOk());
} }
public function testPostRouteAddSubdef() public function testPostRouteAddSubdef()
{ {
$name = $this->getSubdefName(); $name = $this->getSubdefName();

View File

@@ -2,9 +2,10 @@
namespace Alchemy\Tests\Phrasea\Controller\Admin; namespace Alchemy\Tests\Phrasea\Controller\Admin;
class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
public function testRouteTaskManager() { public function testRouteTaskManager()
{
/** /**
* get /admin/task-manager/ should redirect to /admin/task-manager/tasks * 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/')); $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']; $task_manager = self::$DI['app']['task-manager'];
$crawler = self::$DI['client']->request( $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))); $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']; $task_manager = self::$DI['app']['task-manager'];
$nTasks0 = count($task_manager->getTasks()); $nTasks0 = count($task_manager->getTasks());
@@ -67,7 +70,8 @@ class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract {
$this->assertEquals($nTasks2, $nTasks0); $this->assertEquals($nTasks2, $nTasks0);
} }
public function testRouteTaskManager_scheduler_log() { public function testRouteTaskManager_scheduler_log()
{
self::$DI['client']->request('GET', '/admin/task-manager/scheduler/log'); self::$DI['client']->request('GET', '/admin/task-manager/scheduler/log');
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();

View File

@@ -8,7 +8,6 @@ class ControllerBasketTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
protected $client; protected $client;
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {
parent::setUpBeforeClass(); parent::setUpBeforeClass();

View File

@@ -312,7 +312,6 @@ class BridgeApplication extends \PhraseanetWebTestCaseAuthenticatedAbstract
self::$DI['client']->request('GET', $url); self::$DI['client']->request('GET', $url);
$this->assertTrue(self::$DI['client']->getResponse()->isOk()); $this->assertTrue(self::$DI['client']->getResponse()->isOk());
\Bridge_Api_Apitest::$hasException = true; \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()); $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); self::$DI['client']->request('POST', $url);
@@ -403,7 +402,7 @@ class BridgeApplication extends \PhraseanetWebTestCaseAuthenticatedAbstract
try { try {
\Bridge_Account::load_account(self::$DI['app'], $account->get_id()); \Bridge_Account::load_account(self::$DI['app'], $account->get_id());
$this->fail('Account is not deleted'); $this->fail('Account is not deleted');
} catch(\Bridge_Exception_AccountNotFound $e) { } catch (\Bridge_Exception_AccountNotFound $e) {
} }
unset($account, $response); unset($account, $response);

View File

@@ -338,7 +338,6 @@ class DoDownloadTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
unset($response); unset($response);
} }
private function getToken($datas = array()) private function getToken($datas = array())
{ {
return self::$DI['app']['tokens']->getUrlToken( return self::$DI['app']['tokens']->getUrlToken(
@@ -356,6 +355,7 @@ class DoDownloadTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$row = $stmt->fetch(); $row = $stmt->fetch();
$stmt->closeCursor(); $stmt->closeCursor();
unset($stmt); unset($stmt);
return $row['nb_log']; return $row['nb_log'];
} }
} }

View File

@@ -12,7 +12,7 @@ class ExportTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function tearDown() public function tearDown()
{ {
if(self::$GV_activeFTP) { if (self::$GV_activeFTP) {
self::$DI['app']['phraseanet.registry']->set('GV_activeFTP', true, \registry::TYPE_BOOLEAN); 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 * @covers Alchemy\Phrasea\Controller\Prod\Export::exportFtp
*/ */

View File

@@ -86,7 +86,7 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
if ($this->feed instanceof \Feed_Adapter) { if ($this->feed instanceof \Feed_Adapter) {
$this->feed->delete(); $this->feed->delete();
} else if ($this->entry instanceof \Feed_Entry_Adapter) { } elseif ($this->entry instanceof \Feed_Entry_Adapter) {
$this->entry->delete(); $this->entry->delete();
if ($this->publisher instanceof \Feed_Publisher_Adapter) { if ($this->publisher instanceof \Feed_Publisher_Adapter) {
$this->publisher->delete(); $this->publisher->delete();
@@ -250,7 +250,6 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
); );
$newfeed->set_collection(self::$DI['collection_no_access']); $newfeed->set_collection(self::$DI['collection_no_access']);
$params = array( $params = array(
"feed_id" => $newfeed->get_id(), "feed_id" => $newfeed->get_id(),
"title" => "dog", "title" => "dog",

View File

@@ -15,7 +15,7 @@ class RecordsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
if(self::$feed instanceof \Feed_Adapter){ if (self::$feed instanceof \Feed_Adapter) {
self::$feed->delete(); self::$feed->delete();
} }

View File

@@ -148,7 +148,7 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
self::$DI['record_2'] self::$DI['record_2']
); );
foreach($records as $record) { foreach ($records as $record) {
$story->appendChild($record); $story->appendChild($record);
} }

View File

@@ -166,7 +166,6 @@ class ControllerTooltipTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
$databox = self::$DI['record_story_1']->get_databox(); $databox = self::$DI['record_story_1']->get_databox();
$route = '/prod/tooltip/Story/' . $databox->get_sbas_id() $route = '/prod/tooltip/Story/' . $databox->get_sbas_id()
. '/' . self::$DI['record_story_1']->get_record_id() . '/'; . '/' . self::$DI['record_story_1']->get_record_id() . '/';

View File

@@ -130,7 +130,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertFalse($datas['success']); $this->assertFalse($datas['success']);
self::$DI['client']->request('POST', $route, array('name' => 'New NAME')); self::$DI['client']->request('POST', $route, array('name' => 'New NAME'));
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
@@ -244,7 +243,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertBadResponse($response); $this->assertBadResponse($response);
$this->assertEquals('UTF-8', $response->getCharset()); $this->assertEquals('UTF-8', $response->getCharset());
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/'; $route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/';
self::$DI['client']->request('POST', $route, array('role' => 'general')); self::$DI['client']->request('POST', $route, array('role' => 'general'));
@@ -263,7 +261,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset()); $this->assertEquals('UTF-8', $response->getCharset());
$datas = (array) json_decode($response->getContent()); $datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas); $this->assertArrayHasKey('success', $datas);
@@ -294,7 +291,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset()); $this->assertEquals('UTF-8', $response->getCharset());
$datas = (array) json_decode($response->getContent()); $datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas); $this->assertArrayHasKey('success', $datas);
@@ -308,8 +304,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(2, $list->getOwners()->count()); $this->assertEquals(2, $list->getOwners()->count());
$route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/'; $route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/';
self::$DI['client']->request('POST', $route); self::$DI['client']->request('POST', $route);
@@ -348,7 +342,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset()); $this->assertEquals('UTF-8', $response->getCharset());
$datas = (array) json_decode($response->getContent()); $datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas); $this->assertArrayHasKey('success', $datas);
@@ -356,8 +349,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($datas['success']); $this->assertTrue($datas['success']);
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user']->get_id() . '/'; $route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user']->get_id() . '/';
self::$DI['client']->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_USER)); 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(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset()); $this->assertEquals('UTF-8', $response->getCharset());
$datas = (array) json_decode($response->getContent()); $datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas); $this->assertArrayHasKey('success', $datas);
@@ -375,8 +365,6 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertFalse($datas['success']); $this->assertFalse($datas['success']);
$route = '/prod/lists/list/' . $list->getId() . '/share/' . self::$DI['user_alt1']->get_id() . '/'; $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)); 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(200, $response->getStatusCode());
$this->assertEquals('UTF-8', $response->getCharset()); $this->assertEquals('UTF-8', $response->getCharset());
$datas = (array) json_decode($response->getContent()); $datas = (array) json_decode($response->getContent());
$this->assertArrayHasKey('success', $datas); $this->assertArrayHasKey('success', $datas);
@@ -394,16 +381,12 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertTrue($datas['success']); $this->assertTrue($datas['success']);
$repository = self::$DI['app']['EM']->getRepository('Entities\UsrList'); $repository = self::$DI['app']['EM']->getRepository('Entities\UsrList');
$list = $repository->find($list->getId()); $list = $repository->find($list->getId());
$this->assertEquals(2, $list->getOwners()->count()); $this->assertEquals(2, $list->getOwners()->count());
$route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/'; $route = '/prod/lists/list/' . $list->getId() . '/unshare/' . self::$DI['user_alt1']->get_id() . '/';
self::$DI['client']->request('POST', $route); self::$DI['client']->request('POST', $route);

View File

@@ -159,7 +159,6 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(1, $count); $this->assertEquals(1, $count);
//detach //detach
self::$DI['client']->request('POST', $route); self::$DI['client']->request('POST', $route);
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();

View File

@@ -142,7 +142,6 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
self::$feed_4_entries[] = $entry; self::$feed_4_entries[] = $entry;
} }
self::$public_feeds = \Feed_Collection::load_public_feeds(self::$DI['app']); 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::$private_feeds = \Feed_Collection::load_all(self::$DI['app'], self::$DI['user']);
self::$DI['app']['session']->clear(); self::$DI['app']['session']->clear();
@@ -398,6 +397,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
/** /**
* XML is not verified due to Validator Service bug * XML is not verified due to Validator Service bug
*/ */
return; return;
try { 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 = new \DOMDocument();
$dom_doc->loadXML($xml_string); $dom_doc->loadXML($xml_string);
@@ -423,7 +423,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->checkRSSEntryNode($xpath, $feed); $this->checkRSSEntryNode($xpath, $feed);
} }
function checkRSSRootNode(\DOMXPath $xpath, \Feed_Adapter $feed) public function checkRSSRootNode(\DOMXPath $xpath, \Feed_Adapter $feed)
{ {
$channel = $xpath->query("/rss/channel"); $channel = $xpath->query("/rss/channel");
foreach ($channel->item(0)->childNodes as $child) { 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"); $list_entries = $xpath->query("/rss/channel/item");
$count = 0; $count = 0;
@@ -512,7 +512,7 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
$this->assertEquals($feed->get_count_total_entries(), $count); $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(); $content = $entry->get_content();
$available_medium = array('image', 'audio', 'video'); $available_medium = array('image', 'audio', 'video');
@@ -684,7 +684,6 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
) )
); );
foreach ($fields as $key_field => $field) { foreach ($fields as $key_field => $field) {
$role = true; $role = true;
@@ -830,12 +829,10 @@ class RssFeedTest extends \PhraseanetWebTestCaseAbstract
$content = $entry->get_content(); $content = $entry->get_content();
$available_medium = array('image', 'audio', 'video'); $available_medium = array('image', 'audio', 'video');
array_walk($content, $this->removeBadItems($content, $available_medium)); array_walk($content, $this->removeBadItems($content, $available_medium));
$media_group = $xpath->query("/Atom:feed/Atom:entry[0]/media:group"); $media_group = $xpath->query("/Atom:feed/Atom:entry[0]/media:group");
if ($media_group->length > 0) { if ($media_group->length > 0) {

View File

@@ -5,7 +5,6 @@ namespace Alchemy\Tests\Phrasea\Controller\Root;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Symfony\Component\HttpKernel\Client; use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\BrowserKit\Cookie as BrowserCookie; use Symfony\Component\BrowserKit\Cookie as BrowserCookie;
use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\CookieJar;
@@ -19,7 +18,7 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$found = false; $found = false;
foreach($response->headers->getCookies() as $cookie) { foreach ($response->headers->getCookies() as $cookie) {
if ('locale' === $cookie->getName()) { if ('locale' === $cookie->getName()) {
if ('fr_CA' === $cookie->getValue()) { if ('fr_CA' === $cookie->getValue()) {
$found = true; $found = true;

View File

@@ -90,4 +90,3 @@ class ControllerConnectionTestTest extends \PhraseanetWebTestCaseAbstract
$this->assertFalse($content->database); $this->assertFalse($content->database);
} }
} }

View File

@@ -131,6 +131,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetPHPUnitAbstract
if ($locale) { if ($locale) {
$cookieJar->set(new BrowserCookie('locale', $locale)); $cookieJar->set(new BrowserCookie('locale', $locale));
} }
return new Client($app, array(), null, $cookieJar); return new Client($app, array(), null, $cookieJar);
} }
} }

View File

@@ -130,8 +130,7 @@ class DoctrineTest extends \PhraseanetPHPUnitAbstract
elseif ($key === "result") elseif ($key === "result")
$this->assertEquals("xcache", $service->getType()); $this->assertEquals("xcache", $service->getType());
} }
} } else {
else {
try { try {
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine( $doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
self::$DI['app'], $this->options self::$DI['app'], $this->options

View File

@@ -2,7 +2,6 @@
namespace Alchemy\Tests\Phrasea\Core\ServiceBuilder; namespace Alchemy\Tests\Phrasea\Core\ServiceBuilder;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Service\Builder; use Alchemy\Phrasea\Core\Service\Builder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;

View File

@@ -27,7 +27,7 @@ class MailSuccessFTPSenderTest extends MailTestCase
try { try {
$mail->getSubject(); $mail->getSubject();
$this->fail('Should have raised an exception'); $this->fail('Should have raised an exception');
}catch(LogicException $e) { } catch (LogicException $e) {
} }
} }

View File

@@ -20,4 +20,4 @@ class PhraseaConfigurationPanelTest extends ConfigurationPanelAbstractTest
{ {
return new ConfigurationPanel(new PhraseaEngine(self::$DI['app'])); return new ConfigurationPanel(new PhraseaEngine(self::$DI['app']));
} }
} }

View File

@@ -37,7 +37,7 @@ class PhraseaEngineTest extends SearchEngineAbstractTest
. ' -b=' . $appbox->get_dbname() . ' -u=' . $appbox->get_user() . ' -b=' . $appbox->get_dbname() . ' -u=' . $appbox->get_user()
. ' -p=' . $appbox->get_passwd() . ' -p=' . $appbox->get_passwd()
. ' --default-character-set=utf8 -n -o --quit'; . ' --default-character-set=utf8 -n -o --quit';
if(($stemms = implode(',', $stemms)) !== '') { if (($stemms = implode(',', $stemms)) !== '') {
$cmd .= ' --stem='.$stemms; $cmd .= ' --stem='.$stemms;
} }
$process = new Process($cmd); $process = new Process($cmd);
@@ -145,4 +145,3 @@ class PhraseaEngineTest extends SearchEngineAbstractTest
} }
} }
} }

View File

@@ -8,7 +8,7 @@ use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
abstract class SearchEngineAbstractTest extends \PhraseanetPHPUnitAuthenticatedAbstract abstract class SearchEngineAbstractTest extends \PhraseanetPHPUnitAuthenticatedAbstract
{ {
protected $options; protected $options;
protected static $searchEngine; protected static $searchEngine;
protected static $initialized = false; protected static $initialized = false;
@@ -162,7 +162,6 @@ abstract class SearchEngineAbstractTest extends \PhraseanetPHPUnitAuthenticatedA
$record->set_metadatas($toupdate); $record->set_metadatas($toupdate);
} }
return $date_field; return $date_field;
} }

View File

@@ -41,4 +41,4 @@ class SphinxSearchConfigurationPanelTest extends ConfigurationPanelAbstractTest
$this->assertInternalType('string', $conf); $this->assertInternalType('string', $conf);
} }
} }

View File

@@ -40,7 +40,7 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest
$configuration = self::$searchEngine->getConfigurationPanel()->getConfiguration(); $configuration = self::$searchEngine->getConfigurationPanel()->getConfiguration();
$configuration['date_fields'] = array(); $configuration['date_fields'] = array();
foreach($appbox->get_databoxes() as $databox) { foreach ($appbox->get_databoxes() as $databox) {
foreach ($databox->get_meta_structure() as $databox_field) { foreach ($databox->get_meta_structure() as $databox_field) {
if ($databox_field->get_type() != \databox_field::TYPE_DATE) { if ($databox_field->get_type() != \databox_field::TYPE_DATE) {
continue; continue;
@@ -66,7 +66,8 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest
self::$searchEngine = new SphinxSearchEngine($app, '127.0.0.1', 19306, '127.0.0.1', 19308); self::$searchEngine = new SphinxSearchEngine($app, '127.0.0.1', 19306, '127.0.0.1', 19308);
} }
public function setUp() { public function setUp()
{
parent::setUp(); parent::setUp();
if (self::$skipped) { if (self::$skipped) {
$this->markTestSkipped('SphinxSearch is not present on system'); $this->markTestSkipped('SphinxSearch is not present on system');
@@ -157,4 +158,3 @@ class SphinxSearchEngineTest extends SearchEngineAbstractTest
return $this; return $this;
} }
} }

View File

@@ -157,6 +157,7 @@ class ConfigurationTesterTest extends AbstractSetupTester
private function getTester(Application $app = null) private function getTester(Application $app = null)
{ {
$app = $app? : new Application('test'); $app = $app? : new Application('test');
return new ConfigurationTester($app); return new ConfigurationTester($app);
} }
} }