public function AccessWebTestCase::createScheme in Access Control Kit 7
Creates and returns a new access scheme with random properties.
Parameters
string $type: (optional) The scheme type. Defaults to 'boolean'.
array $settings: (optional) The scheme settings. Defaults to array().
Return value
object An access scheme.
12 calls to AccessWebTestCase::createScheme()
- AccessAPITest::setUp in ./
access.test - Overrides DrupalWebTestCase::setUp().
- AccessGrantFunctionTest::setUp in ./
access.test - Overrides DrupalWebTestCase::setUp().
- AccessGrantInterfaceTest::testGrantDelete in ./
access.test - Delete an access grant via the user interface.
- AccessGrantInterfaceTest::testGrantInterface in ./
access.test - Create and edit an access grant via the user interface.
- AccessGrantInterfaceTest::testGrantOverviewFilters in ./
access.test - Test the grant overview filters.
File
- ./
access.test, line 24 - Tests for the access control kit module.
Class
- AccessWebTestCase
- Provides common helper methods for access control kit module tests.
Code
public function createScheme($type = 'boolean', $settings = array()) {
$machine_name = drupal_strtolower($this
->randomName());
$name = $this
->randomName();
$description = $this
->randomName();
// Create a scheme.
$scheme = entity_get_controller('access_scheme')
->create(array(
'machine_name' => $machine_name,
'name' => $name,
'type' => $type,
'description' => $description,
));
$scheme->settings = $settings;
$this
->assertNull($scheme->sid);
// Save the scheme and confirm that values come back correct.
$this
->assertIdentical(access_scheme_save($scheme), SAVED_NEW, 'New scheme saved.');
$this
->assertNotNull($scheme->sid);
$this
->assertIdentical($scheme->machine_name, $machine_name);
$this
->assertIdentical($scheme->name, $name);
$this
->assertIdentical($scheme->type, $type);
$this
->assertIdentical($scheme->description, $description);
$this
->assertIdentical($scheme->settings, $settings);
return $scheme;
}