mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-10 00:34:58 +00:00
Compare commits
16 Commits
vue3-test0
...
bootstrap-
Author | SHA1 | Date | |
---|---|---|---|
afa04f3599 | |||
d765eecb8e | |||
82daf1e3af | |||
7719447044 | |||
23892043a5 | |||
d7bc93580f | |||
a7e4900690 | |||
e98a5b88aa | |||
1b42656e0f | |||
e9674dd334 | |||
0fcec73a62 | |||
9539214d24 | |||
c5b4a44ff3 | |||
b7d6d29fac | |||
51e9b1fcf2 | |||
b490f4a82c |
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
|
16
.gitignore
vendored
16
.gitignore
vendored
@@ -1,3 +1,19 @@
|
||||
.composer/*
|
||||
composer.phar
|
||||
|
||||
|
||||
###> 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"]
|
||||
path = _exts/sphinx-php
|
||||
url = https://github.com/fabpot/sphinx-php.git
|
||||
[submodule "tests/app"]
|
||||
path = tests/app
|
||||
url = https://gitlab.com/Chill-projet/chill-app.git
|
||||
|
@@ -19,10 +19,14 @@
|
||||
"Chill\\ThirdPartyBundle\\": "src/Bundle/ChillThirdPartyBundle"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\": "tests/app/src/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"champs-libres/async-uploader-bundle": "dev-sf4",
|
||||
"graylog2/gelf-php": "^1.5",
|
||||
"symfony/flex": "^1.9",
|
||||
"symfony/form": "4.*",
|
||||
"symfony/twig-bundle": "^4.4",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
@@ -66,6 +70,17 @@
|
||||
"symfony/stopwatch": "^5.1",
|
||||
"symfony/web-profiler-bundle": "^5.0",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
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
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function getClient(
|
||||
public function getClientAuthenticated(
|
||||
$username = 'center a_social',
|
||||
$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\PrepareScopeTrait;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -65,8 +60,6 @@ class ExportManagerTest extends KernelTestCase
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->container = self::$kernel->getContainer();
|
||||
|
||||
$this->prophet = new \Prophecy\Prophet;
|
||||
}
|
||||
|
||||
@@ -97,7 +90,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
\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')
|
||||
->findOneBy(array('username' => 'center a_social')) :
|
||||
$user;
|
||||
@@ -106,10 +99,10 @@ class ExportManagerTest extends KernelTestCase
|
||||
$tokenStorage->setToken($token);
|
||||
|
||||
return new ExportManager(
|
||||
$logger === NULL ? $this->container->get('logger') : $logger,
|
||||
$em === NULL ? $this->container->get('doctrine.orm.entity_manager') : $em,
|
||||
$authorizationChecker === NULL ? $this->container->get('security.authorization_checker') : $authorizationChecker,
|
||||
$authorizationHelper === NULL ? $this->container->get('chill.main.security.authorization.helper') : $authorizationHelper,
|
||||
$logger === NULL ? self::$container->get('logger') : $logger,
|
||||
$em === NULL ? self::$container->get('doctrine.orm.entity_manager') : $em,
|
||||
$authorizationChecker === NULL ? self::$container->get('security.authorization_checker') : $authorizationChecker,
|
||||
$authorizationHelper === NULL ? self::$container->get('chill.main.security.authorization.helper') : $authorizationHelper,
|
||||
$tokenStorage)
|
||||
;
|
||||
}
|
||||
@@ -544,7 +537,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
|
||||
$export = $this->prophet->prophesize();
|
||||
$export->willImplement(ExportInterface::class);
|
||||
$em = $this->container->get('doctrine.orm.entity_manager');
|
||||
$em = self::$container->get('doctrine.orm.entity_manager');
|
||||
$export->initiateQuery(
|
||||
Argument::is(array('foo')),
|
||||
Argument::Type('array'),
|
||||
@@ -627,7 +620,7 @@ class ExportManagerTest extends KernelTestCase
|
||||
|
||||
//add formatter interface
|
||||
$formatter = new \Chill\MainBundle\Export\Formatter\SpreadSheetFormatter(
|
||||
$this->container->get('translator'), $exportManager);
|
||||
self::$container->get('translator'), $exportManager);
|
||||
$exportManager->addFormatter($formatter, 'spreadsheet');
|
||||
|
||||
//ob_start();
|
||||
|
@@ -42,7 +42,37 @@ use Chill\MainBundle\Entity\User;
|
||||
*/
|
||||
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
|
||||
@@ -117,7 +147,7 @@ class AccompanyingPeriod
|
||||
* @var string
|
||||
* @ORM\Column(type="string", length=32, nullable=true)
|
||||
*/
|
||||
private $step = 'DRAFT';
|
||||
private $step = self::STEP_DRAFT;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=Origin::class)
|
||||
|
@@ -47,7 +47,7 @@ class ClosingMotive
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @ORM\Column(type="json_array")
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class Origin
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255)
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
private $label;
|
||||
|
||||
|
@@ -50,7 +50,7 @@ class AccompanyingPeriodParticipation
|
||||
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)
|
||||
*/
|
||||
private $accompanyingPeriod;
|
||||
|
@@ -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')
|
||||
->getRepository('ChillPersonBundle:Person')
|
||||
->findOneBy(array('lastName' => 'Charline'))
|
||||
->findOneBy(array('firstName' => 'Charline', 'lastName' => 'Depardieu'))
|
||||
;
|
||||
|
||||
$report = (new Report())
|
||||
|
1
tests/app
Submodule
1
tests/app
Submodule
Submodule tests/app added at 88bd6e9ea0
Reference in New Issue
Block a user