protected function TokenTests::setUp in Lightweight Directory Access Protocol (LDAP) 8.3
Test setup.
Overrides UnitTestCase::setUp
File
- ldap_servers/
tests/ src/ Unit/ TokenTests.php, line 53
Class
- TokenTests
- @coversDefaultClass \Drupal\ldap_servers\Processor\TokenProcessor @group ldap @runTestsInSeparateProcesses @preserveGlobalState disabled
Namespace
Drupal\Tests\ldap_servers\UnitCode
protected function setUp() {
parent::setUp();
class_alias('\\Drupal\\Tests\\ldap_servers\\Unit\\LdapExplodeDnMock', '\\Drupal\\ldap_servers\\Entity\\Server', TRUE);
$this->detailLog = $this
->getMockBuilder('\\Drupal\\ldap_servers\\Logger\\LdapDetailLog')
->disableOriginalConstructor()
->getMock();
$this->fileSystem = $this
->getMockBuilder('\\Drupal\\Core\\File\\FileSystem')
->disableOriginalConstructor()
->getMock();
/* Mocks the Server due to wrapper for ldap_explode_dn(). */
$this->serverFactory = $this
->getMockBuilder('\\Drupal\\ldap_servers\\Entity\\Server')
->disableOriginalConstructor()
->getMock();
$this->container = new ContainerBuilder();
$this->container
->set('ldap.servers', $this->serverFactory);
$this->container
->set('ldap.detail_log', $this->detailLog);
$this->container
->set('file_system', $this->fileSystem);
\Drupal::setContainer($this->container);
$this->ldapEntry = [
'dn' => 'cn=hpotter,ou=Gryffindor,ou=student,ou=people,dc=hogwarts,dc=edu',
'mail' => [
0 => 'hpotter@hogwarts.edu',
'count' => 1,
],
'sAMAccountName' => [
0 => 'hpotter',
'count' => 1,
],
'house' => [
0 => 'Gryffindor',
1 => 'Privet Drive',
'count' => 2,
],
'guid' => [
0 => 'sdafsdfsdf',
'count' => 1,
],
'count' => 3,
];
}