function testValidNamesAreValid()
 {
     $um = new MockUserManager($this);
     $um->setReturnValue('getUserByUserName', null);
     $pm = new MockProjectManager($this);
     $pm->setReturnValue('getProjectByUnixName', null);
     $backend = new MockBackend($this);
     $backend->setReturnValue('unixUserExists', false);
     $backend->setReturnValue('unixGroupExists', false);
     $sm = new MockSystemEventManager($this);
     $sm->setReturnValue('isUserNameAvailable', true);
     $sm->setReturnValue('isProjectNameAvailable', true);
     $r = new Rule_ProjectNameIntegration($this);
     $r->setReturnValue('_getUserManager', $um);
     $r->setReturnValue('_getProjectManager', $pm);
     $r->setReturnValue('_getBackend', $backend);
     $r->setReturnValue('_getSystemEventManager', $sm);
     $r->setReturnValue('isNameAvailable', true, array("group-test"));
     $r->setReturnValue('isNameAvailable', true, array("test"));
     $r->setReturnValue('isNameAvailable', true, array("test1"));
     $this->assertTrue($r->isValid("group-test"));
     $this->assertTrue($r->isValid("test"));
     $this->assertTrue($r->isValid("test1"));
 }
Example #2
0
 function testNoUnixUserOrGroupExists()
 {
     $backend = new MockBackend($this);
     $backend->setReturnValue('unixUserExists', false);
     $backend->setReturnValue('unixGroupExists', false);
     $r = new Rule_UserNameTestVersion($this);
     $r->setReturnValue('_getBackend', $backend);
     $this->assertFalse($r->isSystemName("usertest"));
 }