random improvements (#5506)
* fix order of destroying form elements * API documentation - fixes #1949 * make command path independent * use PhpSubprocess to execute migrations * allow to configure optional SAML attributes * fix deprecation * unify wording of exported state - fixes #5392
This commit is contained in:
@@ -40,9 +40,10 @@ class PluginCommandTest extends KernelTestCase
|
||||
|
||||
private function getCommandTester(array $plugins, array $options = []): CommandTester
|
||||
{
|
||||
$projectDirectory = __DIR__ . '/../../';
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$this->application->add(new PluginCommand(new PluginManager($plugins), new PackageManager(__DIR__ . '/../../')));
|
||||
$this->application->add(new PluginCommand(new PluginManager($plugins), new PackageManager($projectDirectory), $projectDirectory));
|
||||
|
||||
$command = $this->application->find('kimai:plugins');
|
||||
$commandTester = new CommandTester($command);
|
||||
|
||||
@@ -23,7 +23,7 @@ class ResetDevelopmentCommandTest extends KernelTestCase
|
||||
{
|
||||
$kernel = self::bootKernel();
|
||||
$application = new Application($kernel);
|
||||
$application->add(new ResetDevelopmentCommand('dev'));
|
||||
$application->add(new ResetDevelopmentCommand('dev', __DIR__ . '/../../'));
|
||||
|
||||
self::assertTrue($application->has('kimai:reset:dev'));
|
||||
$command = $application->find('kimai:reset:dev');
|
||||
@@ -32,7 +32,7 @@ class ResetDevelopmentCommandTest extends KernelTestCase
|
||||
|
||||
public function testCommandNameIsNotEnabledInProd(): void
|
||||
{
|
||||
$sut = new ResetDevelopmentCommand('prod');
|
||||
$sut = new ResetDevelopmentCommand('prod', __DIR__ . '/../../');
|
||||
self::assertFalse($sut->isEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,4 +122,36 @@ class SamlProviderTest extends TestCase
|
||||
$sut = $this->getSamlProvider(null, $user);
|
||||
$sut->findUser($token);
|
||||
}
|
||||
|
||||
public function testAuthenticateNotThrowsOnOptionalAttribute(): void
|
||||
{
|
||||
$mapping = [
|
||||
'mapping' => [
|
||||
['saml' => '$Chicken', 'kimai' => 'alias'],
|
||||
['saml' => '$$Email', 'kimai' => 'title'],
|
||||
],
|
||||
'roles' => [
|
||||
'attribute' => '',
|
||||
'mapping' => []
|
||||
]
|
||||
];
|
||||
|
||||
$user = new User();
|
||||
$user->setAuth(User::AUTH_SAML);
|
||||
$user->setUserIdentifier('foo1@example.com');
|
||||
$user->setTitle('I will not be overwritten');
|
||||
|
||||
$token = new SamlLoginAttributes();
|
||||
$token->setUserIdentifier($user->getUserIdentifier());
|
||||
$token->setAttributes([
|
||||
'Chicken' => ['foo@example.com'],
|
||||
]);
|
||||
|
||||
$sut = $this->getSamlProvider($mapping, $user);
|
||||
$tokenUser = $sut->findUser($token);
|
||||
self::assertSame($user, $tokenUser);
|
||||
self::assertTrue($tokenUser->isSamlUser());
|
||||
self::assertEquals('foo@example.com', $tokenUser->getAlias());
|
||||
self::assertEquals('I will not be overwritten', $tokenUser->getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user