mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'master' into _31_interface_creation_parcours
This commit is contained in:
commit
b1207cbd3e
64
.env
Normal file
64
.env
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
##
|
||||||
|
## Manually dump .env files in .env.local.php with
|
||||||
|
## `$ composer symfony:dump-env prod`
|
||||||
|
##
|
||||||
|
|
||||||
|
## Project environment
|
||||||
|
APP_ENV=dev
|
||||||
|
|
||||||
|
## Enable debug
|
||||||
|
APP_DEBUG=true
|
||||||
|
|
||||||
|
## Locale
|
||||||
|
LOCALE=fr
|
||||||
|
|
||||||
|
## Framework secret
|
||||||
|
APP_SECRET=ThisTokenIsNotSoSecretChangeIt
|
||||||
|
|
||||||
|
## Symfony/swiftmailer
|
||||||
|
MAILER_TRANSPORT=smtp
|
||||||
|
MAILER_HOST=smtp
|
||||||
|
MAILER_PORT=1025
|
||||||
|
MAILER_CRYPT=
|
||||||
|
MAILER_AUTH=
|
||||||
|
MAILER_USER=
|
||||||
|
MAILER_PASSWORD=
|
||||||
|
MAILER_URL=${MAILER_TRANSPORT}://${MAILER_HOST}:${MAILER_PORT}?encryption=${MAILER_CRYPT}&auth_mode=${MAILER_AUTH}&username=${MAILER_USER}&password=${MAILER_PASSWORD}
|
||||||
|
|
||||||
|
## Notifications
|
||||||
|
NOTIFICATION_HOST=localhost:8001
|
||||||
|
NOTIFICATION_FROM_EMAIL=admin@chill.social
|
||||||
|
NOTIFICATION_FROM_NAME=Chill
|
||||||
|
|
||||||
|
## Gelf
|
||||||
|
GELF_HOST=gelf
|
||||||
|
GELF_PORT=12201
|
||||||
|
|
||||||
|
## OVH OpenStack Storage User/Role
|
||||||
|
OS_USERNAME=
|
||||||
|
OS_PASSWORD=
|
||||||
|
OS_TENANT_ID=
|
||||||
|
OS_REGION_NAME=GRA
|
||||||
|
OS_AUTH_URL=https://auth.cloud.ovh.net/v2.0/
|
||||||
|
|
||||||
|
## OVH OpenStack Storage Container
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_KEY=
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_BASE_PATH=
|
||||||
|
ASYNC_UPLOAD_TEMP_URL_CONTAINER=
|
||||||
|
|
||||||
|
## Redis Cache
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PORT=6379
|
||||||
|
REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}
|
||||||
|
|
||||||
|
## Twilio
|
||||||
|
TWILIO_SID=~
|
||||||
|
TWILIO_SECRET=~
|
||||||
|
|
||||||
|
## DOCKER IMAGES REGISTRY
|
||||||
|
#IMAGE_PHP=
|
||||||
|
#IMAGE_NGINX=
|
||||||
|
|
||||||
|
## DOCKER IMAGES VERSION
|
||||||
|
#VERSION=test
|
||||||
|
VERSION=prod
|
6
.env.test
Normal file
6
.env.test
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# variables for .env environement
|
||||||
|
# those variables suits for gitlab-ci
|
||||||
|
# Run tests from root to adapt your own environment
|
||||||
|
KERNEL_CLASS='App\Kernel'
|
||||||
|
APP_SECRET='$ecretf0rt3st'
|
||||||
|
DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres?serverVersion=12&charset=utf8
|
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,4 +1,21 @@
|
|||||||
.composer/*
|
.composer/*
|
||||||
composer.phar
|
composer.phar
|
||||||
|
composer.lock
|
||||||
|
|
||||||
docs/build/
|
docs/build/
|
||||||
|
|
||||||
|
###> symfony/framework-bundle ###
|
||||||
|
/.env.local
|
||||||
|
/.env.local.php
|
||||||
|
/.env.*.local
|
||||||
|
/config/secrets/prod/prod.decrypt.private.php
|
||||||
|
/public/bundles/
|
||||||
|
/var/
|
||||||
|
/vendor/
|
||||||
|
/bin/
|
||||||
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
|
###> phpunit/phpunit ###
|
||||||
|
/phpunit.xml
|
||||||
|
.phpunit.result.cache
|
||||||
|
###< phpunit/phpunit ###
|
||||||
|
37
.gitlab-ci.yml
Normal file
37
.gitlab-ci.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
image: registry.gitlab.com/chill-projet/chill-app/php-base-image:7.4
|
||||||
|
|
||||||
|
# Select what we should cache between builds
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- tests/app/vendor/
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
# add extensions to postgres
|
||||||
|
- PGPASSWORD=$POSTGRES_PASSWORD psql -U $POSTGRES_USER -h db -c "CREATE EXTENSION IF NOT EXISTS unaccent; CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||||
|
# Install and run Composer
|
||||||
|
- curl -sS https://getcomposer.org/installer | php
|
||||||
|
- php composer.phar install
|
||||||
|
- php tests/app/bin/console doctrine:migrations:migrate -n
|
||||||
|
- php tests/app/bin/console doctrine:fixtures:load -n
|
||||||
|
|
||||||
|
# Bring in any services we need http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
||||||
|
# See http://docs.gitlab.com/ee/ci/services/README.html for examples.
|
||||||
|
services:
|
||||||
|
- name: postgres:12
|
||||||
|
alias: db
|
||||||
|
- name: redis
|
||||||
|
alias: redis
|
||||||
|
|
||||||
|
# Set any variables we need
|
||||||
|
variables:
|
||||||
|
# Configure postgres environment variables (https://hub.docker.com/r/_/postgres/)
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
# fetch the chill-app using git submodules
|
||||||
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
|
||||||
|
# Run our tests
|
||||||
|
test:
|
||||||
|
script:
|
||||||
|
- bin/phpunit --colors=never
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[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
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle"
|
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "tests/app/src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"champs-libres/async-uploader-bundle": "dev-sf4",
|
"champs-libres/async-uploader-bundle": "dev-sf4",
|
||||||
"graylog2/gelf-php": "^1.5",
|
"graylog2/gelf-php": "^1.5",
|
||||||
@ -67,6 +72,17 @@
|
|||||||
"symfony/stopwatch": "^5.1",
|
"symfony/stopwatch": "^5.1",
|
||||||
"symfony/web-profiler-bundle": "^5.0",
|
"symfony/web-profiler-bundle": "^5.0",
|
||||||
"symfony/var-dumper": "4.*",
|
"symfony/var-dumper": "4.*",
|
||||||
"symfony/debug-bundle": "^5.1"
|
"symfony/debug-bundle": "^5.1",
|
||||||
|
"symfony/phpunit-bridge": "^5.2"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"auto-scripts": {
|
||||||
|
"cache:clear": "symfony-cmd",
|
||||||
|
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"vendor-dir": "tests/app/vendor",
|
||||||
|
"bin-dir": "bin"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ As Chill rely on the `symfony <http://symfony.com>`_ framework, reading the fram
|
|||||||
Timelines <timelines.rst>
|
Timelines <timelines.rst>
|
||||||
Exports <exports.rst>
|
Exports <exports.rst>
|
||||||
Embeddable comments <embeddable-comments.rst>
|
Embeddable comments <embeddable-comments.rst>
|
||||||
Testing <make-test-working.rst>
|
Run tests <run-tests.rst>
|
||||||
Useful snippets <useful-snippets.rst>
|
Useful snippets <useful-snippets.rst>
|
||||||
manual/index.rst
|
manual/index.rst
|
||||||
Assets <assets.rst>
|
Assets <assets.rst>
|
||||||
|
@ -1,231 +0,0 @@
|
|||||||
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
|
||||||
under the terms of the GNU Free Documentation License, Version 1.3
|
|
||||||
or any later version published by the Free Software Foundation;
|
|
||||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
|
||||||
A copy of the license is included in the section entitled "GNU
|
|
||||||
Free Documentation License".
|
|
||||||
|
|
||||||
Make tests working
|
|
||||||
******************
|
|
||||||
|
|
||||||
Unit and functional tests are important to ensure that bundle may be deployed securely.
|
|
||||||
|
|
||||||
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
Integration tools (i.e. `travis-ci <https://travis-ci.org>`_) works like this :
|
|
||||||
|
|
||||||
* they clone the bundle repository in a virtual machine, using git
|
|
||||||
* they optionnaly run `composer` to download and install depedencies
|
|
||||||
* they optionnaly run other command to prepare a database, insert fixtures, ...
|
|
||||||
* they run test
|
|
||||||
|
|
||||||
On the developer's machine test should be runnable with two or three commands **runned from the bundle directory** :
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ composer install --dev
|
|
||||||
$ // command to insert fixtures, ...
|
|
||||||
$ phpunit
|
|
||||||
|
|
||||||
This chapter has been inspired by `this useful blog post <http://blog.kevingomez.fr/2013/01/09/functional-testing-standalone-symfony2-bundles/>`_.
|
|
||||||
|
|
||||||
Bootstrap phpunit for a standalone bundle
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
Unit tests should run after achieving this step.
|
|
||||||
|
|
||||||
|
|
||||||
phpunit.xml
|
|
||||||
-----------
|
|
||||||
|
|
||||||
A `phpunit.xml.dist` file should be present at the bundle root.
|
|
||||||
|
|
||||||
.. code-block:: xml
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
|
|
||||||
<!-- the file "./Tests/boostrap.php" will be created on the next step -->
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="ChillMain 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>
|
|
||||||
</phpunit>
|
|
||||||
|
|
||||||
|
|
||||||
bootstrap.php
|
|
||||||
--------------
|
|
||||||
|
|
||||||
A file `boostrap.php`, located in the `Tests` directory, will allow phpunit to resolve class autoloading :
|
|
||||||
|
|
||||||
.. code-block:: php
|
|
||||||
|
|
||||||
<?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;
|
|
||||||
|
|
||||||
|
|
||||||
composer.json
|
|
||||||
-------------
|
|
||||||
|
|
||||||
The `composer.json` file **located at the bundle's root** should contains all depencies needed to run test (and to execute bundle functions).
|
|
||||||
|
|
||||||
Ensure that all dependencies are included in the `require` and `require-dev` sections.
|
|
||||||
|
|
||||||
|
|
||||||
Functional tests
|
|
||||||
================
|
|
||||||
|
|
||||||
If you want to access services, database, and run functional tests, you will have to bootstrap a symfony app, with the minimal configuration. Three files are required :
|
|
||||||
|
|
||||||
* a `config_test.yml` file (eventually with a `config.yml`);
|
|
||||||
* a `routing.yml` file
|
|
||||||
* an `AppKernel.php` file
|
|
||||||
|
|
||||||
Adapt phpunit.xml
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
You should add reference to the new application within `phpunit.xml.dist`. The directive `<php>` should be added like this, if your `AppKernel.php` file is located in `Tests/Fixtures/App` directory:
|
|
||||||
|
|
||||||
.. code-block:: xml
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<phpunit bootstrap="./Tests/bootstrap.php" colors="true">
|
|
||||||
<testsuites>
|
|
||||||
<testsuite name="ChillMain 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>
|
|
||||||
<!-- the lines we added -->
|
|
||||||
<php>
|
|
||||||
<server name="KERNEL_DIR" value="./Tests/Fixtures/App/" />
|
|
||||||
</php>
|
|
||||||
</phpunit>
|
|
||||||
|
|
||||||
AppKernel.php
|
|
||||||
-------------
|
|
||||||
|
|
||||||
This file boostrap the app. It contains three functions. This is the file used in the ChillMain bundle :
|
|
||||||
|
|
||||||
.. code-block:: php
|
|
||||||
|
|
||||||
<?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(),
|
|
||||||
#add here all the required bundle (some bundle are not required)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
|
||||||
{
|
|
||||||
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCacheDir()
|
|
||||||
{
|
|
||||||
return sys_get_temp_dir().'/ChillMainBundle/cache';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLogDir()
|
|
||||||
{
|
|
||||||
return sys_get_temp_dir().'/ChillMainBundle/logs';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
config_test.yml
|
|
||||||
---------------
|
|
||||||
|
|
||||||
There are only few parameters required for the config file. This is a basic version for ChillMain :
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
# config/config_test.yml
|
|
||||||
imports:
|
|
||||||
- { resource: config.yml } #here we import a config.yml file, this is not required
|
|
||||||
|
|
||||||
framework:
|
|
||||||
test: ~
|
|
||||||
session:
|
|
||||||
storage_id: session.storage.filesystem
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
# config/config.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: #required for assetic. Remove if not needed
|
|
||||||
engines: ['twig']
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
You must adapt config.yml file according to your required bundle. Some options will be missing, other may be removed...
|
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
If you would like to tests different environments, with differents configuration, you could create differents config_XXX.yml files.
|
|
||||||
|
|
||||||
routing.yml
|
|
||||||
------------
|
|
||||||
|
|
||||||
You should add there all routing information needed for your bundle.
|
|
||||||
|
|
||||||
.. code-block: yaml
|
|
||||||
|
|
||||||
chill_main_bundle:
|
|
||||||
resource: "@CLChillMainBundle/Resources/config/routing.yml"
|
|
||||||
|
|
||||||
That's it. Tests should pass.
|
|
68
docs/source/development/run-tests.rst
Normal file
68
docs/source/development/run-tests.rst
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
.. Copyright (C) 2014 Champs Libres Cooperative SCRLFS
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.3
|
||||||
|
or any later version published by the Free Software Foundation;
|
||||||
|
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||||
|
A copy of the license is included in the section entitled "GNU
|
||||||
|
Free Documentation License".
|
||||||
|
|
||||||
|
Run tests
|
||||||
|
*********
|
||||||
|
|
||||||
|
In reason of the Chill architecture, test should be runnable from the bundle's directory and works correctly: this will allow continuous integration tools to run tests automatically.
|
||||||
|
|
||||||
|
From chill app
|
||||||
|
==============
|
||||||
|
|
||||||
|
This is the most convenient method for developer: run test for chill bundle from the main app.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# run into a container
|
||||||
|
docker-compose exec --user $(id -u) php bash
|
||||||
|
# execute all tests suites
|
||||||
|
bin/phpunit
|
||||||
|
# .. or execute a single test
|
||||||
|
bin/phpunit vendor/chill-project/chill-bundles/src/Bundle/ChillMainBundle/Tests/path/to/FileTest.php
|
||||||
|
|
||||||
|
You can also run tests in a single command:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
docker-compose exec --user $(id -u) php bin/phpunit
|
||||||
|
|
||||||
|
|
||||||
|
Tests from a bundle (chill-bundles)
|
||||||
|
-----------------------------------
|
||||||
|
|
||||||
|
Those tests needs the whole symfony app to execute Application Tests (which test html page).
|
||||||
|
|
||||||
|
For ease, the app is cloned using a :code:`git submodule`, which clone the main app into :code:`tests/app`, and tests are bootstrapped to this app. The dependencies are also installed into `tests/app/vendor` to ensure compliance with relative path from this symfony application.
|
||||||
|
|
||||||
|
You may boostrap the tests fro the chill bundle this way:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# ensure to be located into the environement (provided by docker suits well)
|
||||||
|
docker-compose exec --user $(id -u) php bash
|
||||||
|
# go to chill subdirectory
|
||||||
|
cd vendor/chill-project/chill-bundles
|
||||||
|
# install submodule
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
# install composer and dependencies
|
||||||
|
curl -sS https://getcomposer.org/installer | php
|
||||||
|
# run tests
|
||||||
|
bin/phpunit
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If you are on a fresh install, you will need to migrate database schema.
|
||||||
|
|
||||||
|
The path to console tool must be adapted to the app. To load migration and add fixtures, one can execute the following commands:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
tests/app/bin/console doctrine:migrations:migrate
|
||||||
|
tests/app/bin/console doctrine:fixtures:load
|
||||||
|
|
38
phpunit.xml.dist
Normal file
38
phpunit.xml.dist
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
|
backupGlobals="false"
|
||||||
|
colors="true"
|
||||||
|
bootstrap="tests/app/tests/bootstrap.php"
|
||||||
|
>
|
||||||
|
<php>
|
||||||
|
<ini name="error_reporting" value="-1" />
|
||||||
|
<server name="APP_ENV" value="test" force="true" />
|
||||||
|
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||||
|
<server name="SHELL_VERBOSITY" value="-1" />
|
||||||
|
</php>
|
||||||
|
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="MainBundle">
|
||||||
|
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
|
||||||
|
</testsuite>
|
||||||
|
|
||||||
|
<testsuite name="PersonBundle">
|
||||||
|
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
|
||||||
|
</testsuite>
|
||||||
|
|
||||||
|
</testsuites>
|
||||||
|
|
||||||
|
<listeners>
|
||||||
|
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
|
||||||
|
</listeners>
|
||||||
|
|
||||||
|
<!-- Run `composer require symfony/panther` before enabling this extension -->
|
||||||
|
<!--
|
||||||
|
<extensions>
|
||||||
|
<extension class="Symfony\Component\Panther\ServerExtension" />
|
||||||
|
</extensions>
|
||||||
|
-->
|
||||||
|
</phpunit>
|
@ -34,7 +34,7 @@ trait PrepareClientTrait
|
|||||||
* @return \Symfony\Component\BrowserKit\Client
|
* @return \Symfony\Component\BrowserKit\Client
|
||||||
* @throws \LogicException
|
* @throws \LogicException
|
||||||
*/
|
*/
|
||||||
public function getClient(
|
public function getClientAuthenticated(
|
||||||
$username = 'center a_social',
|
$username = 'center a_social',
|
||||||
$password = 'password'
|
$password = 'password'
|
||||||
) {
|
) {
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Tests\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
|
|
||||||
class DefaultControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
public function testIndex()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -45,11 +45,6 @@ class ExportManagerTest extends KernelTestCase
|
|||||||
use \Chill\MainBundle\Test\PrepareUserTrait;
|
use \Chill\MainBundle\Test\PrepareUserTrait;
|
||||||
use \Chill\MainBundle\Test\PrepareScopeTrait;
|
use \Chill\MainBundle\Test\PrepareScopeTrait;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
|
||||||
*/
|
|
||||||
private $container;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -65,8 +60,6 @@ class ExportManagerTest extends KernelTestCase
|
|||||||
{
|
{
|
||||||
self::bootKernel();
|
self::bootKernel();
|
||||||
|
|
||||||
$this->container = self::$kernel->getContainer();
|
|
||||||
|
|
||||||
$this->prophet = new \Prophecy\Prophet;
|
$this->prophet = new \Prophecy\Prophet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +90,7 @@ class ExportManagerTest extends KernelTestCase
|
|||||||
\Symfony\Component\Security\Core\User\UserInterface $user = null
|
\Symfony\Component\Security\Core\User\UserInterface $user = null
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$localUser = $user === NULL ? $this->container->get('doctrine.orm.entity_manager')
|
$localUser = $user === NULL ? self::$container->get('doctrine.orm.entity_manager')
|
||||||
->getRepository('ChillMainBundle:User')
|
->getRepository('ChillMainBundle:User')
|
||||||
->findOneBy(array('username' => 'center a_social')) :
|
->findOneBy(array('username' => 'center a_social')) :
|
||||||
$user;
|
$user;
|
||||||
@ -106,10 +99,10 @@ class ExportManagerTest extends KernelTestCase
|
|||||||
$tokenStorage->setToken($token);
|
$tokenStorage->setToken($token);
|
||||||
|
|
||||||
return new ExportManager(
|
return new ExportManager(
|
||||||
$logger === NULL ? $this->container->get('logger') : $logger,
|
$logger === NULL ? self::$container->get('logger') : $logger,
|
||||||
$em === NULL ? $this->container->get('doctrine.orm.entity_manager') : $em,
|
$em === NULL ? self::$container->get('doctrine.orm.entity_manager') : $em,
|
||||||
$authorizationChecker === NULL ? $this->container->get('security.authorization_checker') : $authorizationChecker,
|
$authorizationChecker === NULL ? self::$container->get('security.authorization_checker') : $authorizationChecker,
|
||||||
$authorizationHelper === NULL ? $this->container->get('chill.main.security.authorization.helper') : $authorizationHelper,
|
$authorizationHelper === NULL ? self::$container->get('chill.main.security.authorization.helper') : $authorizationHelper,
|
||||||
$tokenStorage)
|
$tokenStorage)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -544,7 +537,7 @@ class ExportManagerTest extends KernelTestCase
|
|||||||
|
|
||||||
$export = $this->prophet->prophesize();
|
$export = $this->prophet->prophesize();
|
||||||
$export->willImplement(ExportInterface::class);
|
$export->willImplement(ExportInterface::class);
|
||||||
$em = $this->container->get('doctrine.orm.entity_manager');
|
$em = self::$container->get('doctrine.orm.entity_manager');
|
||||||
$export->initiateQuery(
|
$export->initiateQuery(
|
||||||
Argument::is(array('foo')),
|
Argument::is(array('foo')),
|
||||||
Argument::Type('array'),
|
Argument::Type('array'),
|
||||||
@ -627,7 +620,7 @@ class ExportManagerTest extends KernelTestCase
|
|||||||
|
|
||||||
//add formatter interface
|
//add formatter interface
|
||||||
$formatter = new \Chill\MainBundle\Export\Formatter\SpreadSheetFormatter(
|
$formatter = new \Chill\MainBundle\Export\Formatter\SpreadSheetFormatter(
|
||||||
$this->container->get('translator'), $exportManager);
|
self::$container->get('translator'), $exportManager);
|
||||||
$exportManager->addFormatter($formatter, 'spreadsheet');
|
$exportManager->addFormatter($formatter, 'spreadsheet');
|
||||||
|
|
||||||
//ob_start();
|
//ob_start();
|
||||||
|
@ -42,7 +42,37 @@ use Chill\MainBundle\Entity\User;
|
|||||||
*/
|
*/
|
||||||
class AccompanyingPeriod
|
class AccompanyingPeriod
|
||||||
{
|
{
|
||||||
const INTENSITY = ['occasional', 'regular'];
|
/**
|
||||||
|
* Mark an accompanying period as "occasional"
|
||||||
|
*
|
||||||
|
* used in INTENSITY
|
||||||
|
*/
|
||||||
|
public const INTENSITY_OCCASIONAL = 'occasional';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark an accompanying period as "regular"
|
||||||
|
*
|
||||||
|
* used in INTENSITY
|
||||||
|
*/
|
||||||
|
public const INTENSITY_REGULAR = 'regular';
|
||||||
|
|
||||||
|
public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark an accompanying period as "draft".
|
||||||
|
*
|
||||||
|
* This means that the accompanying period is not yet
|
||||||
|
* confirmed by the creator
|
||||||
|
*/
|
||||||
|
public const STEP_DRAFT = 'DRAFT';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark an accompanying period as "confirmed".
|
||||||
|
*
|
||||||
|
* This means that the accompanying period **is**
|
||||||
|
* confirmed by the creator
|
||||||
|
*/
|
||||||
|
public const STEP_CONFIRMED = 'CONFIRMED';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var integer
|
||||||
@ -117,7 +147,7 @@ class AccompanyingPeriod
|
|||||||
* @var string
|
* @var string
|
||||||
* @ORM\Column(type="string", length=32, nullable=true)
|
* @ORM\Column(type="string", length=32, nullable=true)
|
||||||
*/
|
*/
|
||||||
private $step = 'DRAFT';
|
private $step = self::STEP_DRAFT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=Origin::class)
|
* @ORM\ManyToOne(targetEntity=Origin::class)
|
||||||
|
@ -47,7 +47,7 @@ class ClosingMotive
|
|||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*
|
*
|
||||||
* @ORM\Column(type="json_array")
|
* @ORM\Column(type="json")
|
||||||
*/
|
*/
|
||||||
private $name;
|
private $name;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Origin
|
|||||||
private $id;
|
private $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="string", length=255)
|
* @ORM\Column(type="json")
|
||||||
*/
|
*/
|
||||||
private $label;
|
private $label;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class AccompanyingPeriodParticipation
|
|||||||
private $person;
|
private $person;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations")
|
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class, inversedBy="participations", cascade={"persist"})
|
||||||
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
|
* @ORM\JoinColumn(name="accompanyingperiod_id", referencedColumnName="id", nullable=false)
|
||||||
*/
|
*/
|
||||||
private $accompanyingPeriod;
|
private $accompanyingPeriod;
|
||||||
|
@ -123,7 +123,8 @@ class PersonType extends AbstractType
|
|||||||
'label' => false,
|
'label' => false,
|
||||||
'delete_empty' => function(PersonPhone $pp = null) {
|
'delete_empty' => function(PersonPhone $pp = null) {
|
||||||
return NULL === $pp || $pp->isEmpty();
|
return NULL === $pp || $pp->isEmpty();
|
||||||
}
|
},
|
||||||
|
'error_bubbling' => false
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($this->config['email'] === 'visible') {
|
if ($this->config['email'] === 'visible') {
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if form.otherPhoneNumbers is defined -%}
|
{%- if form.otherPhoneNumbers is defined -%}
|
||||||
{{ form_widget(form.otherPhoneNumbers) }}
|
{{ form_widget(form.otherPhoneNumbers) }}
|
||||||
|
{{ form_errors(form.otherPhoneNumbers) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if form.contactInfo is defined -%}
|
{%- if form.contactInfo is defined -%}
|
||||||
{{ form_row(form.contactInfo, {'label': 'Notes on contact information'}) }}
|
{{ form_row(form.contactInfo, {'label': 'Notes on contact information'}) }}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rename sequence "closing motive"
|
||||||
|
*/
|
||||||
|
final class Version20210419105054 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return 'rename sequence "closing motive"';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_closingmotive_id_seq RENAME TO '
|
||||||
|
. 'chill_person_accompanying_period_closingmotive_id_seq');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_closingmotive_id_seq '
|
||||||
|
. 'RENAME TO chill_person_closingmotive_id_seq');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set label for origin as json
|
||||||
|
*/
|
||||||
|
final class Version20210419105940 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return 'set label for origin as json';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||||
|
. 'ALTER label TYPE JSON USING json_build_object(\'fr\', label)::jsonb');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||||
|
. 'ALTER label DROP DEFAULT');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this will keep the '"' at first and last character, but is acceptable
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||||
|
. 'ALTER label TYPE VARCHAR(255) USING label->\'fr\'::text');
|
||||||
|
$this->addSql('ALTER TABLE chill_person_accompanying_period_origin '
|
||||||
|
. 'ALTER label DROP DEFAULT');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Person;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fix deprecated json array
|
||||||
|
*/
|
||||||
|
final class Version20210419112619 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return 'fix deprecated json_array';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_closingmotive.name IS NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
$this->addSql('COMMENT ON COLUMN chill_person_accompanying_period_closingmotive.name IS \'(DC2Type:json_array)\'');
|
||||||
|
}
|
||||||
|
}
|
@ -89,7 +89,7 @@ class LoadReports extends AbstractFixture implements OrderedFixtureInterface, Co
|
|||||||
{
|
{
|
||||||
$charline = $this->container->get('doctrine.orm.entity_manager')
|
$charline = $this->container->get('doctrine.orm.entity_manager')
|
||||||
->getRepository('ChillPersonBundle:Person')
|
->getRepository('ChillPersonBundle:Person')
|
||||||
->findOneBy(array('lastName' => 'Charline'))
|
->findOneBy(array('firstName' => 'Charline', 'lastName' => 'Depardieu'))
|
||||||
;
|
;
|
||||||
|
|
||||||
$report = (new Report())
|
$report = (new Report())
|
||||||
|
1
tests/app
Submodule
1
tests/app
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 5321a3a4506f8db0f143909be307ed068e15df9c
|
Loading…
x
Reference in New Issue
Block a user