public function testGetScreenPermissionsNoneWithScreenDefined() { $module = 'xim'; $action = 'doThis'; $roles = ''; $mockDao = $this->getMock('ScreenPermissionDao', array('getScreenPermissions')); $emptyDoctrineCollection = new Doctrine_Collection('ScreenPermission'); $mockDao->expects($this->once())->method('getScreenPermissions')->with($module, $action, $roles)->will($this->returnValue($emptyDoctrineCollection)); $this->service->setScreenPermissionDao($mockDao); $screen = new Screen(); $screen->setName('abc'); $screenDao = $this->getMock('ScreenDao', array('getScreen')); $screenDao->expects($this->once())->method('getScreen')->with($module, $action)->will($this->returnValue($screen)); $this->service->setScreenDao($screenDao); $permissions = $this->service->getScreenPermissions($module, $action, $roles); $this->assertTrue($permissions instanceof ResourcePermission); $this->verifyPermissions($permissions, false, false, false, false); }
public function testGetScreen() { $module = 'xim'; $action = 'doThis'; $expected = new Screen(); $expected->setId(2); $expected->setName('test'); $expected->setModuleId(33); $expected->setActionUrl($action); $screenDao = $this->getMock('ScreenDao', array('getScreen')); $screenDao->expects($this->once())->method('getScreen')->with($module, $action)->will($this->returnValue($expected)); $this->service->setScreenDao($screenDao); $result = $this->service->getScreen($module, $action); $this->assertEquals($expected, $result); }