DX: embed test app inside bundle

This commit is contained in:
Julien Fastré 2023-05-03 22:30:20 +02:00
parent 6d63177ff4
commit 4ab4554e63
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
54 changed files with 723 additions and 12 deletions

View File

@ -3,3 +3,38 @@
# Run tests from root to adapt your own environment # Run tests from root to adapt your own environment
KERNEL_CLASS='App\Kernel' KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st' APP_SECRET='$ecretf0rt3st'
ADMIN_PASSWORD=admin
LOCALE=fr
REDIS_URL=redis
REDIS_PORT=6379
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=2a30f6ba26521a2613821da35f28386e
TWILIO_SID=~
TWILIO_SECRET=~
DEFAULT_CARRIER_CODE=BE
ADD_ADDRESS_DEFAULT_COUNTRY=BE
ADD_ADDRESS_MAP_CENTER_X=50.8443
ADD_ADDRESS_MAP_CENTER_Y=4.3523
ADD_ADDRESS_MAP_CENTER_Z=15
SHORT_MESSAGE_DSN=null://null
MESSENGER_TRANSPORT_DSN=sync://
###< symfony/messenger ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
DATABASE_URL="postgresql://postgres:postgres@db:5432/test?serverVersion=14&charset=utf8"
ASYNC_UPLOAD_TEMP_URL_KEY=
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
ASYNC_UPLOAD_TEMP_URL_CONTAINER=

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "_exts/sphinx-php"] [submodule "_exts/sphinx-php"]
path = _exts/sphinx-php path = _exts/sphinx-php
url = https://github.com/fabpot/sphinx-php.git url = https://github.com/fabpot/sphinx-php.git
[submodule "tests/app"]
path = tests/app
url = https://gitlab.com/Chill-projet/chill-app.git

View File

@ -107,7 +107,7 @@
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"App\\": "tests/app/src/", "App\\": "tests/",
"Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests", "Chill\\DocGeneratorBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests",
"Chill\\WopiBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests" "Chill\\WopiBundle\\Tests\\": "src/Bundle/ChillDocGeneratorBundle/tests"
} }
@ -123,12 +123,10 @@
}, },
"bin-dir": "bin", "bin-dir": "bin",
"optimize-autoloader": true, "optimize-autoloader": true,
"sort-packages": true, "sort-packages": true
"vendor-dir": "tests/app/vendor"
}, },
"scripts": { "scripts": {
"auto-scripts": { "auto-scripts": {
"assets:install %PUBLIC_DIR%": "symfony-cmd",
"cache:clear": "symfony-cmd" "cache:clear": "symfony-cmd"
} }
} }

View File

@ -2,10 +2,10 @@
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html --> <!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="tests/app/vendor/phpunit/phpunit/phpunit.xsd" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false" backupGlobals="false"
colors="true" colors="true"
bootstrap="tests/app/tests/bootstrap.php" bootstrap="tests/bootstrap.php"
> >
<php> <php>
<ini name="error_reporting" value="-1" /> <ini name="error_reporting" value="-1" />

View File

@ -97,9 +97,9 @@ final class CalendarTypeTest extends TypeTestCase
$calendar = new Calendar(); $calendar = new Calendar();
$calendar->setMainUser(new class () extends User { $calendar->setMainUser(new class () extends User {
public function getId() public function getId(): ?int
{ {
return '1'; return 1;
} }
}); });

View File

@ -42,6 +42,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void
{ {
return;
$existing = []; $existing = [];
for ($i = 0; 20 > $i; ++$i) { for ($i = 0; 20 > $i; ++$i) {

View File

@ -198,6 +198,8 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
return $result; return $result;
} }
return $picked;
} else { } else {
$picked = $this->pickChoice($choices); $picked = $this->pickChoice($choices);
@ -210,6 +212,8 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
return $result; return $result;
} }
return $picked;
} }
throw new \LogicException("should not happens"); throw new \LogicException("should not happens");

55
tests/Kernel.php Normal file
View File

@ -0,0 +1,55 @@
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
private const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function registerBundles(): iterable
{
$contents = require __DIR__ . '/app/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
}
}
public function getProjectDir()
{
return \dirname(__DIR__);
}
protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = $this->getProjectDir().'/tests/app/config';
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$container->addResource(new FileResource($this->getProjectDir().'/tests/app/config/bundles.php'));
$container->setParameter('container.dumper.inline_class_loader', \PHP_VERSION_ID < 70400 || $this->debug);
$container->setParameter('container.dumper.inline_factories', true);
$confDir = $this->getProjectDir().'/tests/app/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
}

@ -1 +0,0 @@
Subproject commit 5e478fdfbf429baf3ce852ae69eb1f7101b1b416

View File

@ -0,0 +1,23 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/../../vendor/autoload.php';
if (!class_exists(Dotenv::class)) {
throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
}
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/../../.env.test');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

View File

@ -0,0 +1,39 @@
<?php
return [
ChampsLibres\AsyncUploaderBundle\ChampsLibresAsyncUploaderBundle::class => ['all' => true],
Chill\ActivityBundle\ChillActivityBundle::class => ['all' => true],
Chill\AsideActivityBundle\ChillAsideActivityBundle::class => ['all' => true],
Chill\CalendarBundle\ChillCalendarBundle::class => ['all' => true],
Chill\CustomFieldsBundle\ChillCustomFieldsBundle::class => ['all' => true],
Chill\DocGeneratorBundle\ChillDocGeneratorBundle::class => ['all' => true],
Chill\DocStoreBundle\ChillDocStoreBundle::class => ['all' => true],
Chill\EventBundle\ChillEventBundle::class => ['all' => true],
Chill\MainBundle\ChillMainBundle::class => ['all' => true],
Chill\PersonBundle\ChillPersonBundle::class => ['all' => true],
Chill\ReportBundle\ChillReportBundle::class => ['all' => true],
Chill\TaskBundle\ChillTaskBundle::class => ['all' => true],
Chill\ThirdPartyBundle\ChillThirdPartyBundle::class => ['all' => true],
Chill\BudgetBundle\ChillBudgetBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
//Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Knp\Bundle\MenuBundle\KnpMenuBundle::class => ['all' => true],
Knp\Bundle\TimeBundle\KnpTimeBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
loophp\PsrHttpMessageBridgeBundle\PsrHttpMessageBridgeBundle::class => ['all' => true],
\Misd\PhoneNumberBundle\MisdPhoneNumberBundle::class => ['all' => true],
ChampsLibres\WopiBundle\WopiBundle::class => ['all' => true],
Chill\WopiBundle\ChillWopiBundle::class => ['all' => true],
\Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
];

View File

@ -0,0 +1,3 @@
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

View File

@ -0,0 +1,33 @@
framework:
cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name
# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# Other options include:
# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu
# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null
default_redis_provider: '%env(resolve:REDIS_URL)%'
pools:
cache.user_data:
adapter: cache.adapter.redis
public: true
default_lifetime: 300 # 5 minutes
# will be used in chill_main.tag_aware_cache service
cache.tags:
adapter: cache.adapter.redis
public: false
default_lifetime: 300

View File

@ -0,0 +1,14 @@
champs_libres_async_uploader:
openstack:
os_username: '%env(resolve:OS_USERNAME)%' # Required
os_password: '%env(resolve:OS_PASSWORD)%' # Required
os_tenant_id: '%env(resolve:OS_TENANT_ID)%' # Required
os_region_name: '%env(resolve:OS_REGION_NAME)%' # Required
os_auth_url: '%env(resolve:OS_AUTH_URL)%' # Required
temp_url:
temp_url_key: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_KEY)%' # Required
container: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_CONTAINER)%' # Required
temp_url_base_path: '%env(resolve:ASYNC_UPLOAD_TEMP_URL_BASE_PATH)%' # Required. Do not forget a trailing slash
max_post_file_size: 15000000 # 15Mo (bytes)
max_expires_delay: 180
max_submit_delay: 3600

View File

@ -0,0 +1,23 @@
chill_main:
available_languages: [ '%env(resolve:LOCALE)%' ]
notifications:
from_email: 'test@yopmail.com'
from_name: 'TEST CHILL'
host: 'localhost'
redis:
host: '%env(resolve:REDIS_HOST)%'
port: '%env(resolve:REDIS_PORT)%'
phone_helper:
twilio_sid: '%env(resolve:TWILIO_SID)%'
twilio_secret: '%env(resolve:TWILIO_SECRET)%'
default_carrier_code: '%env(resolve:DEFAULT_CARRIER_CODE)%'
chill_custom_fields:
show_empty_values_in_views: false
# Enable/disable specific libraries (css and js)
twig:
globals:
active_bootstrap: false
active_forkawesome: true
active_ckeditor: false

View File

@ -0,0 +1,14 @@
#chill_amli_budget:
# resources:
# - { key: travail-temporaire, labels: [{ lang: fr, label: "Travail temporaire" }]}
# - { key: chomage, labels: [{ lang: fr, label: "Allocation de chômage"}]}
# - { key: cpas, labels: [{ lang: fr, label: "CPAS"}]}
# - { key: mutuelle, labels: [{ lang: fr, label: "Mutuelle"}]}
# - { key: pension-alimentaire, labels: [{ lang: fr, label: "Pension alimentaire"}]}
# - { key: allocation-fam, labels: [{ lang: fr, label: "Allocations familiales"}]}
# charges:
# - { key: charge-communes, labels: [{ lang: fr, label: "Charges communes" }]}
# - { key: electricity, labels: [{ lang: fr, label: "Électricité" }]}
# - { key: gaz, labels: [{ lang: fr, label: "Gaz" }]}
# - { key: water, labels: [{ lang: fr, label: "Eau" }]}
# - { key: autres, labels: [ { lang: fr, label: "Autres"}]}

View File

@ -0,0 +1,4 @@
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View File

@ -0,0 +1,21 @@
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
# uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration
#firephp:
# type: firephp
# level: info
#chromephp:
# type: chromephp
# level: info
console:
type: console
process_psr_3_messages: false
channels: ['!event', '!doctrine', '!console']
bubble: false

View File

@ -0,0 +1,18 @@
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '5.7'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.default
auto_mapping: true
#mappings:
# App:
# is_bundle: false
# type: annotation
# dir: '%kernel.project_dir%/src/Entity'
# prefix: 'App\Entity'
# alias: App

View File

@ -0,0 +1,30 @@
doctrine_migrations:
migrations_paths:
# migrations for default chill modules
'Chill\Migrations\Main': '@ChillMainBundle/migrations'
'Chill\Migrations\Activity': '@ChillActivityBundle/migrations'
'Chill\Migrations\DocStore': '@ChillDocStoreBundle/migrations'
'Chill\Migrations\CustomFields': '@ChillCustomFieldsBundle/migrations'
'Chill\Migrations\Event': '@ChillEventBundle/migrations'
'Chill\Migrations\Person': '@ChillPersonBundle/migrations'
'Chill\Migrations\Report': '@ChillReportBundle/migrations'
'Chill\Migrations\Task': '@ChillTaskBundle/migrations'
'Chill\Migrations\ThirdParty': '@ChillThirdPartyBundle/migrations'
'Chill\Migrations\AsideActivity': '@ChillAsideActivityBundle/migrations'
'Chill\Migrations\DocGenerator': '@ChillDocGeneratorBundle/migrations'
'Chill\Migrations\Calendar': '@ChillCalendarBundle/migrations'
'Chill\Migrations\Budget': '@ChillBudgetBundle/migrations'
all_or_nothing:
true
services:
'Doctrine\Migrations\Version\Comparator': 'Chill\MainBundle\Doctrine\Migrations\VersionComparator'
storage:
table_storage:
table_name: 'migration_versions'
version_column_name: 'version'
version_column_length: 1024
executed_at_column_name: 'executed_at'
execution_time_column_name: 'execution_time'

View File

@ -0,0 +1,30 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
# DIRTY FIX un bug dans symfony4 empêche de récupérer un tableau de variables depuis .env
# cfr. https://github.com/symfony/symfony/issues/28599
trusted_hosts:
- '^(localhost|127.0.0.1)$'
#csrf_protection: true
#http_method_override: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
#esi: true
#fragments: true
php_errors:
log: true
## sf4 check: ou à déplacer dans un chill.yaml
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
templating:
engines: ['twig']

View File

@ -0,0 +1,12 @@
lexik_jwt_authentication:
secret_key: '%env(resolve:JWT_SECRET_KEY)%'
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
pass_phrase: '%env(JWT_PASSPHRASE)%'
# required for wopi - recommended duration
token_ttl: 36000
token_extractors:
query_parameter:
enabled: true
name: access_token

View File

@ -0,0 +1,8 @@
services:
# Register loophp/psr17/Psr17 class and autowire/autoconfigure it.
loophp\psr17\Psr17:
autowire: true
autoconfigure: true
# Alias the service to the Psr17 interface.
loophp\psr17\Psr17Interface: '@loophp\psr17\Psr17'

View File

@ -0,0 +1,21 @@
services:
# Register nyholm/psr7 services for autowiring with PSR-17 (HTTP factories)
Psr\Http\Message\RequestFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\ResponseFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\ServerRequestFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\StreamFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\UploadedFileFactoryInterface: '@nyholm.psr7.psr17_factory'
Psr\Http\Message\UriFactoryInterface: '@nyholm.psr7.psr17_factory'
# Register nyholm/psr7 services for autowiring with HTTPlug factories
Http\Message\MessageFactory: '@nyholm.psr7.httplug_factory'
Http\Message\RequestFactory: '@nyholm.psr7.httplug_factory'
Http\Message\ResponseFactory: '@nyholm.psr7.httplug_factory'
Http\Message\StreamFactory: '@nyholm.psr7.httplug_factory'
Http\Message\UriFactory: '@nyholm.psr7.httplug_factory'
nyholm.psr7.psr17_factory:
class: Nyholm\Psr7\Factory\Psr17Factory
nyholm.psr7.httplug_factory:
class: Nyholm\Psr7\Factory\HttplugFactory

View File

@ -0,0 +1,8 @@
# As of Symfony 5.1, deprecations are logged in the dedicated "deprecation" channel when it exists
#monolog:
# channels: [deprecation]
# handlers:
# deprecation:
# type: stream
# channels: [deprecation]
# path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log"

View File

@ -0,0 +1,20 @@
doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: pool
pool: doctrine.system_cache_pool
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system

View File

@ -0,0 +1,14 @@
monolog:
handlers:
graylog:
type: gelf
publisher:
hostname: "%env(resolve:GELF_HOST)%"
port: "%env(resolve:GELF_PORT)%"
level: warning
channels: ['!event']
console:
type: console
process_psr_3_messages: false
channels: ['!event', '!doctrine', '!console']
bubble: false

View File

@ -0,0 +1,3 @@
framework:
router:
strict_requirements: null

View File

@ -0,0 +1,4 @@
#webpack_encore:
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Available in version 1.2
#cache: true

View File

@ -0,0 +1,4 @@
doctrine:
dbal:
types:
uuid: 'Ramsey\Uuid\Doctrine\UuidType'

View File

@ -0,0 +1,7 @@
framework:
router:
utf8: true
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost

View File

@ -0,0 +1,58 @@
security:
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
providers:
chain_provider:
chain :
providers: [in_memory, users]
in_memory:
memory:
users:
admin: { password: '%env(resolve:ADMIN_PASSWORD)%', roles: ['ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'] }
users:
id: chill.main.user_provider
encoders:
Chill\MainBundle\Entity\User:
algorithm: bcrypt
Symfony\Component\Security\Core\User\User: plaintext
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
default:
anonymous: ~
provider: chain_provider
form_login:
csrf_parameter: _csrf_token
csrf_token_id: authenticate
#csrf_provider: security.csrf.token_manager
logout_on_user_change: true
logout: ~
# uncomment to enable impersonate mode in Chill
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#firewalls-authentication
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/(login|logout), roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/public, roles: IS_AUTHENTICATED_ANONYMOUSLY }
# access for homepage, the homepage redirect admin to admin section
- { path: ^/$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
- { path: ^/homepage$, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# idem
- { path: ^/([a-z]+/)?homepage, roles: [ IS_AUTHENTICATED_REMEMBERED ] }
# admin section, only for admin
- { path: ^/([a-z]+/)?admin, roles: ROLE_ADMIN }
# other pages, only for regular user (no admin)
- { path: ^/, roles: ROLE_USER }

View File

@ -0,0 +1,3 @@
sensio_framework_extra:
router:
annotations: false

View File

@ -0,0 +1,5 @@
---
chill_main:
available_languages:
- 'fr'
- 'en'

View File

@ -0,0 +1,6 @@
framework:
test: true
session:
storage_id: session.storage.mock_file
assets:
json_manifest_path: NULL

View File

@ -0,0 +1,5 @@
framework:
mailer:
dsn: 'null://null'
envelope:
sender: 'test@chill.social'

View File

@ -0,0 +1,12 @@
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

View File

@ -0,0 +1,8 @@
---
# config/packages/test/security.yaml
security:
firewalls:
default:
http_basic: ~
role_hierarchy:
CHILL_MASTER_ROLE: [CHILL_INHERITED_ROLE_1]

View File

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

View File

@ -0,0 +1,3 @@
framework:
validation:
not_compromised_password: false

View File

@ -0,0 +1,2 @@
webpack_encore:
strict_mode: false

View File

@ -0,0 +1,7 @@
framework:
default_locale: '%env(resolve:LOCALE)%'
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks: [ '%env(resolve:LOCALE)%' ]

View File

@ -0,0 +1,17 @@
twig:
default_path: '%kernel.project_dir%/templates'
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
exception_controller: null
## In Symfony 5, bootstrap_5 theme is supported. But not yet in sf4 !!
# see sf5 https://symfony.com/doc/current/form/form_themes.html
# see sf4 https://symfony.com/doc/4.4/form/form_themes.html
#
# While waiting for the upgrade, we get the form theme file
# (https://github.com/symfony/symfony/tree/5.4/src/Symfony/Bridge/Twig/Resources/views/Form),
# put it in ChillMainBundle/Resources/views/Form/bootstrap5/
# and adapt it lightly.
#
form_themes: ['@ChillMain/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig']
#form_themes: ['bootstrap_5_horizontal_layout.html.twig']

View File

@ -0,0 +1,8 @@
framework:
validation:
email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []

View File

@ -0,0 +1,33 @@
---
webpack_encore:
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false
# Set attributes that will be rendered on all script and link tags
script_attributes:
defer: true
# link_attributes:
#
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'
# Preload all rendered script and link tags automatically via the HTTP/2 Link header
# preload: true
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
# strict_mode: false
# If you have multiple builds:
# builds:
# pass "frontend" as the 3rg arg to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
# frontend: '%kernel.project_dir%/public/frontend/build'
# Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# Put in config/packages/prod/webpack_encore.yaml
# cache: true

View File

@ -0,0 +1,2 @@
framework:
workflows: null

View File

@ -0,0 +1,9 @@
<?php
if (file_exists(dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/srcApp_KernelProdContainer.preload.php';
}
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}

View File

@ -0,0 +1,8 @@
#index:
# path: /
# controller: App\Controller\DefaultController::index
#load routes for chill bundles
chill_routes:
resource: .
type: chill_routes

View File

@ -0,0 +1,3 @@
kernel:
resource: ../../../Kernel.php
type: annotation

View File

@ -0,0 +1,3 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

View File

@ -0,0 +1,7 @@
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

View File

@ -0,0 +1,15 @@
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones

11
tests/bootstrap.php Normal file
View File

@ -0,0 +1,11 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (file_exists(dirname(__DIR__).'/app/config/bootstrap.php')) {
require dirname(__DIR__).'/app/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}

42
tests/console Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env php
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
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;
}
set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}
$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');
}
require dirname(__DIR__).'/tests/app/config/bootstrap.php';
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);