public function SynonymsWebTestCase::setUp in Synonyms 7
SetUp method.
Overrides DrupalWebTestCase::setUp
7 calls to SynonymsWebTestCase::setUp()
- AbstractAutocompleteSynonymsWebTestCase::setUp in ./
synonyms.test - SetUp method.
- AbstractSearchSynonymsWebTestCase::setUp in synonyms_search/
synonyms_search.test - SetUp method.
- AbstractSelectSynonymsWebTestCase::setUp in ./
synonyms.test - SetUp method.
- AbstractSynonymsProviderFieldWebTestCase::setUp in synonyms_provider_field/
synonyms_provider_field.test - Setup method.
- SynonymsProviderPropertyWebTestCase::setUp in synonyms_provider_property/
synonyms_provider_property.test - SetUp method.
7 methods override SynonymsWebTestCase::setUp()
- AbstractAutocompleteSynonymsWebTestCase::setUp in ./
synonyms.test - SetUp method.
- AbstractSearchSynonymsWebTestCase::setUp in synonyms_search/
synonyms_search.test - SetUp method.
- AbstractSelectSynonymsWebTestCase::setUp in ./
synonyms.test - SetUp method.
- AbstractSynonymsProviderFieldWebTestCase::setUp in synonyms_provider_field/
synonyms_provider_field.test - Setup method.
- SynonymsProviderPropertyWebTestCase::setUp in synonyms_provider_property/
synonyms_provider_property.test - SetUp method.
File
- ./
synonyms.test, line 77 - Tests for the Synonyms module.
Class
- SynonymsWebTestCase
- Base class for all Synonyms web test cases.
Code
public function setUp($modules = array()) {
array_unshift($modules, 'synonyms_provider_field');
array_unshift($modules, 'synonyms');
parent::setUp($modules);
$this->admin = $this
->drupalCreateUser(array(
'administer taxonomy',
'administer content types',
'administer fields',
'bypass node access',
'search content',
));
// Creating vocabularies.
$this
->drupalLogin($this->admin);
$this->vocabulary = (object) array(
'name' => $this
->randomName(),
'machine_name' => 'synonyms_test',
'description' => $this
->randomName(),
);
taxonomy_vocabulary_save($this->vocabulary);
$this->fields['enabled']['field'] = field_create_field($this->fields['enabled']['field']);
$this->fields['enabled']['field'] = field_info_field($this->fields['enabled']['field']['field_name']);
if (!isset($this->fields['enabled']['instance']['bundle'])) {
$this->fields['enabled']['instance']['bundle'] = $this->vocabulary->machine_name;
}
$this->fields['enabled']['instance']['field_name'] = $this->fields['enabled']['field']['field_name'];
$this->fields['enabled']['instance'] = field_create_instance($this->fields['enabled']['instance']);
$this->fields['enabled']['instance'] = field_info_instance($this->fields['enabled']['instance']['entity_type'], $this->fields['enabled']['instance']['field_name'], $this->fields['enabled']['instance']['bundle']);
$this->fields['disabled']['field'] = field_create_field($this->fields['disabled']['field']);
$this->fields['disabled']['field'] = field_info_field($this->fields['disabled']['field']['field_name']);
if (!isset($this->fields['disabled']['instance']['bundle'])) {
$this->fields['disabled']['instance']['bundle'] = $this->vocabulary->machine_name;
}
$this->fields['disabled']['instance']['field_name'] = $this->fields['disabled']['field']['field_name'];
$this->fields['disabled']['instance'] = field_create_instance($this->fields['disabled']['instance']);
$this->fields['disabled']['instance'] = field_info_instance($this->fields['disabled']['instance']['entity_type'], $this->fields['disabled']['instance']['field_name'], $this->fields['disabled']['instance']['bundle']);
if (!$this->behavior_implementation['bundle']) {
$this->behavior_implementation['bundle'] = $this->fields['enabled']['instance']['bundle'];
}
if (!$this->behavior_implementation['provider']) {
$this->behavior_implementation['provider'] = synonyms_provider_field_provider_name($this->fields['enabled']['field']);
}
synonyms_behavior_implementation_save($this->behavior_implementation);
foreach (synonyms_behavior_get($this->behavior_implementation['behavior'], $this->behavior_implementation['entity_type'], $this->behavior_implementation['bundle'], TRUE) as $behavior_implementation) {
if ($behavior_implementation['provider'] == $this->behavior_implementation['provider']) {
$this->behavior_implementation = $behavior_implementation;
break;
}
}
}