upgraded FosUserBundle and Symfony 4.3 (#1005)

This commit is contained in:
Kevin Papst
2019-08-02 16:52:30 +02:00
committed by GitHub
parent 614a50ce0b
commit e11a2a6089
57 changed files with 1577 additions and 1184 deletions

View File

@@ -41,10 +41,19 @@ class CreateUserCommandTest extends KernelTestCase
));
}
public function testCreateUser()
public function testCreateUserFailsForShortPassword()
{
$commandTester = $this->createUser('MyTestUser', 'user@example.com', 'ROLE_USER', 'foobar');
$output = $commandTester->getDisplay();
$this->assertContains('[ERROR] plainPassword (foobar)', $output);
$this->assertContains('The password is too short.', $output);
}
public function testCreateUser()
{
$commandTester = $this->createUser('MyTestUser', 'user@example.com', 'ROLE_USER', 'foobar12');
$output = $commandTester->getDisplay();
$this->assertContains('[OK] Success! Created user: MyTestUser', $output);
@@ -69,7 +78,7 @@ class CreateUserCommandTest extends KernelTestCase
return $commandTester;
}
public function testUserWithValidationProblem()
public function testUserWithEmptyFieldsTriggersValidationProblem()
{
$commandTester = $this->createUser('xx', '', 'ROLE_USER', '');
$output = $commandTester->getDisplay();
@@ -81,7 +90,7 @@ class CreateUserCommandTest extends KernelTestCase
public function testUserAlreadyExisting()
{
$this->createUser('MyTestUser', 'user@example.com', 'ROLE_USER', 'foobar');
$this->createUser('MyTestUser', 'user@example.com', 'ROLE_USER', 'foobar12');
$commandTester = $this->createUser('MyTestUser', 'user@example.com', 'ROLE_USER', 'foobar');
$output = $commandTester->getDisplay();
@@ -91,7 +100,7 @@ class CreateUserCommandTest extends KernelTestCase
public function testUserEmail()
{
$commandTester = $this->createUser('MyTestUser', 'ROLE_USER', 'ROLE_USER', 'foobar');
$commandTester = $this->createUser('MyTestUser', 'ROLE_USER', 'ROLE_USER', 'foobar12');
$output = $commandTester->getDisplay();
$this->assertContains('[ERROR] email (ROLE_USER)', $output);

View File

@@ -220,8 +220,8 @@ class ProfileControllerTest extends ControllerBaseTest
$client->submit($form, [
'user_password' => [
'plainPassword' => [
'first' => 'test123',
'second' => 'test123',
'first' => 'test1234',
'second' => 'test1234',
]
]
]);
@@ -236,7 +236,7 @@ class ProfileControllerTest extends ControllerBaseTest
$user = $this->getUserByRole($em, User::ROLE_USER);
$this->assertFalse($passwordEncoder->getEncoder($user)->isPasswordValid($user->getPassword(), UserFixtures::DEFAULT_PASSWORD, $user->getSalt()));
$this->assertTrue($passwordEncoder->getEncoder($user)->isPasswordValid($user->getPassword(), 'test123', $user->getSalt()));
$this->assertTrue($passwordEncoder->getEncoder($user)->isPasswordValid($user->getPassword(), 'test1234', $user->getSalt()));
}
public function testApiTokenAction()

View File

@@ -85,8 +85,8 @@ class SecurityControllerTest extends ControllerBaseTest
'email' => 'test@example.com',
'username' => 'example',
'plainPassword' => [
'first' => 'test123',
'second' => 'test123',
'first' => 'test1234',
'second' => 'test1234',
],
]
]);

View File

@@ -1,33 +0,0 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Event;
use App\Event\ConfigureAdminMenuEvent;
use KevinPapst\AdminLTEBundle\Model\MenuItemModel;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
/**
* @covers \App\Event\ConfigureAdminMenuEvent
*/
class ConfigureAdminMenuEventTest extends TestCase
{
public function testGetterAndSetter()
{
$request = new Request();
$request->setLocale('de');
$admin = new MenuItemModel('admin', 'foo', 'bar');
$sut = new ConfigureAdminMenuEvent($request, $admin);
$this->assertEquals($request, $sut->getRequest());
$this->assertEquals($admin, $sut->getAdminMenu());
}
}

View File

@@ -10,3 +10,4 @@ parameters:
- '#Access to an undefined property Faker\\Generator::\$bs.#'
excludes_analyse:
- %rootDir%/../../../tests/Ldap/LdapDriverTest.php
inferPrivatePropertyTypeFromConstructor: true