You are here

function FlagTestCaseBase::createFlag in Flag 7.3

Helper to create a flag from an array of data and clear caches etc.

Parameters

array $flag_data: An array of flag data.

Return value

flag_flag The flag object.

8 calls to FlagTestCaseBase::createFlag()
FlagAccessFormTestCase::testFlagAccessGlobalNone in tests/flag.test
Test scenarios with no access to a global flag.
FlagAccessLinkTestCase::setUp in tests/flag.test
Implements setUp().
FlagCommentOptimizationTestCase::setUp in tests/flag.test
Implements setUp().
FlagEntityFieldQueryTestCase::setUp in tests/flag.test
Implements setUp().
FlagEntityTokensTestCase::testNodeFlagToken in tests/flag.test
Test tokens on nodes.

... See full list

File

tests/flag.test, line 22
Tests for the Flag module.

Class

FlagTestCaseBase
Base class for our tests with common methods.

Code

function createFlag($flag_data) {
  $flag = flag_flag::factory_by_array($flag_data);
  $flag
    ->save();

  // Reset our cache so our permissions show up.
  drupal_static_reset('flag_get_flags');

  // Reset permissions so that permissions for this flag are available.
  $this
    ->checkPermissions(array(), TRUE);
  return $flag;
}