Ejemplo n.º 1
0
 public function test_rwx()
 {
     $uid = 2;
     $gid = 30;
     $o = new user($this->dbObj, $uid, $gid);
     $p = new permission($this->dbObj);
     $objId = $o->create(__METHOD__, "777");
     $this->assertTrue(is_numeric($objId));
     $record = $p->get($objId);
     $this->assertTrue(is_array($record));
     $this->assertTrue(isset($record['perms']));
     $this->assertEquals($o->get($objId), $p->get($objId));
     $this->assertTrue($o->canRead(__METHOD__));
     $this->assertTrue($o->canWrite(__METHOD__));
     $this->assertTrue($o->canExecute(__METHOD__));
 }
Ejemplo n.º 2
0
 public function test_updateAndDelete()
 {
     $o = new permission($this->dbObj);
     $theId = $o->create(__METHOD__, 1, 2, 123);
     $this->assertEquals(1, $theId);
     $updateRes = $o->update($theId, array('user_id' => 7, 'group_id' => 8, 'perms' => 456));
     $this->assertEquals(1, $updateRes);
     //see that we get 0 from MySQL for trying to do an identical update again.
     $this->assertEquals('mysql', $this->dbObj->get_dbtype());
     $dupe = $o->update($theId, array('user_id' => 7, 'group_id' => 8, 'perms' => 456));
     $this->assertEquals(0, $dupe);
     $delRes = $o->delete($theId);
     $this->assertEquals(1, $delRes);
     $this->assertEquals(array(), $o->get($theId));
 }