mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
bootstrapping tests
This commit is contained in:
parent
93a5568aee
commit
bcfa2c2131
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,7 +18,7 @@ app/config/parameters.yml
|
|||||||
Tests/Fixtures/App/config/parameters.yml
|
Tests/Fixtures/App/config/parameters.yml
|
||||||
|
|
||||||
# fixtures
|
# fixtures
|
||||||
Resources/test/*
|
Resources/test/Fixtures/App/DoctrineMigrations/
|
||||||
|
|
||||||
#composer
|
#composer
|
||||||
composer.lock
|
composer.lock
|
||||||
|
46
Resources/test/Fixtures/App/AppKernel.php
Normal file
46
Resources/test/Fixtures/App/AppKernel.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
|
||||||
|
class AppKernel extends Kernel
|
||||||
|
{
|
||||||
|
public function registerBundles()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||||
|
new Chill\MainBundle\ChillMainBundle(),
|
||||||
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||||
|
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
||||||
|
new \Symfony\Bundle\AsseticBundle\AsseticBundle(),
|
||||||
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||||
|
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
|
||||||
|
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
|
||||||
|
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
||||||
|
new Chill\PersonBundle\ChillPersonBundle(),
|
||||||
|
new Chill\CustomFieldsBundle\ChillCustomFieldsBundle(),
|
||||||
|
new \Chill\EventBundle\ChillEventBundle,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||||
|
{
|
||||||
|
$loader->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';
|
||||||
|
}
|
||||||
|
}
|
43
Resources/test/Fixtures/App/config/config.yml
Normal file
43
Resources/test/Fixtures/App/config/config.yml
Normal file
@ -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]
|
52
Resources/test/Fixtures/App/config/config_test.yml
Normal file
52
Resources/test/Fixtures/App/config/config_test.yml
Normal file
@ -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 }
|
11
Resources/test/Fixtures/App/config/parameters.gitlab-ci.yml
Normal file
11
Resources/test/Fixtures/App/config/parameters.gitlab-ci.yml
Normal file
@ -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
|
11
Resources/test/Fixtures/App/config/parameters.yml
Normal file
11
Resources/test/Fixtures/App/config/parameters.yml
Normal file
@ -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
|
11
Resources/test/Fixtures/App/config/parameters.yml.dist
Normal file
11
Resources/test/Fixtures/App/config/parameters.yml.dist
Normal file
@ -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
|
4
Resources/test/Fixtures/App/config/routing.yml
Normal file
4
Resources/test/Fixtures/App/config/routing.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#load routes for chil bundles
|
||||||
|
chill_routes:
|
||||||
|
resource: .
|
||||||
|
type: chill_routes
|
27
Resources/test/Fixtures/App/console
Normal file
27
Resources/test/Fixtures/App/console
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
|
||||||
|
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
|
||||||
|
//umask(0000);
|
||||||
|
|
||||||
|
set_time_limit(0);
|
||||||
|
|
||||||
|
require_once __DIR__.'/../../bootstrap.php';
|
||||||
|
require_once __DIR__.'/AppKernel.php';
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
use Symfony\Component\Debug\Debug;
|
||||||
|
|
||||||
|
$input = new ArgvInput();
|
||||||
|
$env = $input->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);
|
8
Resources/test/bootstrap.php
Normal file
8
Resources/test/bootstrap.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (!is_file($autoloadFile = __DIR__.'/../../vendor/autoload.php')) {
|
||||||
|
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
|
||||||
|
}
|
||||||
|
|
||||||
|
require $autoloadFile;
|
||||||
|
|
40
Resources/views/Participation/new-multiple.html.twig
Normal file
40
Resources/views/Participation/new-multiple.html.twig
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
{% extends 'ChillEventBundle::layout.html.twig' %}
|
||||||
|
|
||||||
|
{% import 'ChillPersonBundle:Person:macro.html.twig' as person_macro %}
|
||||||
|
|
||||||
|
{% block title 'Participation creation'|trans %}
|
||||||
|
|
||||||
|
{% block event_content -%}
|
||||||
|
<h1>{{ 'Participation creation'|trans }}</h1>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Associated person'|trans }}</th>
|
||||||
|
<td>{{ person_macro.render(participation.person) }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Associated event'|trans }} </th>
|
||||||
|
<td>{{ participation.event.name }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{{ form_start(form) }}
|
||||||
|
{{ form_row(form.role) }}
|
||||||
|
{{ form_row(form.status) }}
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button btn-cancel">
|
||||||
|
<i class="fa fa-arrow-left"></i>
|
||||||
|
{{ 'Back to the event'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
{{ form_widget(form.submit, { 'attr' : { 'class' : 'sc-button bt-create' } } ) }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{{ form_end(form) }}
|
||||||
|
{% endblock %}
|
23
phpunit.xml.dist
Normal file
23
phpunit.xml.dist
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<phpunit bootstrap="./Resources/test/bootstrap.php" colors="true">
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="ChillEventBundle test suite">
|
||||||
|
<directory suffix="Test.php">./Tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory>./</directory>
|
||||||
|
<exclude>
|
||||||
|
<directory>./Resources</directory>
|
||||||
|
<directory>./Tests</directory>
|
||||||
|
<directory>./vendor</directory>
|
||||||
|
</exclude>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
|
<php>
|
||||||
|
<server name="KERNEL_DIR" value="./Resources/test/Fixtures/App/" />
|
||||||
|
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
Loading…
x
Reference in New Issue
Block a user