Пример #1
0
    {
        $result = $this->gacl_api->acl_query('test_aco', 'access', 'test_human', 'luke', 'test_location', 'lounge');
        $expected = array('acl_id' => $this->acl_setup->acl[2], 'return_value' => '', 'allow' => TRUE);
        $message = 'Luke should have access to the Lounge';
        $this->assertEquals($expected, $result, $message);
    }
}
// check no previous tests failed
if ($result->failureCount() > 0) {
    echo '<p>Previous test failed, not running ACL check tests.</p>';
    return;
}
echo '<p>Running ACL tests...<br />';
// set up test environment
$acl_setup = new acl_setup();
echo '&nbsp;&nbsp;Setting Up... ';
$acl_setup->setup();
echo 'Done<br/>';
// run tests & destroy suite
$suite = new gacl_test_suite('acl_test');
echo '&nbsp;&nbsp;Running Tests... ';
$suite->run($result);
echo 'Done<br />';
unset($suite);
// tear down test environment;
echo '&nbsp;&nbsp;Cleaning Up... ';
$acl_setup->teardown();
unset($acl_setup);
echo 'Done<br />';
echo '<b>Done</b></p>';
// done.
Пример #2
0
    }
    function add_group_object_axo()
    {
        $result = $this->gacl_api->add_group_object($this->get_group_id_parent_axo(), 'unit_test', 'object_1', 'AXO');
        $message = 'add_group_object failed';
        $this->assert($result, $message);
    }
    function del_group_object_axo()
    {
        $result = $this->gacl_api->del_group_object($this->get_group_id_parent_axo(), 'unit_test', 'object_1', 'AXO');
        $message = 'del_group_object failed';
        $this->assert($result, $message);
    }
}
// initialise test suite
$suite = new gacl_test_suite();
//This comes in handy.
//$suite->gacl_api->db->debug=TRUE;
// general
$suite->addTest(new phpgacl_api_test('get_version'));
$suite->addTest(new phpgacl_api_test('get_schema_version'));
$suite->addTest(new phpgacl_api_test('count_all'));
// build structure
$suite->addTest(new phpgacl_api_test('add_object_section_aco'));
$suite->addTest(new phpgacl_api_test('get_object_section_section_id_aco'));
$suite->addTest(new phpgacl_api_test('add_object_aco'));
$suite->addTest(new phpgacl_api_test('get_object_id_aco'));
$suite->addTest(new phpgacl_api_test('add_object_section_aro'));
$suite->addTest(new phpgacl_api_test('get_object_section_section_id_aco'));
$suite->addTest(new phpgacl_api_test('add_object_aro'));
//Test the below with ACLs as well... I haven't gotten around to that just yet.