public function testConfigSuccessSingleNSFile()
 {
     $platform = SHFactory::getConfig('file', array('file' => static::PLATFORM_CONFIG_FILE, 'namespace' => 'single'));
     $registry = SHLdapHelper::getConfig('', $platform);
     $ldapConfig = TestsHelper::getLdapConfig(214);
     $this->assertEquals($ldapConfig['user_qry'], $registry->get('user_qry'));
     $this->assertEquals($ldapConfig['host'], $registry->get('host'));
 }
 public function testCreateDeleteUsers1()
 {
     $ldap = TestsHelper::getLdapConfig(216);
     // Loop 50 times to test random users
     for ($i = 0; $i < 50; $i++) {
         $user = TestsHelper::getUserCreds(null, 101);
         // Create the new user
         $adapter = new SHUserAdaptersLdap($user, $ldap, array('isNew' => 1));
         $adapter->setAttributes($user);
         $commit = $adapter->commitChanges();
         $this->assertTrue($commit->status);
         // Test the new user
         $testAdapter = new SHUserAdaptersLdap($user, $ldap);
         $this->assertEquals($user['dn'], $testAdapter->getId(true));
         $phone = JArrayHelper::getValue($testAdapter->getAttributes('telephoneNumber'), 'telephoneNumber');
         $this->assertEquals($user['telephoneNumber'], $phone);
         // Delete the new user
         $this->assertTrue($adapter->delete());
     }
 }
Exemplo n.º 3
0
 public function testSlapdAuthenticateWrongPasswordException()
 {
     $this->setExpectedException('SHExceptionInvaliduser', 'LIB_SHLDAP_ERR_10303', 10303);
     $user = TestsHelper::getUserCreds('shaun.maunder');
     $ldap = new SHLdap(TestsHelper::getLdapConfig(216));
     $ldap->authenticate(SHLdap::AUTH_USER, $user['username'], $user['password'] . ')(*&^%$£"!"£%^&*()');
 }