You are here

public function BlockAttributesContextTestCase::initializeContext in Block Attributes 7

Helper function to initialize a test Context with a test block.

1 call to BlockAttributesContextTestCase::initializeContext()
BlockAttributesContextTestCase::setUp in ./block_attributes.test
Enable modules and create user with specific permissions.

File

./block_attributes.test, line 335
Test the Block Attributes module.

Class

BlockAttributesContextTestCase
Test Block Attributes integration with Context.

Code

public function initializeContext() {

  // Import a basic context exported through the admin interface.
  $context = new stdClass();
  $context->disabled = FALSE;
  $context->api_version = 3;
  $context->name = 'front';
  $context->description = 'Frontpage Context';
  $context->tag = '';
  $context->conditions = array(
    'path' => array(
      'values' => array(
        '<front>' => '<front>',
      ),
    ),
  );
  $context->reactions = array(
    'block' => array(
      'blocks' => array(
        $this->module . '-' . $this->delta => array(
          'module' => $this->module,
          'delta' => $this->delta,
          'region' => 'content',
          'weight' => '-10',
        ),
      ),
    ),
  );
  $context->condition_mode = 0;

  // Translatables
  // Included for use with string extractors like potx.
  t('Frontpage Context');

  // Save the context.
  context_save($context);
}