You are here

public function AccessSchemeFunctionTest::testSchemeStaticReset in Access Control Kit 7

Ensure that the access scheme static reset works correctly.

File

./access.test, line 579
Tests for the access control kit module.

Class

AccessSchemeFunctionTest
Tests for access scheme functions.

Code

public function testSchemeStaticReset() {
  $original_scheme = access_scheme_load($this->schemes[0]->sid);
  $this
    ->assertTrue(is_object($original_scheme) && $original_scheme->name == $this->schemes[0]->name, 'Scheme loaded successfully.');

  // Change the name and description.
  $scheme = $original_scheme;
  $scheme->name = $this
    ->randomName();
  $scheme->description = $this
    ->randomName();
  access_scheme_save($scheme);

  // Load the scheme.
  $new_scheme = access_scheme_load($original_scheme->sid);
  $this
    ->assertEqual($new_scheme->name, $scheme->name);
  $this
    ->assertEqual($new_scheme->description, $scheme->description);

  // Delete the scheme.
  access_scheme_delete($this->schemes[0]->sid);
  $schemes = access_scheme_load_multiple(FALSE);
  $this
    ->assertTrue(!isset($schemes[$this->schemes[0]->sid]), 'The scheme was deleted.');
}