Update files to Symfony 5.3 + add phpunit/phpunit

pull/3904/head
Julio Montoya 5 years ago
parent 18111af9a4
commit 23268575b0
  1. 5
      .gitignore
  2. 40
      bin/console
  3. 26
      bin/phpunit
  4. 10
      composer.json
  5. 1
      config/packages/prod/monolog.yaml
  6. 2
      config/packages/test/twig.yaml
  7. 35
      public/index.php

5
.gitignore vendored

@ -84,3 +84,8 @@ yarn-error.log
###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###
###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

@ -3,41 +3,15 @@
use Chamilo\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}
set_time_limit(0);
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
require dirname(__DIR__).'/vendor/autoload.php';
return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}
if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if (class_exists(Debug::class)) {
Debug::enable();
}
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
return new Application($kernel);
};

@ -1,18 +1,16 @@
#!/usr/bin/env php
<?php
if (file_exists(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
require dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit';
} else {
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) {
putenv('SYMFONY_PHPUNIT_REMOVE=symfony/yaml');
}
if (false === getenv('SYMFONY_PHPUNIT_VERSION')) {
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
}
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}

@ -59,11 +59,12 @@
"chamilo/settings-bundle": "dev-master",
"clue/graph": "^0.9.2",
"cocur/slugify": "^4.0",
"composer/package-versions-deprecated": "1.11.99.2",
"doctrine/data-fixtures": "~1.5",
"doctrine/dbal": "~2.0",
"doctrine/doctrine-bundle": "~2.0",
"doctrine/doctrine-bundle": "~2.3",
"doctrine/doctrine-fixtures-bundle": "^3.0",
"doctrine/doctrine-migrations-bundle": "~3.0",
"doctrine/doctrine-migrations-bundle": "~3.1",
"doctrine/orm": "~2.9",
"endroid/qr-code": "~3.7",
"essence/essence": "~3.0",
@ -99,7 +100,7 @@
"phpoffice/phpspreadsheet": "~1.16",
"phpoffice/phpword": "~0.18",
"sabre/vobject": "~4.2",
"sensio/framework-extra-bundle": "~6.0",
"sensio/framework-extra-bundle": "~6.1",
"sonata-project/exporter": "^2.2",
"stof/doctrine-extensions-bundle": "~1.4",
"sunra/php-simple-html-dom-parser": "~1.5",
@ -123,6 +124,7 @@
"symfony/polyfill-mbstring": "*",
"symfony/polyfill-php80": "*",
"symfony/requirements-checker": "^2.0",
"symfony/runtime": "^5.0",
"symfony/security-acl": "^3.0",
"symfony/security-bundle": "^5.0",
"symfony/serializer": "^5.0",
@ -157,6 +159,7 @@
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-doctrine": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"phpunit/phpunit": "^9.5",
"psalm/plugin-symfony": "^2.0",
"rector/rector": "^0.10",
"slevomat/coding-standard": "^7.0",
@ -168,6 +171,7 @@
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/var-dumper": "^5.2",
"symfony/web-profiler-bundle": "^5.3",
"symplify/easy-coding-standard": "^9.0",
"vimeo/psalm": "^4.0",
"weirdan/doctrine-psalm-plugin": "^1.0"

@ -10,6 +10,7 @@ monolog:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
formatter: monolog.formatter.json
console:
type: console
process_psr_3_messages: false

@ -1,2 +1,2 @@
twig:
strict_variables: false
strict_variables: true

@ -3,30 +3,17 @@
/* For licensing terms, see /license.txt */
use Chamilo\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php';
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
return function (array $context) {
// Chamilo
$isInstalled = $context['APP_INSTALLED'] ?? null;
if (1 !== (int) $isInstalled) {
// Does not support subdirectories for now
header('Location: /main/install/index.php');
exit;
}
// Redirects to the installation page.
$isInstalled = $_ENV['APP_INSTALLED'] ?? null;
if (1 !== (int) $isInstalled) {
// Does not support subdirectories for now
header('Location: /main/install/index.php');
exit;
}
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};

Loading…
Cancel
Save