Merge branch 'master' into features/activity-model

This commit is contained in:
Jean-Francois Monfort
2021-04-22 16:13:05 +02:00
27 changed files with 414 additions and 450 deletions

View File

@@ -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'
) {

View File

@@ -1,13 +0,0 @@
<?php
namespace Chill\MainBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
}
}

View File

@@ -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();

View File

@@ -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)

View File

@@ -47,7 +47,7 @@ class ClosingMotive
/**
* @var array
*
* @ORM\Column(type="json_array")
* @ORM\Column(type="json")
*/
private $name;

View File

@@ -39,7 +39,7 @@ class Origin
private $id;
/**
* @ORM\Column(type="string", length=255)
* @ORM\Column(type="json")
*/
private $label;

View File

@@ -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;

View File

@@ -123,7 +123,8 @@ class PersonType extends AbstractType
'label' => false,
'delete_empty' => function(PersonPhone $pp = null) {
return NULL === $pp || $pp->isEmpty();
}
},
'error_bubbling' => false
]);
if ($this->config['email'] === 'visible') {

View File

@@ -85,6 +85,7 @@
{%- endif -%}
{%- if form.otherPhoneNumbers is defined -%}
{{ form_widget(form.otherPhoneNumbers) }}
{{ form_errors(form.otherPhoneNumbers) }}
{%- endif -%}
{%- if form.contactInfo is defined -%}
{{ form_row(form.contactInfo, {'label': 'Notes on contact information'}) }}

View File

@@ -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');
}
}

View File

@@ -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');
}
}

View File

@@ -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)\'');
}
}

View File

@@ -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())