function testUserSuspendedIfNotInLDAP() { $sync = new LDAP_DirectorySynchronizationTestVersion($this); ForgeConfig::set('codendi_log', '/tmp'); $lri = new MockLDAPResultIterator($this); $lri->setReturnValue('valid', false); $lri->setReturnValue('count', 0); $ldap = new MockInhLDAP($this); $ldap->setReturnValue('getErrno', LDAP::ERR_SUCCESS); $ldap->setReturnReference('search', $lri); $ldap->expectCallCount('search', 3); $ldap->setReturnValue('getLDAPParam', 'ou=People,dc=st,dc=com ; ou=Intranet,dc=st,dc=com ; ou=Extranet,dc=st,dc=com'); $sync->__construct($ldap, mock('TruncateLevelLogger')); $um = new MyUmMock4Suspended($this); $um->expectOnce('updateDb'); $sync->setReturnValue('getUserManager', $um); $lum = new MockLDAP_UserManager($this); $lum->expectNever('updateLdapUid'); $sync->setReturnValue('getLdapUserManager', $lum); $syncNotifManager = new MockLDAP_SyncNotificationManager($this); $sync->setReturnValue('getLdapSyncNotificationManager', $syncNotifManager); $clm = new MockLDAP_CleanUpManager($this); $clm->expectOnce('addUserDeletionForecastDate'); $sync->setReturnValue('getCleanUpManager', $clm); $syncReminderManager = new MockLDAP_SyncReminderNotificationManager($this); $sync->setReturnValue('getLdapSyncReminderNotificationManager', $syncReminderManager); $lus = new MockLDAP_UserSync($this); $lus->expectNever('sync'); $sync->setReturnValue('getLdapUserSync', $lus); $sync->ldapSync(array('ldap_id' => 'ed1234'), 1); }
function testUserSuspendedIfNotInLDAP() { $sync = new LDAP_DirectorySynchronizationTestVersion($this); $lri = new MockLDAPResultIterator($this); $lri->setReturnValue('valid', false); $lri->setReturnValue('count', 0); $ldap = new MockInhLDAP($this); $ldap->setReturnValue('getErrno', LDAP::ERR_SUCCESS); $ldap->setReturnReference('search', $lri); $ldap->expectCallCount('search', 3); $ldap->setReturnValue('getLDAPParam', 'ou=People,dc=st,dc=com ; ou=Intranet,dc=st,dc=com ; ou=Extranet,dc=st,dc=com'); $sync->__construct($ldap); $um = new MyUmMock4Suspended($this); $um->expectOnce('updateDb'); $sync->setReturnValue('getUserManager', $um); $lum = new MockLDAP_UserManager($this); $lum->expectNever('updateLdapUid'); $sync->setReturnValue('getLdapUserManager', $lum); $lus = new MockLDAP_UserSync($this); $lus->expectNever('sync'); $sync->setReturnValue('getLdapUserSync', $lus); $sync->ldapSync(array('ldap_id' => 'ed1234')); }