예제 #1
0
 /**
  * Tests if the access for a user can be returned.
  */
 public function testHasAccess()
 {
     $group = new Group();
     $group->setId(3);
     $group->setName('Testgroup');
     $user = new User();
     $user->setId(123);
     $user->addGroup($group);
     $dbMock = $this->getMock('Ilch_Database', array('queryCell'));
     $dbMock->expects($this->once())->method('queryCell')->with($this->logicalAnd($this->stringContains('FROM [prefix]_groups_access'), $this->stringContains('INNER JOIN `[prefix]_modules`'), $this->stringContains('user')))->will($this->returnValue('0'));
     Registry::remove('db');
     Registry::set('db', $dbMock);
     $this->assertEquals(0, $user->hasAccess('module_user'));
 }