mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge remote-tracking branch 'upstream/master' into 20150306-elastic-indexer
Conflicts: bin/console bower.json composer.json composer.lock lib/Alchemy/Phrasea/Application.php lib/Alchemy/Phrasea/Border/Manager.php lib/Alchemy/Phrasea/Controller/Api/V1.php lib/Alchemy/Phrasea/Core/PhraseaEvents.php lib/Alchemy/Phrasea/SearchEngine/SearchEngineOptions.php lib/classes/caption/field.php lib/classes/record/Interface.php templates/web/prod/index.html.twig www/skins/prod/000000/prodcolor.css
This commit is contained in:
@@ -65,8 +65,8 @@ class PluginServiceProviderTest extends ServiceProviderTestCase
|
||||
$app = self::$DI['cli'];
|
||||
$app->register(new PluginServiceProvider());
|
||||
|
||||
$this->assertFileExists($app['plugins.directory']);
|
||||
$this->assertTrue(is_dir($app['plugins.directory']));
|
||||
$this->assertFileExists($app['plugin.path']);
|
||||
$this->assertTrue(is_dir($app['plugin.path']));
|
||||
}
|
||||
|
||||
public function testInstallerUsesPhpConf()
|
||||
|
@@ -25,9 +25,7 @@ class DisplaySettingServiceTest extends \PhraseanetTestCase
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
if (null === self::$userSettings) {
|
||||
self::$DI['app']['conf']->remove('user-settings');
|
||||
} else {
|
||||
if (null !== self::$userSettings) {
|
||||
self::$DI['app']['conf']->set('user-settings', self::$userSettings);
|
||||
}
|
||||
|
||||
|
@@ -80,7 +80,7 @@ class RegistrationManagerTest extends \PhraseanetTestCase
|
||||
$rejectedRegistration->setPending(true);
|
||||
$rejectedRegistration->setRejected(true);
|
||||
|
||||
$databox = current((new \appbox(new Application()))->get_databoxes());
|
||||
$databox = current((new \appbox(new Application(Application::ENV_TEST)))->get_databoxes());
|
||||
$collection = current($databox->get_collections());
|
||||
|
||||
$noLimitedPendingRegistration = [
|
||||
|
@@ -4,11 +4,12 @@ namespace Alchemy\Tests\Phrasea\Core\Connection;
|
||||
|
||||
use Alchemy\Phrasea\Core\Connection\ConnectionProvider;
|
||||
|
||||
class ConnectionProviderTest extends \PhraseanetTestCase
|
||||
class ConnectionPoolManager extends \PhraseanetTestCase
|
||||
{
|
||||
public function testMysqlTimeoutIsHandled()
|
||||
{
|
||||
$provider = new ConnectionProvider(self::$DI['app']['EM.config'], self::$DI['app']['EM.events-manager'], $this->createLoggerMock());
|
||||
$this->markTestSkipped();
|
||||
$provider = new ConnectionProvider(self::$DI['app']['db.config'], self::$DI['app']['db.event_manager'], $this->createLoggerMock());
|
||||
$conn = $provider->get(self::$DI['app']['conf']->get(['main', 'database']));
|
||||
$conn->exec('SET @@local.wait_timeout= 1');
|
||||
usleep(1200000);
|
||||
|
@@ -83,7 +83,7 @@ class ApiCorsSubscriberTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
private function request(array $conf, $method = 'GET', array $extraHeaders = [])
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['phraseanet.configuration']['api_cors'] = $conf;
|
||||
$app['dispatcher']->addSubscriber(new ApiCorsSubscriber($app));
|
||||
$app->get('/api/v1/test-route', function () {
|
||||
|
@@ -18,7 +18,7 @@ class ApiExceptionHandlerSubscriberTest extends \PhraseanetTestCase
|
||||
*/
|
||||
public function testError($exception, $code)
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new ApiExceptionHandlerSubscriber($app));
|
||||
$app->get('/', function () use ($exception) {
|
||||
throw $exception;
|
||||
|
@@ -17,7 +17,7 @@ class ApiOauth2ErrorsSubscriberTest extends \PhraseanetTestCase
|
||||
*/
|
||||
public function testError($exception, $code, $contentType)
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new ApiOauth2ErrorsSubscriber(PhraseaExceptionHandler::register(), $this->createTranslatorMock()));
|
||||
$app->get('/api/oauthv2', function () use ($exception) {
|
||||
throw $exception;
|
||||
@@ -35,7 +35,7 @@ class ApiOauth2ErrorsSubscriberTest extends \PhraseanetTestCase
|
||||
*/
|
||||
public function testErrorOnOtherRoutes($exception, $code, $contentType)
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
unset($app['exception_handler']);
|
||||
$app['dispatcher']->addSubscriber(new ApiOauth2ErrorsSubscriber(PhraseaExceptionHandler::register(), $this->createTranslatorMock()));
|
||||
$app->get('/', function () use ($exception) {
|
||||
|
@@ -10,7 +10,7 @@ class BridgeExceptionSubscriberTest extends \PhraseanetTestCase
|
||||
{
|
||||
public function testErrorOnBridgeExceptions()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['bridge.account'] = $this->getMockBuilder('Bridge_Account')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -28,7 +28,7 @@ class BridgeExceptionSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
public function testErrorOnOtherExceptions()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['bridge.account'] = $this->getMockBuilder('Bridge_Account')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
@@ -30,7 +30,7 @@ class ContentNegotiationSubscriberTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
private function request($accept)
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new ContentNegotiationSubscriber($app));
|
||||
$app->get('/content/negociation', function () {
|
||||
return '';
|
||||
|
@@ -11,7 +11,7 @@ class FirewallSubscriberTest extends \PhraseanetTestCase
|
||||
{
|
||||
public function testRedirection()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
unset($app['exception_handler']);
|
||||
$app['dispatcher']->addSubscriber(new FirewallSubscriber());
|
||||
$app->get('/', function () {
|
||||
@@ -27,7 +27,7 @@ class FirewallSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
public function testNoHeaderNoRedirection()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
unset($app['exception_handler']);
|
||||
$app['dispatcher']->addSubscriber(new FirewallSubscriber());
|
||||
$app->get('/', function () {
|
||||
|
@@ -13,7 +13,7 @@ class JsonRequestSubscriberTest extends \PhraseanetTestCase
|
||||
*/
|
||||
public function testRoutes($route, $isJson, $exceptionExpected)
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
unset($app['exception_handler']);
|
||||
$app['dispatcher']->addSubscriber(new JsonRequestSubscriber());
|
||||
$app->get($route, function () {
|
||||
|
@@ -11,7 +11,7 @@ class LogoutSubscriberTest extends \PhraseanetTestCase
|
||||
{
|
||||
public function testThatSearchEngineCacheIsCleaned()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new LogoutSubscriber());
|
||||
|
||||
$app['phraseanet.SE'] = $this->getMock('Alchemy\Phrasea\SearchEngine\SearchEngineInterface');
|
||||
|
@@ -3,6 +3,9 @@
|
||||
namespace Alchemy\Tests\Phrasea\Core\Event\Subscriber;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Configuration\Configuration;
|
||||
use Alchemy\Phrasea\Core\Configuration\HostConfiguration;
|
||||
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||
use Alchemy\Phrasea\Core\Event\Subscriber\MaintenanceSubscriber;
|
||||
use Symfony\Component\HttpKernel\Client;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
@@ -19,7 +22,7 @@ class MaintenanceSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
public function testCheckNegative()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
unset($app['exception_handler']);
|
||||
$app['dispatcher']->addSubscriber(new MaintenanceSubscriber($app));
|
||||
$app->get('/', function () {
|
||||
@@ -35,7 +38,7 @@ class MaintenanceSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
public function testCheckPositive()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
|
||||
$app['phraseanet.configuration.config-path'] = __DIR__ . '/Fixtures/configuration-maintenance.yml';
|
||||
$app['phraseanet.configuration.config-compiled-path'] = __DIR__ . '/Fixtures/configuration-maintenance.php';
|
||||
@@ -44,6 +47,16 @@ class MaintenanceSubscriberTest extends \PhraseanetTestCase
|
||||
unlink($app['phraseanet.configuration.config-compiled-path']);
|
||||
}
|
||||
|
||||
$app['configuration.store'] = new HostConfiguration(new Configuration(
|
||||
$app['phraseanet.configuration.yaml-parser'],
|
||||
$app['phraseanet.configuration.compiler'],
|
||||
$app['phraseanet.configuration.config-path'],
|
||||
$app['phraseanet.configuration.config-compiled-path'],
|
||||
$app['debug']
|
||||
));
|
||||
|
||||
$app['conf'] = new PropertyAccess($app['configuration.store']);
|
||||
|
||||
unset($app['exception_handler']);
|
||||
$app['dispatcher']->addSubscriber(new MaintenanceSubscriber($app));
|
||||
$app->get('/', function () {
|
||||
|
@@ -12,7 +12,7 @@ class PhraseaExceptionHandlerSubscriberTest extends \PhraseanetTestCase
|
||||
{
|
||||
public function testAResponseIsReturned()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['exception_handler'] = new PhraseaExceptionHandlerSubscriber(PhraseaExceptionHandler::register());
|
||||
$app->get('/', function () {
|
||||
throw new \Exception();
|
||||
@@ -26,7 +26,7 @@ class PhraseaExceptionHandlerSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
public function testANotFoundResponseIsReturned()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['exception_handler'] = new PhraseaExceptionHandlerSubscriber(PhraseaExceptionHandler::register());
|
||||
$app->get('/', function () {
|
||||
throw new NotFoundHttpException();
|
||||
@@ -40,7 +40,7 @@ class PhraseaExceptionHandlerSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
public function testItCanBeDisabled()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['exception_handler'] = new PhraseaExceptionHandlerSubscriber(PhraseaExceptionHandler::register());
|
||||
$app->get('/', function () {
|
||||
throw new \Exception();
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Alchemy\Tests\Phrasea\Core\Event\Subscriber;
|
||||
|
||||
use Silex\Application;
|
||||
use Silex\Application as SilexApp;
|
||||
use Alchemy\Phrasea\Core\Event\Subscriber\PhraseaLocaleSubscriber;
|
||||
use Alchemy\Phrasea\Core\Provider\LocaleServiceProvider;
|
||||
use Symfony\Component\HttpKernel\Client;
|
||||
@@ -104,7 +104,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
private function getAppThatReturnLocale()
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new SilexApp();
|
||||
$app['debug'] = true;
|
||||
$app->register(new LocaleServiceProvider());
|
||||
$app['configuration.store'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
|
||||
@@ -117,14 +117,14 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetTestCase
|
||||
|
||||
$app['dispatcher']->addSubscriber(new PhraseaLocaleSubscriber($app));
|
||||
|
||||
$app->get('/', function (Application $app, Request $request) {
|
||||
$app->get('/', function (SilexApp $app, Request $request) {
|
||||
return $app['locale'] ? $app['locale'] : '';
|
||||
});
|
||||
|
||||
return $app;
|
||||
}
|
||||
|
||||
private function mockRegistryAndReturnLocale(Application $app, $locale)
|
||||
private function mockRegistryAndReturnLocale(SilexApp $app, $locale)
|
||||
{
|
||||
$app['conf']->expects($this->any())
|
||||
->method('get')
|
||||
@@ -141,7 +141,7 @@ class PhraseaLocaleSubscriberTest extends \PhraseanetTestCase
|
||||
}));
|
||||
}
|
||||
|
||||
private function getClientWithCookie(Application $app, $locale = 'fr')
|
||||
private function getClientWithCookie(SilexApp $app, $locale = 'fr')
|
||||
{
|
||||
$cookieJar = new CookieJar();
|
||||
if ($locale) {
|
||||
|
@@ -11,7 +11,7 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
{
|
||||
public function testEndSession()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||
$app['phraseanet.configuration']['session'] = [
|
||||
'idle' => 0,
|
||||
@@ -37,7 +37,7 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
public function testEndSessionXmlXhttpRequest()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||
$app['phraseanet.configuration']['session'] = [
|
||||
'idle' => 0,
|
||||
@@ -65,7 +65,7 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
public function testEndSessionAuthenticated()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||
$app['authentication'] = $this->getMockBuilder('Alchemy\Phrasea\Authentication\Authenticator')->disableOriginalConstructor()->getMock();
|
||||
$app['authentication']->expects($this->any())->method('isAuthenticated')->will($this->returnValue(true));
|
||||
@@ -73,11 +73,11 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
$session = new Session();
|
||||
$session->setUpdated(new \DateTime());
|
||||
|
||||
$app['EM'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['orm.em'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['repo.sessions'] = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectRepository')->getMock();
|
||||
$app['repo.sessions']->expects($this->exactly(2))->method('find')->will($this->returnValue($session));
|
||||
$app['EM']->expects($this->exactly(4))->method('persist')->will($this->returnValue(null));
|
||||
$app['EM']->expects($this->exactly(2))->method('flush')->will($this->returnValue(null));
|
||||
$app['orm.em']->expects($this->exactly(4))->method('persist')->will($this->returnValue(null));
|
||||
$app['orm.em']->expects($this->exactly(2))->method('flush')->will($this->returnValue(null));
|
||||
|
||||
$app['phraseanet.configuration']['session'] = [
|
||||
'idle' => 0,
|
||||
@@ -99,7 +99,7 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
public function testEndSessionAuthenticatedWithOutdatedIdle()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||
$app['authentication'] = $this->getMockBuilder('Alchemy\Phrasea\Authentication\Authenticator')->disableOriginalConstructor()->getMock();
|
||||
$app['authentication']->expects($this->any())->method('isAuthenticated')->will($this->returnValue(true));
|
||||
@@ -108,11 +108,11 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
$session = new Session();
|
||||
$session->setUpdated(new \DateTime('-1 hour'));
|
||||
|
||||
$app['EM'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['orm.em'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['repo.sessions'] = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectRepository')->getMock();
|
||||
$app['repo.sessions']->expects($this->once())->method('find')->will($this->returnValue($session));
|
||||
$app['EM']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
||||
$app['EM']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
||||
$app['orm.em']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
||||
$app['orm.em']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
||||
|
||||
$app['phraseanet.configuration']['session'] = [
|
||||
'idle' => 10,
|
||||
@@ -137,7 +137,7 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
public function testEndSessionAuthenticatedWithOutdatedIdleXmlHttpRequest()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||
$app['authentication'] = $this->getMockBuilder('Alchemy\Phrasea\Authentication\Authenticator')->disableOriginalConstructor()->getMock();
|
||||
$app['authentication']->expects($this->any())->method('isAuthenticated')->will($this->returnValue(true));
|
||||
@@ -146,11 +146,11 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
$session = new Session();
|
||||
$session->setUpdated(new \DateTime('-1 hour'));
|
||||
|
||||
$app['EM'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['orm.em'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['repo.sessions'] = $this->getMockBuilder('Doctrine\Common\Persistence\ObjectRepository')->getMock();
|
||||
$app['repo.sessions']->expects($this->once())->method('find')->will($this->returnValue($session));
|
||||
$app['EM']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
||||
$app['EM']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
||||
$app['orm.em']->expects($this->any())->method('persist')->will($this->returnValue(null));
|
||||
$app['orm.em']->expects($this->any())->method('flush')->will($this->returnValue(null));
|
||||
|
||||
$app['phraseanet.configuration']['session'] = [
|
||||
'idle' => 10,
|
||||
@@ -176,7 +176,7 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
|
||||
public function testUndefinedModule()
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||
|
||||
$app->get('/login', function () {
|
||||
@@ -199,13 +199,13 @@ class SessionManagerSubscriberTest extends \PhraseanetAuthenticatedWebTestCase
|
||||
*/
|
||||
public function testForbiddenRoutes($route)
|
||||
{
|
||||
$app = new Application('test');
|
||||
$app = new Application(Application::ENV_TEST);
|
||||
$app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
|
||||
$app['authentication'] = $this->getMockBuilder('Alchemy\Phrasea\Authentication\Authenticator')->disableOriginalConstructor()->getMock();
|
||||
$app['authentication']->expects($this->never())->method('isAuthenticated');
|
||||
|
||||
$app['EM'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['EM']->expects($this->never())->method('flush');
|
||||
$app['orm.em'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
|
||||
$app['orm.em']->expects($this->never())->method('flush');
|
||||
|
||||
$app->get('/login', function () {
|
||||
return '';
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace Alchemy\Tests\Phrasea\Core\Event\Subscriber;
|
||||
|
||||
use Alchemy\Phrasea\Core\Event\Subscriber\TrustedProxySubscriber;
|
||||
use Silex\Application;
|
||||
use Silex\Application as SilexApp;
|
||||
use Symfony\Component\HttpKernel\Client;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
@@ -32,7 +32,7 @@ class TrustedProxySubscriberTest extends \PhraseanetTestCase
|
||||
->with('trusted-proxies')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$app = new Application();
|
||||
$app = new SilexApp();
|
||||
$app['dispatcher']->addSubscriber(new TrustedProxySubscriber($configuration));
|
||||
$app->get('/', function () {
|
||||
return 'data';
|
||||
@@ -56,7 +56,7 @@ class TrustedProxySubscriberTest extends \PhraseanetTestCase
|
||||
->with('trusted-proxies')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$app = new Application();
|
||||
$app = new SilexApp();
|
||||
$app['dispatcher']->addSubscriber(new TrustedProxySubscriber($configuration));
|
||||
$app->get('/', function () {
|
||||
return 'data';
|
||||
|
@@ -39,7 +39,7 @@ class BasketMiddlewareProviderTest extends MiddlewareProviderTestCase
|
||||
$this->authenticate(self::$DI['app']);
|
||||
self::$DI['app']->register(new BasketMiddlewareProvider());
|
||||
$request = new Request();
|
||||
$basket = self::$DI['app']['EM']->find('Phraseanet:Basket', 1);
|
||||
$basket = self::$DI['app']['orm.em']->find('Phraseanet:Basket', 1);
|
||||
$request->attributes->set('basket', $basket->getId());
|
||||
call_user_func(self::$DI['app']['middleware.basket.converter'], $request, self::$DI['app']);
|
||||
$this->assertSame($basket, $request->attributes->get('basket'));
|
||||
@@ -59,7 +59,7 @@ class BasketMiddlewareProviderTest extends MiddlewareProviderTestCase
|
||||
$this->authenticate(self::$DI['app']);
|
||||
self::$DI['app']->register(new BasketMiddlewareProvider());
|
||||
$request = new Request();
|
||||
$basket = self::$DI['app']['EM']->find('Phraseanet:Basket', 1);
|
||||
$basket = self::$DI['app']['orm.em']->find('Phraseanet:Basket', 1);
|
||||
$request->attributes->set('basket', $basket);
|
||||
call_user_func(self::$DI['app']['middleware.basket.user-access'], $request, self::$DI['app']);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class BasketMiddlewareProviderTest extends MiddlewareProviderTestCase
|
||||
$this->authenticate(self::$DI['app']);
|
||||
self::$DI['app']->register(new BasketMiddlewareProvider());
|
||||
$request = new Request();
|
||||
$basket = self::$DI['app']['EM']->find('Phraseanet:Basket', 3);
|
||||
$basket = self::$DI['app']['orm.em']->find('Phraseanet:Basket', 3);
|
||||
$request->attributes->set('basket', $basket);
|
||||
$this->setExpectedException('Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException', 'Current user does not have access to the basket');
|
||||
call_user_func(self::$DI['app']['middleware.basket.user-access'], $request, self::$DI['app']);
|
||||
|
@@ -83,7 +83,7 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
|
||||
|
||||
$app['conf']->set(['authentication', 'captcha', 'trials-before-display'], 42);
|
||||
|
||||
$app['EM'] = $this->createEntityManagerMock();
|
||||
$app['orm.em'] = $this->createEntityManagerMock();
|
||||
self::$DI['app']['recaptcha'] = $this->getMockBuilder('Neutron\ReCaptcha\ReCaptcha')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@@ -110,7 +110,7 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
|
||||
|
||||
$app['conf']->set(['authentication', 'captcha'], ['enabled' => true]);
|
||||
|
||||
$app['EM'] = $this->createEntityManagerMock();
|
||||
$app['orm.em'] = $this->createEntityManagerMock();
|
||||
$app['repo.users'] = $this->createEntityRepositoryMock();
|
||||
$app['repo.auth-failures'] = $this->createEntityRepositoryMock();
|
||||
$app['recaptcha'] = $this->getMockBuilder('Neutron\ReCaptcha\ReCaptcha')
|
||||
@@ -130,7 +130,7 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
|
||||
|
||||
$app['conf']->set(['authentication', 'captcha'], ['enabled' => false]);
|
||||
|
||||
$app['EM'] = $this->createEntityManagerMock();
|
||||
$app['orm.em'] = $this->createEntityManagerMock();
|
||||
$app['repo.users'] = $this->createEntityRepositoryMock();
|
||||
$app['recaptcha'] = $this->getMockBuilder('Neutron\ReCaptcha\ReCaptcha')
|
||||
->disableOriginalConstructor()
|
||||
|
@@ -10,11 +10,11 @@ class ORMServiceProviderTest extends ServiceProviderTestCase
|
||||
public function provideServiceDescription()
|
||||
{
|
||||
return [
|
||||
['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM', 'Doctrine\\ORM\\EntityManager'],
|
||||
['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM.sql-logger', 'Alchemy\\Phrasea\\Model\\MonologSQLLogger'],
|
||||
['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM.driver', 'Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriverChain'],
|
||||
['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM.config', 'Doctrine\\ORM\\Configuration'],
|
||||
['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM.events-manager', 'Doctrine\\Common\\EventManager'],
|
||||
//['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM', 'Doctrine\\ORM\\EntityManager'],
|
||||
//['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'orm.sql-logger', 'Alchemy\\Phrasea\\Model\\MonologSQLLogger'],
|
||||
//['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM.driver', 'Doctrine\\Common\\Persistence\\Mapping\\Driver\\MappingDriverChain'],
|
||||
//['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'EM.config', 'Doctrine\\ORM\\Configuration'],
|
||||
['Alchemy\Phrasea\Core\Provider\ORMServiceProvider', 'db.event_manager', 'Doctrine\\Common\\EventManager'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ namespace Alchemy\Tests\Phrasea\Core\Provider;
|
||||
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||
use Alchemy\Phrasea\Core\Provider\SessionHandlerServiceProvider;
|
||||
use Alchemy\Tests\Phrasea\MockArrayConf;
|
||||
use Silex\Application;
|
||||
use Silex\Application as SilexApp;
|
||||
use Silex\Provider\SessionServiceProvider;
|
||||
|
||||
class SessionHandlerServiceProviderTest extends \PhraseanetTestCase
|
||||
@@ -15,7 +15,7 @@ class SessionHandlerServiceProviderTest extends \PhraseanetTestCase
|
||||
*/
|
||||
public function testWithVariousConf($sessionConf, $expectedInstance, $method = null, $options = null, $mock = null)
|
||||
{
|
||||
$app = new Application();
|
||||
$app = new SilexApp();
|
||||
$app['root.path'] = __DIR__ . '/../../../../../..';
|
||||
$app->register(new SessionServiceProvider());
|
||||
$app->register(new SessionHandlerServiceProvider());
|
||||
|
Reference in New Issue
Block a user