/** * Login LDAP user to Bitrix. If user exists in Bitrix, simple login. If * not, create before. * * @internal * * @param Capall_Ldaper_LdapUser $ldapUser * * @return int Bitrix's user identifier. */ public function getBitrixUser($ldapUser) { if (!($bitrixUserIdentifier = $this->bitrixUserManager->getByLogin($ldapUser->getLogin()))) { $bitrixUserIdentifier = $this->bitrixUserManager->create($ldapUser->getLogin(), $ldapUser->getMail()); } return $bitrixUserIdentifier; }
/** * Expects exception... */ public function testFailureCreation() { $this->markTestIncomplete('LAST_ERROR :('); $this->setExpectedException('Capall_Ldaper_BitrixUserCreationException'); $this->_bitrixUser->expects($this->once())->method('Add')->with($this->isType('array'))->will($this->returnValue(false)); $manager = new Capall_Ldaper_BitrixUserManager($this->_bitrixUser); $manager->create('test', '*****@*****.**'); }