/** * This test demonstrates that all attributes are set * properly on construct. */ public function testAdldapConstructConfig() { $connection = $this->newConnectionMock(); $connection->shouldReceive('isSupported')->andReturn(true); $connection->shouldReceive('isSaslSupported')->andReturn(true); $connection->shouldReceive('useSSO')->andReturn(true); $connection->shouldReceive('useSSL')->andReturn(true); $connection->shouldReceive('useTLS')->andReturn(true); $connection->shouldReceive('startTLS')->andReturn(true); $connection->shouldReceive('isUsingSSL')->andReturn(true); $connection->shouldReceive('isUsingTLS')->andReturn(true); $connection->shouldReceive('isUsingSSO')->andReturn(true); $connection->shouldReceive('connect')->once()->andReturn(true); $connection->shouldReceive('setOption')->twice()->andReturn(true); $connection->shouldReceive('bind')->andReturn('resource'); $connection->shouldReceive('isBound')->andReturn(true); $connection->shouldReceive('close')->andReturn(true); $ad = new Adldap($this->configStub, $connection); $this->assertInstanceOf('Adldap\\Interfaces\\ConnectionInterface', $ad->getLdapConnection()); $this->assertEquals(500, $ad->getPort()); $this->assertEquals(['dc1', 'dc2'], $ad->getDomainControllers()); $this->assertEquals('Base DN', $ad->getBaseDn()); $this->assertEquals('Account Suffix', $ad->getAccountSuffix()); $this->assertTrue($ad->getRecursiveGroups()); $this->assertTrue($ad->getUseSSL()); $this->assertTrue($ad->getUseTLS()); $this->assertTrue($ad->getUseSSO()); }
/** * Constructor. * * @param Adldap $adldap */ public function __construct(Adldap $adldap) { $this->adldap = $adldap; $connection = $adldap->getLdapConnection(); if ($connection) { $this->connection = $connection; } }
/** * This tests that the public georgia tech LDAP server * is up and running. This is useful for making sure a notice * is placed on the readme if it's no longer active. */ public function testGeorgiaTechConnection() { $config = ['account_suffix' => "@gatech.edu", 'domain_controllers' => ["whitepages.gatech.edu"], 'base_dn' => 'dc=whitepages,dc=gatech,dc=edu', 'admin_username' => null, 'admin_password' => null]; $ad = new Adldap($config); $this->assertTrue($ad->getLdapConnection()->isBound()); }