0byt3m1n1
Path:
/
data
/
applications
/
aps
/
tikiwiki
/
14.1-0
/
standard
/
htdocs
/
lib
/
test
/
core
/
Perms
/
Check
/
[
Home
]
File: AlternateTest.php
<?php // (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project // // All Rights Reserved. See copyright.txt for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. // $Id: AlternateTest.php 53803 2015-02-06 00:42:50Z jyhem $ /** * @group unit * */ class Perms_Check_AlternateTest extends PHPUnit_Framework_TestCase { function testUnconfigured() { $resolver = new Perms_Resolver_Default(true); $check = new Perms_Check_Alternate('admin'); $this->assertFalse($check->check($resolver, array(), 'view', array('Registered'))); } function testWithReplacementResolver() { $resolver = new Perms_Resolver_Default(false); $replacement = new Perms_Resolver_Static( array('Registered' => array('admin'),) ); $check = new Perms_Check_Alternate('admin'); $check->setResolver($replacement); $this->assertTrue($check->check($resolver, array(), 'view', array('Registered'))); } function testWithReplacementNotAllowing() { $resolver = new Perms_Resolver_Default(false); $replacement = new Perms_Resolver_Static( array('Registered' => array('view', 'edit'),) ); $check = new Perms_Check_Alternate('admin'); $check->setResolver($replacement); $this->assertFalse($check->check($resolver, array(), 'view', array('Registered'))); } }