Some PHPCS fixes.

This commit is contained in:
Benoît Burnichon
2015-03-19 11:59:30 +01:00
parent 775552f613
commit 03b573f19c
4 changed files with 30 additions and 17 deletions

View File

@@ -24,6 +24,7 @@ use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Feed\Aggregate; use Alchemy\Phrasea\Feed\Aggregate;
use Alchemy\Phrasea\Feed\FeedInterface; use Alchemy\Phrasea\Feed\FeedInterface;
use Alchemy\Phrasea\Model\Entities\ApiOauthToken;
use Alchemy\Phrasea\Model\Entities\Basket; use Alchemy\Phrasea\Model\Entities\Basket;
use Alchemy\Phrasea\Model\Entities\BasketElement; use Alchemy\Phrasea\Model\Entities\BasketElement;
use Alchemy\Phrasea\Model\Entities\Feed; use Alchemy\Phrasea\Model\Entities\Feed;
@@ -73,6 +74,7 @@ class V1 implements ControllerProviderInterface
; ;
$controllers->after(function (Request $request, Response $response) use ($app) { $controllers->after(function (Request $request, Response $response) use ($app) {
/** @var ApiOauthToken $token */
$token = $app['session']->get('token'); $token = $app['session']->get('token');
$app['manipulator.api-log']->create($token->getAccount(), $request, $response); $app['manipulator.api-log']->create($token->getAccount(), $request, $response);
$app['manipulator.api-oauth-token']->setLastUsed($token, new \DateTime()); $app['manipulator.api-oauth-token']->setLastUsed($token, new \DateTime());
@@ -551,7 +553,11 @@ class V1 implements ControllerProviderInterface
*/ */
public function get_phraseanet_monitor(Application $app, Request $request) public function get_phraseanet_monitor(Application $app, Request $request)
{ {
$ret = array_merge($this->get_config_info($app), $this->get_cache_info($app), $this->get_gv_info($app)); $ret = array_merge(
$this->get_config_info($app),
$this->get_cache_info($app),
$this->get_gv_info($app)
);
return Result::create($request, $ret)->createResponse(); return Result::create($request, $ret)->createResponse();
} }

View File

@@ -8,14 +8,10 @@ use Alchemy\Phrasea\Border\Manager;
use DataURI; use DataURI;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Client;
class UploadTest extends \PhraseanetAuthenticatedWebTestCase class UploadTest extends \PhraseanetAuthenticatedWebTestCase
{ {
/**
*
* @return Client A Client instance
*/
protected $client;
protected $tmpFile; protected $tmpFile;
public function setUp() public function setUp()
@@ -39,8 +35,11 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase
*/ */
public function testFlashUploadForm() public function testFlashUploadForm()
{ {
self::$DI['client']->request('GET', '/prod/upload/flash-version/'); /** @var Client $client */
$response = self::$DI['client']->getResponse(); $client = self::$DI['client'];
$client->request('GET', '/prod/upload/flash-version/');
$response = $client->getResponse();
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }
@@ -50,8 +49,10 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase
*/ */
public function testUploadForm() public function testUploadForm()
{ {
self::$DI['client']->request('GET', '/prod/upload/'); /** @var Client $client */
$response = self::$DI['client']->getResponse(); $client = self::$DI['client'];
$client->request('GET', '/prod/upload/');
$response = $client->getResponse();
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
} }
@@ -79,9 +80,12 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase
) )
] ]
]; ];
self::$DI['client']->request('POST', '/prod/upload/', $params, $files, ['HTTP_Accept' => 'application/json']); /** @var Client $client */
$client = self::$DI['client'];
$response = self::$DI['client']->getResponse(); $client->request('POST', '/prod/upload/', $params, $files, ['HTTP_Accept' => 'application/json']);
$response = $client->getResponse();
$this->checkJsonResponse($response); $this->checkJsonResponse($response);
@@ -89,7 +93,9 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase
$this->assertTrue($datas['success']); $this->assertTrue($datas['success']);
if ($datas['element'] == 'record') { $this->assertArrayHasKey('element', $datas);
// Below is useless test as currently a lazaret intance is returned
if ('record' == $datas['element']) {
$id = explode('_', $datas['id']); $id = explode('_', $datas['id']);
$record = new \record_adapter(self::$DI['app'], $id[0], $id[1]); $record = new \record_adapter(self::$DI['app'], $id[0], $id[1]);
@@ -121,9 +127,11 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase
) )
] ]
]; ];
self::$DI['client']->request('POST', '/prod/upload/', $params, $files, ['HTTP_Accept' => 'application/json']); /** @var Client $client */
$client = self::$DI['client'];
$client->request('POST', '/prod/upload/', $params, $files, ['HTTP_Accept' => 'application/json']);
$response = self::$DI['client']->getResponse(); $response = $client->getResponse();
$this->checkJsonResponse($response); $this->checkJsonResponse($response);

View File

@@ -6,7 +6,6 @@ use Alchemy\Phrasea\Core\Version;
class VersionTest extends \PHPUnit_Framework_TestCase class VersionTest extends \PHPUnit_Framework_TestCase
{ {
public function testGetNumber() public function testGetNumber()
{ {
$version = new Version(); $version = new Version();

View File

@@ -27,7 +27,7 @@ if ! ./bin/developer system:uninstall > /dev/null 2>&1
then then
rm -f config/configuration.yml config/configuration-compiled.php rm -f config/configuration.yml config/configuration-compiled.php
fi fi
./bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=fr --db-password=toor --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y $VERBOSITY ./bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=en --db-password=toor --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y $VERBOSITY
case "$INSTALL_MODE" in case "$INSTALL_MODE" in
update) update)
./bin/developer ini:reset --email=test@phraseanet.com --password=test --run-patches --no-setup-dbs $VERBOSITY ./bin/developer ini:reset --email=test@phraseanet.com --password=test --run-patches --no-setup-dbs $VERBOSITY