protected function ScaldWebTestCase::createAtom in Scald: Media Management made easy 7
Create a new atom.
Atom is created via the simple browser, thus the current user must have "create atom of image type" permission.
7 calls to ScaldWebTestCase::createAtom()
- ScaldAtomEntityTestCase::testScaldAtomCRUD in tests/
scald.test - Create four nodes and ensure they're loaded correctly.
- ScaldAtomEntityTestCase::testScaldAtomPermissions in tests/
scald.test - Permission tests.
- ScaldAtomRefereneTestCase::testAtomReferenceField in modules/
fields/ atom_reference/ atom_reference.test - Test Scald YouTube atom creation via UI.
- ScaldBaseTestCase::testScaldCache in tests/
scald.test - Test Scald caching system.
- ScaldBaseTestCase::testScaldContext in tests/
scald.test - Test Scald context.
1 method overrides ScaldWebTestCase::createAtom()
- ScaldLocalizeTestCase::createAtom in tests/
scald.test - Overrides ScaldWebTestCase::createAtom().
File
- tests/
scald.test, line 48 - Tests for scald.module.
Class
- ScaldWebTestCase
- Defines a base class for testing the Scald module.
Code
protected function createAtom($type = 'image') {
module_enable(array(
'scald_image',
));
$image = $this
->getTestFile('image');
$edit = array(
'files[file]' => drupal_realpath($image->uri),
);
$this
->drupalPost('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);
}