Coding standards

This commit is contained in:
Romain Neutron
2012-01-26 16:26:00 +01:00
parent 3f3701b03d
commit 34f2e91fd4
10 changed files with 68 additions and 68 deletions

View File

@@ -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);

View File

@@ -88,7 +88,7 @@ class UserProvider implements ControlProviderInterface
}
catch (\Exception $e)
{
}
return false;

View File

@@ -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)
{

View File

@@ -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();

View File

@@ -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']);
}

View File

@@ -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 */

View File

@@ -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());
//
//
// }
}

View File

@@ -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()));
}

View File

@@ -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);

View File

@@ -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';