mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,30 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class ScopeControllerTest extends WebTestCase
|
||||
{
|
||||
public function testCompleteScenario()
|
||||
{
|
||||
// Create a new client to browse the application
|
||||
$client = static::createClient(array(), array(
|
||||
'PHP_AUTH_USER' => 'admin',
|
||||
'PHP_AUTH_PW' => 'password',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR'
|
||||
));
|
||||
$client = static::createClient([], [
|
||||
'PHP_AUTH_USER' => 'admin',
|
||||
'PHP_AUTH_PW' => 'password',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR',
|
||||
]);
|
||||
|
||||
// Create a new entry in the database
|
||||
$crawler = $client->request('GET', '/fr/admin/scope/');
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(),
|
||||
"Unexpected HTTP status code for GET /fr/admin/scope/");
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$client->getResponse()->getStatusCode(),
|
||||
'Unexpected HTTP status code for GET /fr/admin/scope/'
|
||||
);
|
||||
$crawler = $client->click($crawler->selectLink('Créer un nouveau cercle')->link());
|
||||
// Fill in the form and submit it
|
||||
$form = $crawler->selectButton('Créer')->form(array(
|
||||
'chill_mainbundle_scope[name][fr]' => 'Test en fr',
|
||||
'chill_mainbundle_scope[name][en]' => 'Test en en'
|
||||
));
|
||||
$form = $crawler->selectButton('Créer')->form([
|
||||
'chill_mainbundle_scope[name][fr]' => 'Test en fr',
|
||||
'chill_mainbundle_scope[name][en]' => 'Test en en',
|
||||
]);
|
||||
|
||||
$client->submit($form/*, array(
|
||||
'chill_mainbundle_scope' => array(
|
||||
@@ -36,25 +50,26 @@ class ScopeControllerTest extends WebTestCase
|
||||
)
|
||||
)*/);
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
|
||||
// Check data in the show view
|
||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test en fr")')->count(),
|
||||
'Missing element td:contains("Test en fr")');
|
||||
$this->assertGreaterThan(
|
||||
0,
|
||||
$crawler->filter('td:contains("Test en fr")')->count(),
|
||||
'Missing element td:contains("Test en fr")'
|
||||
);
|
||||
|
||||
// Edit the entity
|
||||
$crawler = $client->click($crawler->selectLink('Modifier')->link());
|
||||
|
||||
$form = $crawler->selectButton('Mettre à jour')->form(array(
|
||||
'chill_mainbundle_scope[name][fr]' => 'Foo',
|
||||
'chill_mainbundle_scope[name][en]' => 'Foo en',
|
||||
));
|
||||
|
||||
$form = $crawler->selectButton('Mettre à jour')->form([
|
||||
'chill_mainbundle_scope[name][fr]' => 'Foo',
|
||||
'chill_mainbundle_scope[name][en]' => 'Foo en',
|
||||
]);
|
||||
|
||||
$client->submit($form);
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
// Check the element contains an attribute with value equals "Foo"
|
||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user