mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
Merge branch 'master' into 1.0
Conflicts: Resources/public/css/scratch.css.map
This commit is contained in:
commit
09099b0566
@ -12,7 +12,9 @@ before_script:
|
||||
|
||||
test:php-5.6:
|
||||
stage: test
|
||||
image: chill/ci-image:php-5.6
|
||||
script: phpunit --testdox
|
||||
test:php-7:
|
||||
stage: test
|
||||
script: phpunit --testdox
|
||||
image: chill/ci-image:php-7
|
||||
script: phpunit --testdox
|
||||
|
@ -354,7 +354,15 @@ class UserController extends Controller
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isValid()) {
|
||||
$password = $editForm->getData();
|
||||
$password = $editForm->getData()->getPassword();
|
||||
|
||||
// logging for debug !! WARNING print the new password !!
|
||||
$this->get('logger')->debug('update password for an user',
|
||||
array('method' => __METHOD__, 'password' => $password,
|
||||
'user' => $user->getUsername()));
|
||||
// logging for prod
|
||||
$this->get('logger')->info('update password for an user',
|
||||
array('method' => __METHOD__, 'user' => $user->getUsername()));
|
||||
|
||||
$user->setPassword($this->get('security.password_encoder')
|
||||
->encodePassword($user, $password));
|
||||
|
@ -5626,10 +5626,11 @@ div.input_with_post_text {
|
||||
align-items: center; }
|
||||
|
||||
@media -sass-debug-info{filename{font-family:file\:\/\/\/media\/ssd2\/julien\/dev\/chill-dev\/vendor\/chill-project\/main\/Resources\/public\/sass\/_custom\.scss}line{font-family:\00003139}}
|
||||
div.input_with_post_text span {
|
||||
flex: 1; }
|
||||
div.input_with_post_text span.post_text {
|
||||
flex: 1;
|
||||
margin-left: 0.5em; }
|
||||
|
||||
@media -sass-debug-info{filename{font-family:file\:\/\/\/media\/ssd2\/julien\/dev\/chill-dev\/vendor\/chill-project\/main\/Resources\/public\/sass\/_custom\.scss}line{font-family:\00003142}}
|
||||
@media -sass-debug-info{filename{font-family:file\:\/\/\/media\/ssd2\/julien\/dev\/chill-dev\/vendor\/chill-project\/main\/Resources\/public\/sass\/_custom\.scss}line{font-family:\00003143}}
|
||||
div.input_with_post_text input {
|
||||
width: 70%;
|
||||
display: inline-block;
|
||||
|
File diff suppressed because one or more lines are too long
@ -136,8 +136,9 @@ div.input_with_post_text {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div.input_with_post_text span {
|
||||
div.input_with_post_text span.post_text {
|
||||
flex: 1;
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
div.input_with_post_text input {
|
||||
width: 70%;
|
||||
|
@ -18,6 +18,10 @@ Export Menu: Export
|
||||
Admin Menu: Menu d'administration
|
||||
Details: Détails
|
||||
|
||||
Edit: Modifier
|
||||
Update: Mettre à jour
|
||||
Back to the list: Retour à la liste
|
||||
|
||||
#serach
|
||||
Your search is empty. Please provide search terms.: La recherche est vide. Merci de fournir des termes de recherche.
|
||||
The domain %domain% is unknow. Please check your search.: Le domaine de recherche "%domain%" est inconnu. Merci de vérifier votre recherche.
|
||||
@ -85,6 +89,7 @@ The permissions have been added: Les permissions ont été ajoutées
|
||||
Edit password for %username%: Éditer le mot de passe de %username%
|
||||
Change password: Changer le mot de passe
|
||||
Back to the user edition: Retour au formulaire d'édition
|
||||
Password successfully updated!: Mot de passe mis à jour
|
||||
|
||||
#admin section for circles (old: scopes)
|
||||
List circles: Liste des cercles
|
||||
|
@ -12,6 +12,7 @@ class CenterControllerTest extends WebTestCase
|
||||
$client = static::createClient(array(), array(
|
||||
'PHP_AUTH_USER' => 'admin',
|
||||
'PHP_AUTH_PW' => 'password',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR'
|
||||
));
|
||||
|
||||
// Create a new entry in the database
|
||||
@ -34,9 +35,9 @@ class CenterControllerTest extends WebTestCase
|
||||
'Missing element td:contains("Test center")');
|
||||
|
||||
// Edit the entity
|
||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
||||
$crawler = $client->click($crawler->selectLink('Modifier')->link());
|
||||
|
||||
$form = $crawler->selectButton('Update')->form(array(
|
||||
$form = $crawler->selectButton('Mettre à jour')->form(array(
|
||||
'chill_mainbundle_center[name]' => 'Foo',
|
||||
));
|
||||
|
||||
|
@ -12,6 +12,7 @@ class ScopeControllerTest extends WebTestCase
|
||||
$client = static::createClient(array(), array(
|
||||
'PHP_AUTH_USER' => 'admin',
|
||||
'PHP_AUTH_PW' => 'password',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR'
|
||||
));
|
||||
|
||||
// Create a new entry in the database
|
||||
@ -41,9 +42,9 @@ class ScopeControllerTest extends WebTestCase
|
||||
'Missing element td:contains("Test en fr")');
|
||||
|
||||
// Edit the entity
|
||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
||||
$crawler = $client->click($crawler->selectLink('Modifier')->link());
|
||||
|
||||
$form = $crawler->selectButton('Update')->form(array(
|
||||
$form = $crawler->selectButton('Mettre à jour')->form(array(
|
||||
'chill_mainbundle_scope[name][fr]' => 'Foo',
|
||||
'chill_mainbundle_scope[name][en]' => 'Foo en',
|
||||
));
|
||||
|
@ -6,54 +6,131 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class UserControllerTest extends WebTestCase
|
||||
{
|
||||
public function testBlank()
|
||||
private $client;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
self::bootKernel();
|
||||
|
||||
$this->client = static::createClient(array(), array(
|
||||
'PHP_AUTH_USER' => 'admin',
|
||||
'PHP_AUTH_PW' => 'password',
|
||||
'HTTP_ACCEPT_LANGUAGE' => 'fr_FR'
|
||||
));
|
||||
}
|
||||
/*
|
||||
public function testCompleteScenario()
|
||||
|
||||
public function testList()
|
||||
{
|
||||
// Create a new client to browse the application
|
||||
$client = static::createClient();
|
||||
|
||||
// Create a new entry in the database
|
||||
$crawler = $client->request('GET', '/admin/user/');
|
||||
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /admin/user/");
|
||||
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
|
||||
|
||||
// get the list
|
||||
$crawler = $this->client->request('GET', '/fr/admin/user/');
|
||||
$this->assertEquals(200, $this->client->getResponse()->getStatusCode(),
|
||||
"Unexpected HTTP status code for GET /admin/user/");
|
||||
|
||||
$link = $crawler->selectLink('Ajouter un nouvel utilisateur')->link();
|
||||
$this->assertInstanceOf('Symfony\Component\DomCrawler\Link', $link);
|
||||
$this->assertRegExp('|/fr/admin/user/new$|', $link->getUri());
|
||||
}
|
||||
|
||||
public function testNew()
|
||||
{
|
||||
$crawler = $this->client->request('GET', '/fr/admin/user/new');
|
||||
|
||||
$username = 'Test_user'. uniqid();
|
||||
$password = 'Password1234!';
|
||||
// Fill in the form and submit it
|
||||
$form = $crawler->selectButton('Create')->form(array(
|
||||
'chill_mainbundle_user[field_name]' => 'Test',
|
||||
// ... other fields to fill
|
||||
$form = $crawler->selectButton('Créer')->form(array(
|
||||
'chill_mainbundle_user[username]' => $username,
|
||||
'chill_mainbundle_user[plainPassword][password][first]' => $password,
|
||||
'chill_mainbundle_user[plainPassword][password][second]' => $password
|
||||
));
|
||||
|
||||
$client->submit($form);
|
||||
$crawler = $client->followRedirect();
|
||||
$this->client->submit($form);
|
||||
$crawler = $this->client->followRedirect();
|
||||
|
||||
// Check data in the show view
|
||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
|
||||
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test_user")')->count(),
|
||||
'Missing element td:contains("Test user")');
|
||||
|
||||
$update = $crawler->selectLink('Modifier')->link();
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\DomCrawler\Link', $update);
|
||||
$this->assertRegExp('|/fr/admin/user/[0-9]{1,}/edit$|', $update->getUri());
|
||||
|
||||
//test the auth of the new client
|
||||
$this->isPasswordValid($username, $password);
|
||||
|
||||
return $update;
|
||||
}
|
||||
|
||||
protected function isPasswordValid($username, $password)
|
||||
{
|
||||
/* @var $passwordEncoder \Symfony\Component\Security\Core\Encoder\UserPasswordEncoder */
|
||||
$passwordEncoder = self::$kernel->getContainer()
|
||||
->get('security.password_encoder');
|
||||
|
||||
$user = self::$kernel->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->getRepository('ChillMainBundle:User')
|
||||
->findOneBy(array('username' => $username));
|
||||
|
||||
$this->assertTrue($passwordEncoder->isPasswordValid($user, $password));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Symfony\Component\DomCrawler\Link $update
|
||||
* @depends testNew
|
||||
*/
|
||||
public function testUpdate(\Symfony\Component\DomCrawler\Link $update)
|
||||
{
|
||||
$crawler = $this->client->click($update);
|
||||
|
||||
// Edit the entity
|
||||
$crawler = $client->click($crawler->selectLink('Edit')->link());
|
||||
|
||||
$form = $crawler->selectButton('Update')->form(array(
|
||||
'chill_mainbundle_user[field_name]' => 'Foo',
|
||||
// ... other fields to fill
|
||||
$username = 'Foo bar '.uniqid();
|
||||
$form = $crawler->selectButton('Mettre à jour')->form(array(
|
||||
'chill_mainbundle_user[username]' => $username,
|
||||
));
|
||||
|
||||
$client->submit($form);
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
|
||||
$this->client->submit($form);
|
||||
$crawler = $this->client->followRedirect();
|
||||
// Check the element contains an attribute with value equals "Foo"
|
||||
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
|
||||
|
||||
// Delete the entity
|
||||
$client->submit($crawler->selectButton('Delete')->form());
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
// Check the entity has been delete on the list
|
||||
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
|
||||
$this->assertGreaterThan(0, $crawler->filter('[value="'.$username.'"]')->count(),
|
||||
'Missing element [value="Foo bar"]');
|
||||
|
||||
$updatePassword = $crawler->selectLink('Modifier le mot de passe')->link();
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\DomCrawler\Link', $updatePassword);
|
||||
$this->assertRegExp('|/fr/admin/user/[0-9]{1,}/edit_password$|',
|
||||
$updatePassword->getUri());
|
||||
|
||||
return array('link' => $updatePassword, 'username' => $username);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Symfony\Component\DomCrawler\Link $updatePassword
|
||||
* @depends testUpdate
|
||||
*/
|
||||
public function testUpdatePassword(array $params)
|
||||
{
|
||||
$link = $params['link'];
|
||||
$username = $params['username'];
|
||||
$newPassword = '1234Password!';
|
||||
|
||||
$crawler = $this->client->click($link);
|
||||
|
||||
$form = $crawler->selectButton('Changer le mot de passe')->form(array(
|
||||
'chill_mainbundle_user_password[password][first]' => $newPassword,
|
||||
'chill_mainbundle_user_password[password][second]' => $newPassword,
|
||||
));
|
||||
|
||||
$this->client->submit($form);
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect(),
|
||||
"the response is a redirection");
|
||||
$this->client->followRedirect();
|
||||
|
||||
$this->isPasswordValid($username, $newPassword);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
|
@ -22,11 +22,11 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "~5.5",
|
||||
"php": "~5.5|~7.0",
|
||||
"twig/extensions": "~1.0",
|
||||
"symfony/assetic-bundle": "~2.3",
|
||||
"symfony/monolog-bundle": "~2.4",
|
||||
"symfony/framework-bundle": "~2.7",
|
||||
"symfony/framework-bundle": "~2.8",
|
||||
"symfony/yaml": "~2.7",
|
||||
"symfony/symfony": "~2.7",
|
||||
"doctrine/dbal": "~2.5",
|
||||
|
Loading…
x
Reference in New Issue
Block a user