LDAP authentication support (#815)
This commit is contained in:
52
tests/Configuration/LdapConfigurationTest.php
Normal file
52
tests/Configuration/LdapConfigurationTest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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\Configuration;
|
||||
|
||||
use App\Configuration\LdapConfiguration;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Configuration\LdapConfiguration
|
||||
*/
|
||||
class LdapConfigurationTest extends TestCase
|
||||
{
|
||||
protected function getSut(array $settings)
|
||||
{
|
||||
return new LdapConfiguration($settings);
|
||||
}
|
||||
|
||||
protected function getDefaultSettings()
|
||||
{
|
||||
return [
|
||||
'active' => true,
|
||||
'connection' => [
|
||||
'host' => '1.2.3.4',
|
||||
],
|
||||
'user' => [
|
||||
'foo' => 'bar',
|
||||
],
|
||||
'role' => [
|
||||
'bar' => 'foo',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function testMapping()
|
||||
{
|
||||
$sut = $this->getSut($this->getDefaultSettings());
|
||||
$this->assertTrue($sut->isActivated());
|
||||
$this->assertEquals(['foo' => 'bar'], $sut->getUserParameters());
|
||||
$this->assertEquals(['bar' => 'foo'], $sut->getRoleParameters());
|
||||
$this->assertEquals(['host' => '1.2.3.4'], $sut->getConnectionParameters());
|
||||
|
||||
$sut = $this->getSut(['active' => false]);
|
||||
$this->assertFalse($sut->isActivated());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user