diff --git a/.gitignore b/.gitignore index a06b406d1..093d23fa5 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ app/config/parameters.yml Tests/Fixtures/App/config/parameters.yml # fixtures -Resources/test/* +Resources/test/Fixtures/App/DoctrineMigrations/ #composer composer.lock diff --git a/Resources/test/Fixtures/App/AppKernel.php b/Resources/test/Fixtures/App/AppKernel.php new file mode 100644 index 000000000..366c1e6a0 --- /dev/null +++ b/Resources/test/Fixtures/App/AppKernel.php @@ -0,0 +1,46 @@ +load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); + } + + /** + * @return string + */ + public function getCacheDir() + { + return sys_get_temp_dir().'/ChillEventBundle/cache'; + } + + /** + * @return string + */ + public function getLogDir() + { + return sys_get_temp_dir().'/ChillEventBundle/logs'; + } +} diff --git a/Resources/test/Fixtures/App/config/config.yml b/Resources/test/Fixtures/App/config/config.yml new file mode 100644 index 000000000..cf6bb3108 --- /dev/null +++ b/Resources/test/Fixtures/App/config/config.yml @@ -0,0 +1,43 @@ +imports: + - { resource: parameters.yml } + +framework: + secret: Not very secret + router: { resource: "%kernel.root_dir%/config/routing.yml" } + form: true + csrf_protection: true + session: ~ + default_locale: fr + translator: { fallback: fr } + profiler: { only_exceptions: false } + templating: + engines: ['twig'] + +# Doctrine Configuration +doctrine: + dbal: + driver: pdo_pgsql + host: "%database_host%" + port: "%database_port%" + dbname: "%database_name%" + user: "%database_user%" + password: "%database_password%" + charset: UTF8 + mapping_types: + jsonb: json_array + + orm: + auto_generate_proxy_classes: "%kernel.debug%" + auto_mapping: true + +# Assetic Configuration +assetic: + debug: "%kernel.debug%" + use_controller: false + bundles: [ ] + #java: /usr/bin/java + filters: + cssrewrite: ~ + +chill_main: + available_languages: [fr, en] diff --git a/Resources/test/Fixtures/App/config/config_test.yml b/Resources/test/Fixtures/App/config/config_test.yml new file mode 100644 index 000000000..b4f6d786a --- /dev/null +++ b/Resources/test/Fixtures/App/config/config_test.yml @@ -0,0 +1,52 @@ +imports: + - { resource: config.yml } + +framework: + test: ~ + session: + storage_id: session.storage.filesystem + +security: + role_hierarchy: + CHILL_MASTER_ROLE: [CHILL_INHERITED_ROLE_1] + providers: + chain_provider: + chain : + providers: [in_memory, users] + in_memory: + memory: + users: + admin: { password: "password", roles: 'ROLE_ADMIN' } + users: + entity: + class: Chill\MainBundle\Entity\User + property: username + + encoders: + Chill\MainBundle\Entity\User: + algorithm: bcrypt + Symfony\Component\Security\Core\User\User: + algorithm: plaintext + + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + + + default: + anonymous: ~ + http_basic: ~ + form_login: + csrf_parameter: _csrf_token + csrf_token_id: authenticate + csrf_provider: form.csrf_provider + + logout: ~ + + + access_control: + - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } + - { path: ^/[a-z]*/admin, roles: ROLE_ADMIN } + - { path: ^/, roles: ROLE_USER } \ No newline at end of file diff --git a/Resources/test/Fixtures/App/config/parameters.gitlab-ci.yml b/Resources/test/Fixtures/App/config/parameters.gitlab-ci.yml new file mode 100644 index 000000000..c4e63ef76 --- /dev/null +++ b/Resources/test/Fixtures/App/config/parameters.gitlab-ci.yml @@ -0,0 +1,11 @@ +parameters: + database_host: chill__database + database_port: 5432 + database_name: postgres + database_user: postgres + database_password: postgres + locale: fr + secret: ThisTokenIsNotSoSecretChangeIt + debug_toolbar: true + debug_redirects: false + use_assetic_controller: true \ No newline at end of file diff --git a/Resources/test/Fixtures/App/config/parameters.yml b/Resources/test/Fixtures/App/config/parameters.yml new file mode 100644 index 000000000..d92cc2318 --- /dev/null +++ b/Resources/test/Fixtures/App/config/parameters.yml @@ -0,0 +1,11 @@ +parameters: + database_host: 127.0.0.1 + database_port: 5435 + database_name: postgres + database_user: postgres + database_password: postgres + locale: fr + secret: ThisTokenIsNotSoSecretChangeIt + debug_toolbar: true + debug_redirects: false + use_assetic_controller: true \ No newline at end of file diff --git a/Resources/test/Fixtures/App/config/parameters.yml.dist b/Resources/test/Fixtures/App/config/parameters.yml.dist new file mode 100644 index 000000000..38fab7fd2 --- /dev/null +++ b/Resources/test/Fixtures/App/config/parameters.yml.dist @@ -0,0 +1,11 @@ +parameters: + database_host: 127.0.0.1 + database_port: 5435 + database_name: chill + database_user: chill + database_password: chill + locale: fr + secret: ThisTokenIsNotSoSecretChangeIt + debug_toolbar: true + debug_redirects: false + use_assetic_controller: true \ No newline at end of file diff --git a/Resources/test/Fixtures/App/config/routing.yml b/Resources/test/Fixtures/App/config/routing.yml new file mode 100644 index 000000000..802d3a1c8 --- /dev/null +++ b/Resources/test/Fixtures/App/config/routing.yml @@ -0,0 +1,4 @@ +#load routes for chil bundles +chill_routes: + resource: . + type: chill_routes \ No newline at end of file diff --git a/Resources/test/Fixtures/App/console b/Resources/test/Fixtures/App/console new file mode 100644 index 000000000..4ee9cfb33 --- /dev/null +++ b/Resources/test/Fixtures/App/console @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'test'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; + +if ($debug) { + Debug::enable(); +} + +$kernel = new AppKernel($env, $debug); +$application = new Application($kernel); +$application->run($input); diff --git a/Resources/test/bootstrap.php b/Resources/test/bootstrap.php new file mode 100644 index 000000000..0279b4ee6 --- /dev/null +++ b/Resources/test/bootstrap.php @@ -0,0 +1,8 @@ +{{ 'Participation creation'|trans }} + + + + + + + + + + + + +
{{ 'Associated person'|trans }}{{ person_macro.render(participation.person) }}
{{ 'Associated event'|trans }} {{ participation.event.name }}
+ + {{ form_start(form) }} + {{ form_row(form.role) }} + {{ form_row(form.status) }} + + + + {{ form_end(form) }} +{% endblock %} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000..cb1f867cf --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,23 @@ + + + + + + ./Tests + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + + + + +