fix capitalization

This commit is contained in:
Julien Fastré 2021-10-14 14:40:36 +02:00
parent 0497625e90
commit 5f026068e1

View File

@ -30,38 +30,38 @@ class PersonControllerViewTest extends WebTestCase
{ {
/** @var \Doctrine\ORM\EntityManagerInterface The entity manager */ /** @var \Doctrine\ORM\EntityManagerInterface The entity manager */
private $em; 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; private $person;
/** @var String The url to view the person details */ /** @var String The url to view the person details */
private $viewUrl; private $viewUrl;
public function setUp() public function setUp()
{ {
static::bootKernel(); static::bootKernel();
$this->em = static::$kernel->getContainer() $this->em = static::$kernel->getContainer()
->get('doctrine.orm.entity_manager'); ->get('doctrine.orm.entity_manager');
$center = $this->em->getRepository('ChillMainBundle:Center') $center = $this->em->getRepository('ChillMainBundle:Center')
->findOneBy(array('name' => 'Center A')); ->findOneBy(array('name' => 'Center A'));
$this->person = (new Person()) $this->person = (new Person())
->setLastName("Tested Person") ->setLastName("Tested Person")
->setFirstName("Réginald") ->setFirstName("Réginald")
->setCenter($center) ->setCenter($center)
->setGender(Person::MALE_GENDER); ->setGender(Person::MALE_GENDER);
$this->em->persist($this->person); $this->em->persist($this->person);
$this->em->flush(); $this->em->flush();
$this->viewUrl = '/en/person/'.$this->person->getId().'/general'; $this->viewUrl = '/en/person/'.$this->person->getId().'/general';
} }
/** /**
* Test if the view page is accessible * Test if the view page is accessible
* *
* @group configurable_fields * @group configurable_fields
*/ */
public function testViewPerson() public function testViewPerson()
@ -70,20 +70,20 @@ class PersonControllerViewTest extends WebTestCase
'PHP_AUTH_USER' => 'center a_social', 'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password', 'PHP_AUTH_PW' => 'password',
)); ));
$crawler = $client->request('GET', $this->viewUrl); $crawler = $client->request('GET', $this->viewUrl);
$response = $client->getResponse(); $response = $client->getResponse();
$this->assertTrue($response->isSuccessful()); $this->assertTrue($response->isSuccessful());
$this->assertGreaterThan(0, $crawler->filter('html:contains("Tested Person")')->count()); $this->assertGreaterThan(0, $crawler->filter('html:contains("TESTED PERSON")')->count());
$this->assertGreaterThan(0, $crawler->filter('html:contains("Réginald")')->count()); $this->assertGreaterThan(0, $crawler->filter('html:contains("Réginald")')->count());
$this->assertContains('Email addresses', $crawler->text()); $this->assertContains('Email addresses', $crawler->text());
$this->assertContains('Phonenumber', $crawler->text()); $this->assertContains('Phonenumber', $crawler->text());
$this->assertContains('Langues parlées', $crawler->text()); $this->assertContains('Langues parlées', $crawler->text());
$this->assertContains(/* Etat */ 'civil', $crawler->text()); $this->assertContains(/* Etat */ 'civil', $crawler->text());
} }
/** /**
* Test if the view page of a given person is not accessible for a user * 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
@ -94,26 +94,26 @@ class PersonControllerViewTest extends WebTestCase
'PHP_AUTH_USER' => 'center b_social', 'PHP_AUTH_USER' => 'center b_social',
'PHP_AUTH_PW' => 'password', 'PHP_AUTH_PW' => 'password',
)); ));
$client->request('GET', $this->viewUrl); $client->request('GET', $this->viewUrl);
$this->assertEquals(403, $client->getResponse()->getStatusCode(), $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"); "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() protected function refreshPerson()
{ {
$this->person = $this->em->getRepository('ChillPersonBundle:Person') $this->person = $this->em->getRepository('ChillPersonBundle:Person')
->find($this->person->getId()); ->find($this->person->getId());
} }
public function tearDown() public function tearDown()
{ {
$this->refreshPerson(); $this->refreshPerson();
$this->em->remove($this->person); $this->em->remove($this->person);
$this->em->flush(); $this->em->flush();
} }
} }