public function PMPAPIPullWebTestCase::setUp in Public Media Platform API Integration 7
Sets up the test environment.
Overrides DrupalWebTestCase::setUp
See also
File
- pmpapi_pull/
tests/ pmpapi_pull.test, line 26
Class
- PMPAPIPullWebTestCase
- Tests the functionality of the PMPAPI pull module.
Code
public function setUp() {
// Enable any modules required for the test.
parent::setUp(array(
'pmpapi_pull',
'file_entity',
));
// Create and log in our privileged user.
$this->privileged_user = $this
->drupalCreateUser(array(
'administer PMP API',
));
$this
->drupalLogin($this->privileged_user);
// Set up client_id, client_secret, host
module_load_include('php', 'pmpapi', 'tests/settings');
$vars = pmpapi_test_get_secret_vars();
variable_set('pmpapi_auth_client_id', $vars['client_id']);
variable_set('pmpapi_auth_client_secret', $vars['client_secret']);
variable_set('pmpapi_base_url', $vars['host']);
$this->story_guid = $vars['story_guid'];
$this->story_with_image_guid = $vars['story_with_image_guid'];
$this->image_guid = $vars['image_guid'];
// Turn off caching
variable_set('pmpapi_cache', FALSE);
$this
->assertTrue(variable_get('pmpapi_pull_pull_active'), 'Pull is active.');
// Set up node mapping
$this->nodetype = 'testnode';
$node_settings = array(
'entity_type' => 'node',
'bundle_name' => $this->nodetype,
'mapped_profile' => 'story',
'mapping' => array(
'title' => 'title',
'contentencoded' => 'body',
'item-image' => 'field_image',
),
);
$this
->setUpEntityMapping($node_settings);
// Set up image mapping
$image_settings = array(
'entity_type' => 'file',
'bundle_name' => 'image',
'mapped_profile' => 'image',
'mapping' => array(
'title' => 'filename',
),
);
$this
->setUpEntityMapping($image_settings);
}