protected function ScaldLocalizeTestCase::createAtom in Scald: Media Management made easy 7
Overrides ScaldWebTestCase::createAtom().
Adds a parameter to choose the language of the add form.
Parameters
string $type: The atom type. Defaults to 'image'.
string $langcode: Optional language of the add form.
Overrides ScaldWebTestCase::createAtom
1 call to ScaldLocalizeTestCase::createAtom()
- ScaldLocalizeTestCase::testAtomTypeTranslation in tests/
scald.test - Tests if it is possible to translate atom types.
File
- tests/
scald.test, line 712 - Tests for scald.module.
Class
- ScaldLocalizeTestCase
- Test the Scald localization.
Code
protected function createAtom($type = 'image', $langcode = '') {
module_enable(array(
'scald_image',
));
$image = $this
->getTestFile('image');
$edit = array(
'files[file]' => drupal_realpath($image->uri),
);
$prefix = !empty($langcode) ? $langcode . '/' : '';
$this
->drupalPost($prefix . 'atom/add/image', $edit, t('Continue'));
$this
->assertFieldByName('atom0[title]', $image->filename);
// Change atom title.
$title = 'Image ' . $this
->randomName(20);
$edit = array(
'atom0[title]' => $title,
'atom0[scald_authors][und]' => $this
->randomName(10),
);
$this
->drupalPost(NULL, $edit, t('Finish'));
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'scald_atom');
$query
->propertyCondition('title', $title);
$result = $query
->execute();
$this
->assertEqual(count($result['scald_atom']), 1, 'Image atom has been created.');
$atom = reset($result['scald_atom']);
return scald_fetch($atom->sid, TRUE);
}