mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 10:34:34 +00:00
Fix CS
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Authentication\Provider;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
|
||||
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
|
||||
use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
|
||||
@@ -59,7 +58,6 @@ interface ProviderInterface
|
||||
* This method is called on provider callback, whenever the auth was
|
||||
* successful or failure.
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws NotAuthenticatedException In case the authentication failed.
|
||||
|
@@ -95,6 +95,7 @@ class API_V1_result
|
||||
/**
|
||||
* API v1 Result constructor
|
||||
*
|
||||
* @param Application $app
|
||||
* @param Request $request
|
||||
* @param API_V1_adapter $api
|
||||
*
|
||||
|
@@ -49,7 +49,8 @@ class patch_379 implements patchInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param base $databox
|
||||
* @param base $appbox
|
||||
* @param Application $app
|
||||
*/
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
|
@@ -40,7 +40,6 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
self::$DI['user']->ACL()->revoke_access_from_bases(array(self::$DI['collection_no_access']->get_base_id()));
|
||||
self::$DI['user']->ACL()->set_masks_on_base(self::$DI['collection_no_access_by_status']->get_base_id(), '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000');
|
||||
|
||||
|
||||
parent::tearDownAfterClass();
|
||||
}
|
||||
|
||||
@@ -232,7 +231,6 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
, 'canaddrecord' => true
|
||||
);
|
||||
|
||||
|
||||
foreach (self::$DI['app']['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
$base_id = $collection->get_base_id();
|
||||
@@ -344,12 +342,10 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
public function testHas_right()
|
||||
{
|
||||
|
||||
|
||||
$rights = array(
|
||||
'bas_modify_struct' => true
|
||||
);
|
||||
|
||||
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right('bas_modify_struct'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_right('bas_modif_th'));
|
||||
|
||||
@@ -380,7 +376,6 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
, 'bas_modif_th' => true
|
||||
);
|
||||
|
||||
|
||||
foreach (self::$DI['app']['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
self::$DI['user']->ACL()->give_access_to_sbas(array($databox->get_sbas_id()));
|
||||
self::$DI['user']->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights_false);
|
||||
@@ -460,7 +455,6 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals(count($base_ids), count($bases));
|
||||
|
||||
|
||||
$sql = 'SELECT actif FROM basusr WHERE usr_id = :usr_id AND base_id = :base_id';
|
||||
$stmt = self::$DI['app']['phraseanet.appbox']->get_connection()->prepare($sql);
|
||||
|
||||
@@ -599,7 +593,6 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertTrue(self::$DI['user']->ACL()->has_access_to_module('thesaurus'));
|
||||
$this->assertFalse(self::$DI['user']->ACL()->has_access_to_module('upload'));
|
||||
|
||||
|
||||
$found = false;
|
||||
foreach (self::$DI['app']['phraseanet.appbox']->get_databoxes() as $databox) {
|
||||
foreach ($databox->get_collections() as $collection) {
|
||||
|
@@ -62,7 +62,6 @@ class Feed_XML_RSSTest extends PhraseanetPHPUnitAbstract
|
||||
$last_build = new DateTime('-2 hours');
|
||||
self::$rss->set_lastBuildDate($last_build);
|
||||
|
||||
|
||||
$xml = self::$rss->render();
|
||||
$sxe = simplexml_load_string($xml);
|
||||
$this->assertInstanceOf('SimpleXMLElement', $sxe);
|
||||
@@ -131,7 +130,6 @@ class Feed_XML_RSSTest extends PhraseanetPHPUnitAbstract
|
||||
$image->set_height($height);
|
||||
$image->set_description($description);
|
||||
|
||||
|
||||
self::$rss->set_image($image);
|
||||
$xml = self::$rss->render();
|
||||
$sxe = simplexml_load_string($xml);
|
||||
|
@@ -125,10 +125,10 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
return $em;
|
||||
}));
|
||||
|
||||
|
||||
$app['browser'] = $app->share($app->extend('browser', function($browser) {
|
||||
|
||||
$browser->setUserAgent(PhraseanetPHPUnitAbstract::USER_AGENT_FIREFOX8MAC);
|
||||
|
||||
return $browser;
|
||||
}));
|
||||
|
||||
@@ -144,7 +144,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
return $app;
|
||||
});
|
||||
|
||||
|
||||
self::$DI['client'] = self::$DI->share(function($DI) {
|
||||
return new Client($DI['app'], array());
|
||||
});
|
||||
@@ -198,7 +197,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
$this->assertTrue(false !== stripos($response->getContent(), 'not found'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert fixture contained in the specified fixtureLoader
|
||||
* into sqlLite test temporary database
|
||||
@@ -302,7 +300,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
$loader->addFixture($UsrList);
|
||||
|
||||
|
||||
$this->insertFixtureInDatabase($loader);
|
||||
|
||||
return $UsrList->list;
|
||||
@@ -336,7 +333,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
$loader->addFixture($UsrEntry);
|
||||
|
||||
|
||||
$this->insertFixtureInDatabase($loader);
|
||||
|
||||
return $UsrEntry->entry;
|
||||
@@ -716,6 +712,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
$DI->extend('user', function ($user, $DI) use ($collection_no_acces) {
|
||||
$user->ACL()->revoke_access_from_bases(array($collection_no_acces->get_base_id()));
|
||||
$DI['client'] = new Client($DI['app'], array());
|
||||
|
||||
return $user;
|
||||
})
|
||||
);
|
||||
@@ -734,6 +731,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
$DI->extend('user', function ($user, $DI) use ($collection_no_acces_by_status) {
|
||||
$user->ACL()->set_masks_on_base($collection_no_acces_by_status->get_base_id(), '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000');
|
||||
$DI['client'] = new Client($DI['app'], array());
|
||||
|
||||
return $user;
|
||||
})
|
||||
);
|
||||
@@ -817,6 +815,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
self::$DI->extend('user', function ($user, $DI) use ($app) {
|
||||
PhraseanetPHPUnitAbstract::giveRightsToUser($app, $user);
|
||||
$user->ACL()->set_admin(true);
|
||||
|
||||
return $user;
|
||||
})
|
||||
);
|
||||
@@ -825,6 +824,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
self::$DI->extend('user_notAdmin', function ($user, $DI) use ($app) {
|
||||
PhraseanetPHPUnitAbstract::giveRightsToUser($app, $user);
|
||||
$user->ACL()->set_admin(false);
|
||||
|
||||
return $user;
|
||||
})
|
||||
);
|
||||
|
@@ -1,9 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Silex\WebTestCase;
|
||||
use Symfony\Component\HttpKernel\Client;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitAbstract
|
||||
{
|
||||
|
||||
|
@@ -1,9 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Silex\WebTestCase;
|
||||
use Symfony\Component\HttpKernel\Client;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
abstract class PhraseanetWebTestCaseAbstract extends \PhraseanetPHPUnitAbstract
|
||||
{
|
||||
|
||||
|
@@ -110,7 +110,6 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
||||
|
||||
self::$createdDataboxes[] = $databox;
|
||||
|
||||
|
||||
$rights = array(
|
||||
'bas_manage' => '1'
|
||||
, 'bas_modify_struct' => '1'
|
||||
@@ -120,7 +119,6 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
|
||||
|
||||
self::$DI['app']['authentication']->getUser()->ACL()->update_rights_to_sbas($databox->get_sbas_id(), $rights);
|
||||
|
||||
|
||||
$databox->registerAdmin(self::$DI['app']['authentication']->getUser());
|
||||
|
||||
return $databox;
|
||||
|
@@ -700,4 +700,3 @@ class API_V1_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertInternalType($type, $response['response'][$field]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -132,7 +132,6 @@ class API_V1_resultTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$date_obj2 = new DateTime();
|
||||
$this->assertLessThan(3, abs($date_obj1->format('U') - $date_obj2->format('U')), 'No more than 3sec between now and the query');
|
||||
|
||||
|
||||
$this->assertArrayHasKey("http_code", $response["meta"]);
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_INT, $response["meta"]["http_code"]);
|
||||
$this->assertEquals(200, $response["meta"]["http_code"]);
|
||||
|
@@ -5,8 +5,8 @@ class media_Permalink_AdapterTest extends PhraseanetPHPUnitAbstract
|
||||
/**
|
||||
* @var media_Permalink_Adapter
|
||||
*/
|
||||
static $object;
|
||||
static $subdef;
|
||||
public static $object;
|
||||
public static $subdef;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
|
@@ -128,7 +128,6 @@ class randomTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
}
|
||||
|
||||
|
||||
$expires_on = new DateTime('-5 minutes');
|
||||
$usr_id = self::$DI['user']->get_id();
|
||||
$token = $this->random->getUrlToken(\random::TYPE_PASSWORD, $usr_id, $expires_on, 'some nice datas');
|
||||
|
@@ -397,11 +397,11 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals($multi_imploded, implode(' ' . $meta_el->get_separator() . ' ', $initial_values));
|
||||
$this->assertEquals($multi_imploded, $field->get_serialized_values());
|
||||
}
|
||||
else
|
||||
} else {
|
||||
$this->assertEquals('un second jeu de test', $field->get_serialized_values());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testRebuild_subdefs()
|
||||
{
|
||||
@@ -525,7 +525,6 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ! $found)
|
||||
$this->fail();
|
||||
}
|
||||
|
@@ -67,7 +67,6 @@ class addReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->ColFilter();
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->ret as $sbasid => $collections) {
|
||||
$this->report = new module_report_add(
|
||||
self::$DI['app'],
|
||||
@@ -104,7 +103,6 @@ class addReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
else
|
||||
$this->assertEquals($report['page'] - 1, $report['previous_page']);
|
||||
|
||||
|
||||
if (intval(ceil($nbPage)) == $report['page'] || intval(ceil($nbPage)) == 0)
|
||||
$this->assertFalse($report['next_page']);
|
||||
else
|
||||
@@ -140,8 +138,7 @@ class addReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->assertArrayHasKey($groupby, $this->report->getDisplay());
|
||||
$this->assertArrayHasKey('nombre', $this->report->getDisplay());
|
||||
}
|
||||
|
@@ -150,8 +150,7 @@ class connexionReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->assertArrayHasKey($groupby, $this->report->getDisplay());
|
||||
$this->assertArrayHasKey('nb', $this->report->getDisplay());
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@ class dashboardTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertGreaterThanOrEqual(1, count($this->dashboard->authorizedCollection));
|
||||
$this->assertEquals($this->dashboard->authorizedCollection, $this->dashboard->authorizedCollection());
|
||||
|
||||
|
||||
foreach ($this->dashboard->authorizedCollection as $coll) {
|
||||
$this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $coll);
|
||||
$this->assertArrayHasKey('sbas_id', $coll);
|
||||
@@ -66,8 +65,7 @@ class dashboardTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$this->assertLessThanOrEqual($lastvalue, $value['nb']);
|
||||
$lastvalue = $value['nb'];
|
||||
}
|
||||
}
|
||||
elseif (in_array($key, $activity)) {
|
||||
} elseif (in_array($key, $activity)) {
|
||||
if ($key == 'activity') {
|
||||
$this->assertEquals(24, count($dash));
|
||||
} else {
|
||||
|
@@ -165,8 +165,7 @@ class downloadReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
if ($groupby) {
|
||||
if ($groupby != 'record_id')
|
||||
$this->assertEquals(count($this->report->getDisplay()), 2);
|
||||
}
|
||||
else
|
||||
} else
|
||||
$this->assertEquals(count($this->report->getDisplay()), count($conf));
|
||||
|
||||
if (! $groupby) {
|
||||
@@ -191,8 +190,7 @@ class downloadReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
$this->assertArrayHasKey($groupby, $this->report->getDisplay());
|
||||
}
|
||||
|
@@ -149,8 +149,7 @@ class editTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->assertArrayHasKey($groupby, $this->report->getDisplay());
|
||||
$this->assertArrayHasKey('nombre', $this->report->getDisplay());
|
||||
}
|
||||
|
@@ -140,8 +140,7 @@ class pushReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->assertArrayHasKey($groupby, $this->report->getDisplay());
|
||||
$this->assertArrayHasKey('nombre', $this->report->getDisplay());
|
||||
}
|
||||
|
@@ -145,8 +145,7 @@ class questionReportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->assertArrayHasKey($groupby, $this->report->getDisplay());
|
||||
$this->assertArrayHasKey('nb', $this->report->getDisplay());
|
||||
}
|
||||
|
@@ -97,8 +97,6 @@ class reportTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
|
||||
public function testGetterSetter()
|
||||
{
|
||||
|
||||
|
||||
$report = new module_report(self::$DI['app'], $this->dmin, $this->dmax, 1, '');
|
||||
$bool = true;
|
||||
$report->setPrettyString($bool);
|
||||
|
@@ -496,7 +496,6 @@ class task_period_archiveTest extends \PhraseanetPHPUnitAbstract
|
||||
$sxcaption = simplexml_load_string($xml);
|
||||
$this->assertEquals('10000', self::$object->parseStatusBitTester($sxcaption));
|
||||
|
||||
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<record record_id="2">
|
||||
<status/>
|
||||
|
Reference in New Issue
Block a user