prophesize('oat\oatbox\user\User'); $user->getIdentifier()->willReturn('tastIdentifier\\_of_//User'); $this->user = $user->reveal(); } public function testConstruct() { $model = new FreeAccess(); $this->assertInstanceOf('oat\generis\model\data\permission\PermissionInterface', $model); } public function testGetPermissions() { $model = new FreeAccess(); $this->assertEquals(['res1' => [FreeAccess::RIGHT_UNSUPPORTED]], $model->getPermissions($this->user, ['res1'])); $this->assertEquals(['res1' => [FreeAccess::RIGHT_UNSUPPORTED], 'res2' => [FreeAccess::RIGHT_UNSUPPORTED]], $model->getPermissions($this->user, ['res1', 'res2'])); } public function testGetSupportedRights() { $model = new FreeAccess(); $this->assertEquals([], $model->getSupportedRights()); } public function testPhpSerialize() { $phpCode = \common_Utils::toPHPVariableString(new FreeAccess()); $restoredModel = eval('return ' . $phpCode . ';'); $this->assertInstanceOf('oat\generis\model\data\permission\PermissionInterface', $restoredModel); $this->assertEquals([], $restoredModel->getSupportedRights()); $this->assertEquals(['res1' => [FreeAccess::RIGHT_UNSUPPORTED]], $restoredModel->getPermissions($this->user, ['res1'])); } }