From c68ad4fd8f23483bc5bf3dd57b1f1e7e28177fc4 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Thu, 23 May 2019 17:27:56 +0200 Subject: [PATCH 1/4] PHRAS-2605_fix-unittest-bootstrap_4.1 fix default lng add missing cmd --- tests/bootstrap.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/bootstrap.sh b/tests/bootstrap.sh index d4bcfc5476..658fec4bab 100755 --- a/tests/bootstrap.sh +++ b/tests/bootstrap.sh @@ -34,7 +34,7 @@ then mv config/configuration.yml{,.backup} rm -f config/configuration-compiled.php fi -./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 +./bin/setup system:install --email=test@phraseanet.com --password=test --db-user=root --db-template=en-simple --db-password=toor --databox=db_test --appbox=ab_test --server-name=http://127.0.0.1 -y $VERBOSITY case "$INSTALL_MODE" in update) ./bin/developer ini:reset --email=test@phraseanet.com --password=test --run-patches --no-setup-dbs $VERBOSITY @@ -44,5 +44,6 @@ case "$INSTALL_MODE" in ;; esac ./bin/developer ini:setup-tests-dbs $VERBOSITY -./bin/console searchengine:index:create $VERBOSITY +./bin/console searchengine:index -ndcp --force $VERBOSITY ./bin/developer phraseanet:regenerate-sqlite $VERBOSITY +./bin/developer phraseanet:generate-js-fixtures $VERBOSITY \ No newline at end of file From dca1387a17710428609d0eea890b0dfa48c46a8a Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Tue, 28 May 2019 14:58:35 +0200 Subject: [PATCH 2/4] PHRAS-2605_fix-unittest-bootstrap_4.1 fix conf --- lib/Alchemy/Phrasea/Application.php | 2 ++ .../Controller/Prod/LazaretController.php | 2 +- .../Core/Provider/LocaleServiceProvider.php | 3 +- lib/Alchemy/Phrasea/TaskManager/Notifier.php | 2 +- .../Alchemy/Tests/Phrasea/ApplicationTest.php | 1 + .../Phrasea/Controller/Prod/UploadTest.php | 1 + .../Fixtures/configuration-setup.yml | 33 ++++++++++++++++++ .../Configuration/Fixtures/configuration.yml | 33 ++++++++++++++++++ tests/classes/PhraseanetTestCase.php | 3 ++ tests/files/cestlafete.jpg | Bin 31487 -> 31664 bytes 10 files changed, 77 insertions(+), 3 deletions(-) diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index f586a4f93a..1e4fcb1764 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -256,6 +256,7 @@ class Application extends SilexApplication $this->register(new OrderServiceProvider()); $this->register(new WebhookServiceProvider()); + $this['monolog'] = $this->share( $this->extend('monolog', function (LoggerInterface $logger, Application $app) { @@ -273,6 +274,7 @@ class Application extends SilexApplication }) ); + $this['phraseanet.exception_handler'] = $this->share(function ($app) { /** @var PhraseaExceptionHandler $handler */ $handler = PhraseaExceptionHandler::register($app['debug']); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php b/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php index 035476d5fb..afb91cb23e 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/LazaretController.php @@ -38,7 +38,7 @@ class LazaretController extends Controller * * @param Request $request The current request * - * @return Response + * @return String */ public function listElement(Request $request) { diff --git a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php index fa816c9ef7..9a887155b7 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php @@ -43,7 +43,8 @@ class LocaleServiceProvider implements ServiceProviderInterface if (0 === count($enabledLanguages)) { $app['monolog']->error('Wrong language configuration, no language activated'); - + $app['monolog']->error(var_export(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true)); + // throw new \Exception('Wrong language configuration, no language activated'); return $availableLanguages; } diff --git a/lib/Alchemy/Phrasea/TaskManager/Notifier.php b/lib/Alchemy/Phrasea/TaskManager/Notifier.php index d85b9f5f59..101fb79753 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Notifier.php +++ b/lib/Alchemy/Phrasea/TaskManager/Notifier.php @@ -25,7 +25,7 @@ class Notifier implements NotifierInterface private $logger; /** @var integer */ - private $timeout = 1; + private $timeout = 10; public function __construct(\ZMQSocket $socket, LoggerInterface $logger) { diff --git a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php index 2046670917..0c45d2c2c4 100644 --- a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php +++ b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php @@ -152,6 +152,7 @@ class ApplicationTest extends \PhraseanetTestCase $sessionId = null; $app->post('/prod/upload/', function (Application $app) use (&$sessionId) { $sessionId = $app['session']->getId(); + return ""; }); $client = new Client($app); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php index 65832cf4dc..7245f53776 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php @@ -106,6 +106,7 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase $record = new \record_adapter(self::$DI['app'], $id[0], $id[1]); $this->assertTrue($record->get_thumbnail()->is_physically_present()); + $zzz = $record->get_caption()->get_fields(); $fields = $record->get_caption()->get_fields(['FileName']); $field = array_pop($fields); $this->assertEquals('KIKOO.JPG', $field->get_serialized_values()); diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml index 27eb933247..33bd2ddb84 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml @@ -6,6 +6,7 @@ main: maintenance: false key: '' api_require_ssl: true + delete-account-require-email-confirmation: true database: host: 'sql-host' port: 3306 @@ -212,3 +213,35 @@ embed_bundle: document: player: flexpaper enable-pdfjs: true +geocoding-providers: + - + name: 'mapBox' + enabled: true + public-key: '' + default-position: + - 2.335062 + - 48.879162 + default-zoom: 2 + marker-default-zoom: 11 + position-fields: + - + name: GpsCompositePosition + type: latlng + # - + # name: Longitude + # type: lng + # - + # name: Latitude + # type: lat +video-editor: + vttFieldName: VideoTextTrackChapters + seekBackwardStep: 1000 # in ms + seekForwardStep: 1000 # in ms + playbackRates: + - 1 + - '1.5' + - 3 + +user_account: + deleting_policies: + email_confirmation: true diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml index 27eb933247..33bd2ddb84 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml @@ -6,6 +6,7 @@ main: maintenance: false key: '' api_require_ssl: true + delete-account-require-email-confirmation: true database: host: 'sql-host' port: 3306 @@ -212,3 +213,35 @@ embed_bundle: document: player: flexpaper enable-pdfjs: true +geocoding-providers: + - + name: 'mapBox' + enabled: true + public-key: '' + default-position: + - 2.335062 + - 48.879162 + default-zoom: 2 + marker-default-zoom: 11 + position-fields: + - + name: GpsCompositePosition + type: latlng + # - + # name: Longitude + # type: lng + # - + # name: Latitude + # type: lat +video-editor: + vttFieldName: VideoTextTrackChapters + seekBackwardStep: 1000 # in ms + seekForwardStep: 1000 # in ms + playbackRates: + - 1 + - '1.5' + - 3 + +user_account: + deleting_policies: + email_confirmation: true diff --git a/tests/classes/PhraseanetTestCase.php b/tests/classes/PhraseanetTestCase.php index 10a121af87..1f03956f86 100644 --- a/tests/classes/PhraseanetTestCase.php +++ b/tests/classes/PhraseanetTestCase.php @@ -273,6 +273,7 @@ abstract class PhraseanetTestCase extends WebTestCase static $decodedFixtureIds; if (is_null($decodedFixtureIds)) { + $p = sys_get_temp_dir().'/fixtures.json'; $decodedFixtureIds = json_decode(file_get_contents(sys_get_temp_dir().'/fixtures.json'), true); } self::$fixtureIds = $decodedFixtureIds; @@ -379,6 +380,8 @@ abstract class PhraseanetTestCase extends WebTestCase $app->boot(); + // $app['monolog'] = $this->getMock('Psr\Log\LoggerInterface'); + return $app; } diff --git a/tests/files/cestlafete.jpg b/tests/files/cestlafete.jpg index 698ec817b02d162ef301cc2c87de508aa5208a58..c0e8cd7f753059b09da50ccb8ebe769b3aa8319f 100755 GIT binary patch delta 109 zcmezWm2ty&#tn{)jE^QeF-~SOG?;vy@%v;MCJn2K+yY-;TlI{Rk^(Dz{k&qm#FYG` zRK4WXl~0)0b01O41weRVr71qB!y#tn{)jE0l{GRaJiV=QMfFrR##@%!d_X2S{q)jJG= From 0cbc5a8ef41bb4d916d92d3da54a3dfcac10d099 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Tue, 28 May 2019 15:06:06 +0200 Subject: [PATCH 3/4] PHRAS-2605_fix-unittest-bootstrap_4.1 remove debug --- lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php | 2 -- tests/classes/PhraseanetTestCase.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php index 9a887155b7..b99c41a979 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php @@ -43,8 +43,6 @@ class LocaleServiceProvider implements ServiceProviderInterface if (0 === count($enabledLanguages)) { $app['monolog']->error('Wrong language configuration, no language activated'); - $app['monolog']->error(var_export(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true)); - // throw new \Exception('Wrong language configuration, no language activated'); return $availableLanguages; } diff --git a/tests/classes/PhraseanetTestCase.php b/tests/classes/PhraseanetTestCase.php index 1f03956f86..4b4e3bc37c 100644 --- a/tests/classes/PhraseanetTestCase.php +++ b/tests/classes/PhraseanetTestCase.php @@ -380,8 +380,6 @@ abstract class PhraseanetTestCase extends WebTestCase $app->boot(); - // $app['monolog'] = $this->getMock('Psr\Log\LoggerInterface'); - return $app; } From 1653c2494cf37419cd569a605293e85ad0748d76 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Tue, 28 May 2019 15:16:28 +0200 Subject: [PATCH 4/4] PHRAS-2605_fix-unittest-bootstrap_4.1 remove debug --- lib/Alchemy/Phrasea/Application.php | 2 -- lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php | 1 + tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php | 1 - tests/classes/PhraseanetTestCase.php | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php index 1e4fcb1764..f586a4f93a 100644 --- a/lib/Alchemy/Phrasea/Application.php +++ b/lib/Alchemy/Phrasea/Application.php @@ -256,7 +256,6 @@ class Application extends SilexApplication $this->register(new OrderServiceProvider()); $this->register(new WebhookServiceProvider()); - $this['monolog'] = $this->share( $this->extend('monolog', function (LoggerInterface $logger, Application $app) { @@ -274,7 +273,6 @@ class Application extends SilexApplication }) ); - $this['phraseanet.exception_handler'] = $this->share(function ($app) { /** @var PhraseaExceptionHandler $handler */ $handler = PhraseaExceptionHandler::register($app['debug']); diff --git a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php index b99c41a979..fa816c9ef7 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php @@ -43,6 +43,7 @@ class LocaleServiceProvider implements ServiceProviderInterface if (0 === count($enabledLanguages)) { $app['monolog']->error('Wrong language configuration, no language activated'); + return $availableLanguages; } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php index 7245f53776..65832cf4dc 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/UploadTest.php @@ -106,7 +106,6 @@ class UploadTest extends \PhraseanetAuthenticatedWebTestCase $record = new \record_adapter(self::$DI['app'], $id[0], $id[1]); $this->assertTrue($record->get_thumbnail()->is_physically_present()); - $zzz = $record->get_caption()->get_fields(); $fields = $record->get_caption()->get_fields(['FileName']); $field = array_pop($fields); $this->assertEquals('KIKOO.JPG', $field->get_serialized_values()); diff --git a/tests/classes/PhraseanetTestCase.php b/tests/classes/PhraseanetTestCase.php index 4b4e3bc37c..10a121af87 100644 --- a/tests/classes/PhraseanetTestCase.php +++ b/tests/classes/PhraseanetTestCase.php @@ -273,7 +273,6 @@ abstract class PhraseanetTestCase extends WebTestCase static $decodedFixtureIds; if (is_null($decodedFixtureIds)) { - $p = sys_get_temp_dir().'/fixtures.json'; $decodedFixtureIds = json_decode(file_get_contents(sys_get_temp_dir().'/fixtures.json'), true); } self::$fixtureIds = $decodedFixtureIds;