From 6d38e0533f390309bd1e8a58047ac4ab39b4f9c8 Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Sat, 24 Feb 2024 02:34:46 +0100 Subject: [PATCH] Run tests in no debug mode --- app/config/config.yml | 3 +++ phpunit.xml.dist | 2 ++ src/Controller/Api/EntryRestController.php | 2 +- tests/bootstrap.php | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/config/config.yml b/app/config/config.yml index f2f1a262e..71b2aa71b 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -125,6 +125,9 @@ fos_rest: # for an unknown reason, EACH REQUEST goes to FOS\RestBundle\EventListener\FormatListener # so we need to add custom rule for custom api export but also for all other routes of the application... - { path: '^/', priorities: ['text/html', '*/*'], fallback_format: html, prefer_extension: false } + exception: + messages: + Symfony\Component\HttpKernel\Exception\BadRequestHttpException: true nelmio_api_doc: areas: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6cdcea71c..f1ffc0adf 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,6 +16,8 @@ + + diff --git a/src/Controller/Api/EntryRestController.php b/src/Controller/Api/EntryRestController.php index 3b8497fdf..b9fcffcd7 100644 --- a/src/Controller/Api/EntryRestController.php +++ b/src/Controller/Api/EntryRestController.php @@ -528,7 +528,7 @@ class EntryRestController extends WallabagRestController $limit = $this->getParameter('wallabag.api_limit_mass_actions'); if (\count($urls) > $limit) { - throw new HttpException(400, 'API limit reached'); + throw new BadRequestHttpException('API limit reached'); } $results = []; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 66c06715f..f9e89ba44 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -14,6 +14,7 @@ if (!isPartialRun()) { 'doctrine:database:drop', '--force', '--env=test', + '--no-debug', ]))->run(function ($type, $buffer) { echo $buffer; }); @@ -23,6 +24,7 @@ if (!isPartialRun()) { __DIR__ . '/../bin/console', 'doctrine:database:create', '--env=test', + '--no-debug', ]))->mustRun(function ($type, $buffer) { echo $buffer; }); @@ -33,6 +35,7 @@ if (!isPartialRun()) { 'doctrine:migrations:migrate', '--no-interaction', '--env=test', + '--no-debug', '-vv', ]))->mustRun(function ($type, $buffer) { echo $buffer; @@ -45,6 +48,7 @@ if (!isPartialRun()) { 'doctrine:fixtures:load', '--no-interaction', '--env=test', + '--no-debug', ]))->mustRun(function ($type, $buffer) { echo $buffer; });