/** * @covers SystemUserService::getNonPredefinedUserRoles */ public function testGetNonPredefinedUserRoles() { $userRoles = new Doctrine_Collection('UserRole'); for ($i = 0; $i < 2; $i++) { $userRole = new UserRole(); $userRole->setId($i + 1); $userRole->setName("test name" . $i + 1); $userRole->setIsAssignable(1); $userRole->setIsPredefined(0); $userRoles->add($userRole); } $dao = $this->getMock('SystemUserDao'); $dao->expects($this->once())->method('getNonPredefinedUserRoles')->will($this->returnValue($userRoles)); $this->systemUserService->setSystemUserDao($dao); $result = $this->systemUserService->getNonPredefinedUserRoles(); $this->assertEquals($userRoles, $result); }