mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 03:53:13 +00:00
Coding standards
This commit is contained in:
@@ -138,7 +138,7 @@ class WorkZone implements ControllerProviderInterface
|
||||
$StoryWZRepo = $em->getRepository('\Entities\StoryWZ');
|
||||
|
||||
$alreadyFixed = $done = 0;
|
||||
|
||||
|
||||
foreach (explode(';', $request->get('stories')) as $element)
|
||||
{
|
||||
$element = explode('_', $element);
|
||||
|
@@ -88,7 +88,7 @@ class UserProvider implements ControlProviderInterface
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@@ -50,7 +50,7 @@ class UsrListOwnerRepository extends EntityRepository
|
||||
$dql = 'SELECT o FROM Entities\UsrListOwner o
|
||||
JOIN o.list l
|
||||
WHERE l.id = :list_id AND o.usr_id = :usr_id';
|
||||
|
||||
|
||||
$params = array(
|
||||
'usr_id' => $usr_id,
|
||||
'list_id' => $list->getId()
|
||||
@@ -60,7 +60,7 @@ class UsrListOwnerRepository extends EntityRepository
|
||||
$query->setParameters($params);
|
||||
|
||||
$owner = $query->getSingleResult();
|
||||
|
||||
|
||||
/* @var $owner \Entities\UsrListOwner */
|
||||
if (null === $owner)
|
||||
{
|
||||
|
@@ -24,7 +24,7 @@ class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testRouteSlash()
|
||||
{
|
||||
|
||||
|
||||
$this->client->request('GET', '/MustacheLoader/');
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -32,7 +32,7 @@ class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals(400, $response->getStatusCode());
|
||||
$this->assertFalse($response->isOk());
|
||||
|
||||
|
||||
$this->client->request('GET', '/MustacheLoader/', array('template' => '/../../../../config/config.yml'));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -40,7 +40,7 @@ class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals(400, $response->getStatusCode());
|
||||
$this->assertFalse($response->isOk());
|
||||
|
||||
|
||||
$this->client->request('GET', '/MustacheLoader/', array('template' => 'patator_lala'));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -48,7 +48,7 @@ class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals(404, $response->getStatusCode());
|
||||
$this->assertFalse($response->isOk());
|
||||
|
||||
|
||||
$this->client->request('GET', '/MustacheLoader/', array('template' => 'Push-Badge'));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
|
@@ -278,7 +278,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals(400, $response->getStatusCode());
|
||||
$this->assertEquals('UTF-8', $response->getCharset());
|
||||
|
||||
|
||||
|
||||
$route = '/lists/list/' . $list->getId() . '/share/' . self::$user_alt1->get_id() . '/';
|
||||
|
||||
@@ -314,13 +314,13 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
$this->assertEquals(2, $list->getOwners()->count());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function testPostUnShareList()
|
||||
{
|
||||
|
||||
|
||||
$list = $this->insertOneUsrList(self::$user);
|
||||
|
||||
$this->assertEquals(1, $list->getOwners()->count());
|
||||
@@ -347,9 +347,9 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$list = $repository->find($list->getId());
|
||||
|
||||
$this->assertEquals(2, $list->getOwners()->count());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$route = '/lists/list/' . $list->getId() . '/unshare/' . self::$user_alt1->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route);
|
||||
@@ -360,23 +360,23 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertEquals('UTF-8', $response->getCharset());
|
||||
|
||||
$datas = (array) json_decode($response->getContent());
|
||||
|
||||
|
||||
$this->assertTrue($datas['success']);
|
||||
|
||||
$repository = self::$core->getEntityManager()->getRepository('Entities\UsrList');
|
||||
|
||||
$list = $repository->find($list->getId());
|
||||
|
||||
|
||||
self::$core->getEntityManager()->refresh($list);
|
||||
|
||||
$this->assertEquals(1, $list->getOwners()->count());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testPostUnShareFail()
|
||||
{
|
||||
|
||||
|
||||
$list = $this->insertOneUsrList(self::$user);
|
||||
|
||||
$this->assertEquals(1, $list->getOwners()->count());
|
||||
@@ -397,9 +397,9 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertArrayHasKey('message', $datas);
|
||||
|
||||
$this->assertTrue($datas['success']);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$route = '/lists/list/' . $list->getId() . '/share/' . self::$user->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route, array('role' => \Entities\UsrListOwner::ROLE_USER));
|
||||
@@ -416,18 +416,18 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertArrayHasKey('message', $datas);
|
||||
|
||||
$this->assertTrue($datas['success']);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$repository = self::$core->getEntityManager()->getRepository('Entities\UsrList');
|
||||
|
||||
$list = $repository->find($list->getId());
|
||||
|
||||
$this->assertEquals(2, $list->getOwners()->count());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$route = '/lists/list/' . $list->getId() . '/unshare/' . self::$user_alt1->get_id() . '/';
|
||||
|
||||
$this->client->request('POST', $route);
|
||||
@@ -438,7 +438,7 @@ class ControllerUsrListsTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertEquals('UTF-8', $response->getCharset());
|
||||
|
||||
$datas = (array) json_decode($response->getContent());
|
||||
|
||||
|
||||
$this->assertFalse($datas['success']);
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,7 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$story = self::$story_1;
|
||||
/* @var $story \Record_Adapter */
|
||||
$route = sprintf("/WorkZone/attachStories/");
|
||||
|
||||
|
||||
$this->client->request('POST', $route);
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
@@ -71,7 +71,7 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertEquals(302, $response->getStatusCode());
|
||||
|
||||
|
||||
$em = self::$core->getEntityManager();
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$query = $em->createQuery(
|
||||
@@ -81,17 +81,17 @@ class ControllerWorkZoneTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$count = $query->getSingleScalarResult();
|
||||
|
||||
$this->assertEquals(1, $count);
|
||||
|
||||
|
||||
$story2 = self::$story_2;
|
||||
|
||||
|
||||
$stories = implode(';', array($story->get_serialize_key(), $story2->get_serialize_key()));
|
||||
|
||||
$this->client->request('POST', $route, array('stories' => $stories));
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertEquals(302, $response->getStatusCode());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$em = self::$core->getEntityManager();
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
|
@@ -162,7 +162,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
public function testWrite()
|
||||
{
|
||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||
|
||||
|
||||
$stub = $this->getMock(
|
||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||
, array('getConfigurationPathName')
|
||||
@@ -284,7 +284,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
public function testWriteException()
|
||||
{
|
||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||
|
||||
|
||||
$stub = $this->getMock(
|
||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||
, array('getConfigurationPathName')
|
||||
@@ -318,7 +318,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
catch (\exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
chmod($file->getPathname(), 0666);
|
||||
}
|
||||
@@ -326,7 +326,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
public function testDelete()
|
||||
{
|
||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||
|
||||
|
||||
$stub = $this->getMock(
|
||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||
, array('getConfigurationPathName')
|
||||
@@ -343,17 +343,17 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
||||
|
||||
$configuration = new PhraseaCore\Configuration($handler);
|
||||
|
||||
|
||||
$configuration->delete();
|
||||
|
||||
|
||||
$this->assertFileNotExists($file->getPathname());
|
||||
|
||||
|
||||
}
|
||||
|
||||
// public function testDeleteException()
|
||||
// {
|
||||
// touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||
//
|
||||
//
|
||||
// $stub = $this->getMock(
|
||||
// '\Alchemy\Phrasea\Core\Configuration\Application'
|
||||
// , array('getConfigurationPathName')
|
||||
@@ -380,9 +380,9 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
// {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// $this->assertFileExists($file->getPathname());
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
@@ -25,11 +25,11 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
public function testGetType()
|
||||
{
|
||||
$type = $this->object->getType();
|
||||
|
||||
|
||||
$this->assertTrue(is_scalar($type));
|
||||
|
||||
|
||||
$classname = array_pop(explode('\\', get_class($this->object)));
|
||||
|
||||
|
||||
$this->assertEquals($classname, $type . 'Provider');
|
||||
}
|
||||
|
||||
@@ -41,21 +41,21 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
public function testFind()
|
||||
{
|
||||
$results = $this->object->find('BABE', self::$user, self::$collection->get_databox());
|
||||
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
|
||||
|
||||
$results = $this->object->find(self::$user->get_email(), self::$user, self::$collection->get_databox());
|
||||
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
$this->assertTrue($results->count() > 0);
|
||||
|
||||
|
||||
$results = $this->object->find(self::$user->get_firstname(), self::$user, self::$collection->get_databox());
|
||||
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
$this->assertTrue($results->count() > 0);
|
||||
|
||||
|
||||
$results = $this->object->find(self::$user->get_lastname(), self::$user, self::$collection->get_databox());
|
||||
|
||||
|
||||
$this->assertInstanceOf('\\Doctrine\\Common\\Collections\\ArrayCollection', $results);
|
||||
$this->assertTrue($results->count() > 0);
|
||||
}
|
||||
@@ -76,9 +76,9 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
$this->object->getValue('A');
|
||||
@@ -86,9 +86,9 @@ class UserProviderTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$this->assertEquals(self::$user->get_display_name(), $this->object->getValue(self::$user->get_id()));
|
||||
}
|
||||
|
||||
|
@@ -12,7 +12,7 @@ class ControllerTest extends \PhraseanetPHPUnitAbstract
|
||||
public function testGet()
|
||||
{
|
||||
$provider = \Alchemy\Phrasea\Vocabulary\Controller::get('User');
|
||||
|
||||
|
||||
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\UserProvider', $provider);
|
||||
|
||||
try
|
||||
@@ -22,16 +22,16 @@ class ControllerTest extends \PhraseanetPHPUnitAbstract
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetAvailable()
|
||||
{
|
||||
$available = \Alchemy\Phrasea\Vocabulary\Controller::getAvailable();
|
||||
|
||||
|
||||
$this->assertTrue(is_array($available));
|
||||
|
||||
|
||||
foreach($available as $controller)
|
||||
{
|
||||
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Vocabulary\\ControlProvider\\ControlProviderInterface', $controller);
|
||||
|
@@ -26,7 +26,7 @@ class TermTest extends \PhraseanetPHPUnitAbstract
|
||||
*/
|
||||
protected $objectWithControl;
|
||||
protected $value2 = 'Supa valu&é"\'(§è!)';
|
||||
protected $context2 = 'context
|
||||
protected $context2 = 'context
|
||||
oualibi';
|
||||
protected $basicValue = 'Joli chien';
|
||||
protected $value = 'One value';
|
||||
|
Reference in New Issue
Block a user