cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,40 +1,36 @@
<?php
/*
* Copyright (C) 2015 Julien Fastré <julien.fastre@champs-libres.coop>
/**
* Chill is a software for social workers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Chill\PersonBundle\Entity\Person;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
* @author Julien Fastré <julien.fastre@champs-libres.coop>
* @author Marc Ducobu <marc.ducobu@champs-libres.coop>
* @internal
* @coversNothing
*/
class PersonControllerViewTest extends WebTestCase
{
/** @var \Doctrine\ORM\EntityManagerInterface The entity manager */
/**
* @var \Doctrine\ORM\EntityManagerInterface The entity manager
*/
private $em;
/** @var Person A person used on which to run the test */
/**
* @var Person A person used on which to run the test
*/
private $person;
/** @var String The url to view the person details */
/**
* @var string The url to view the person details
*/
private $viewUrl;
public function setUp()
@@ -45,31 +41,38 @@ class PersonControllerViewTest extends WebTestCase
->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center')
->findOneBy(array('name' => 'Center A'));
->findOneBy(['name' => 'Center A']);
$this->person = (new Person())
->setLastName("Tested Person")
->setFirstName("Réginald")
->setLastName('Tested Person')
->setFirstName('Réginald')
->setCenter($center)
->setGender(Person::MALE_GENDER);
$this->em->persist($this->person);
$this->em->flush();
$this->viewUrl = '/en/person/'.$this->person->getId().'/general';
$this->viewUrl = '/en/person/' . $this->person->getId() . '/general';
}
public function tearDown()
{
$this->refreshPerson();
$this->em->remove($this->person);
$this->em->flush();
}
/**
* Test if the view page is accessible
* Test if the view page is accessible.
*
* @group configurable_fields
*/
public function testViewPerson()
{
$client = static::createClient(array(), array(
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
));
$client = static::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
]);
$crawler = $client->request('GET', $this->viewUrl);
$response = $client->getResponse();
@@ -86,34 +89,29 @@ class PersonControllerViewTest extends WebTestCase
/**
* Test if the view page of a given person is not accessible for a user
* of another center of the person
* of another center of the person.
*/
public function testViewPersonAccessDeniedForUnauthorized()
{
$client = static::createClient(array(), array(
'PHP_AUTH_USER' => 'center b_social',
'PHP_AUTH_PW' => 'password',
));
$client = static::createClient([], [
'PHP_AUTH_USER' => 'center b_social',
'PHP_AUTH_PW' => 'password',
]);
$client->request('GET', $this->viewUrl);
$this->assertEquals(403, $client->getResponse()->getStatusCode(),
"The view page of a person of a center A must not be accessible for user of center B");
$this->assertEquals(
403,
$client->getResponse()->getStatusCode(),
'The view page of a person of a center A must not be accessible for user of center B'
);
}
/**
* Reload the person from the db
* Reload the person from the db.
*/
protected function refreshPerson()
{
$this->person = $this->em->getRepository('ChillPersonBundle:Person')
->find($this->person->getId());
}
public function tearDown()
{
$this->refreshPerson();
$this->em->remove($this->person);
$this->em->flush();
}
}