-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connexion via LDAP : 1. Préparation (#49)
* Création du collecteur de configuration * TDD factory service auth * Test AuthController * Avec les bonnes classes... * No more testable AuthenticationController * TDD authentification interne * Combler le défaut de sécurité sur la vacuité d'une clé * 100% CC InterneAuthentifier * Ménage
- Loading branch information
1 parent
2c98685
commit afc8424
Showing
24 changed files
with
498 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,6 @@ minor: | |
|
||
patch: | ||
$(call make_version,patch) | ||
|
||
test: | ||
Vendor/Bin/atoum -ulr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 0 additions & 122 deletions
122
Tests/Units/Tools/Controllers/AuthentificationController.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Tests/Units/Tools/Services/AAuthentifierFactoryService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php declare(strict_types = 1); | ||
namespace LibertAPI\Tests\Units\Tools\Services; | ||
|
||
use LibertAPI\Tools\Services; | ||
|
||
/** | ||
* Classe de test de la fabrique de services d'authentification | ||
* | ||
* @author Prytoegrian <[email protected]> | ||
* @author Wouldsmina | ||
* | ||
* @since 1.1 | ||
*/ | ||
class AAuthentifierFactoryService extends \Atoum | ||
{ | ||
public function beforeTestMethod($method) | ||
{ | ||
parent::beforeTestMethod($method); | ||
|
||
$this->mockGenerator->orphanize('__construct'); | ||
$this->mockGenerator->shuntParentClassCalls(); | ||
$this->configuration = new \mock\LibertAPI\Tools\Libraries\StorageConfiguration(); | ||
$this->mockGenerator->orphanize('__construct'); | ||
$this->repository = new \mock\LibertAPI\Tools\Libraries\ARepository(); | ||
} | ||
|
||
public function testGetLdapService() | ||
{ | ||
$this->calling($this->configuration)->getHowToConnectUser = 'ldap'; | ||
|
||
$testedClass = $this->testedClass->getClass(); | ||
$service = $testedClass::getAuthentifier($this->configuration, $this->repository); | ||
$this->object($service)->isInstanceOf(Services\LdapAuthentifierService::class); | ||
} | ||
|
||
public function testGetInterneService() | ||
{ | ||
$this->calling($this->configuration)->getHowToConnectUser = 'dbconges'; | ||
|
||
$testedClass = $this->testedClass->getClass(); | ||
$service = $testedClass::getAuthentifier($this->configuration, $this->repository); | ||
$this->object($service)->isInstanceOf(Services\InterneAuthentifierService::class); | ||
} | ||
|
||
public function testGetUnknownService() | ||
{ | ||
$this->calling($this->configuration)->getHowToConnectUser = 'foobar'; | ||
|
||
$this->exception(function () { | ||
$testedClass = $this->testedClass->getClass(); | ||
$testedClass::getAuthentifier($this->configuration, $this->repository); | ||
})->isInstanceOf(\UnexpectedValueException::class); | ||
} | ||
|
||
/** | ||
* @var LibertAPI\Tools\Libraries\StorageConfiguration Mock de la configuration | ||
*/ | ||
private $configuration; | ||
|
||
/** | ||
* @var LibertAPI\Tools\Libraries\ARepository Mock d'un repository lambda | ||
*/ | ||
private $repository; | ||
} |
Oops, something went wrong.