You are here

public function ScaldGalleryTestCase::testScaldGalleryAddManual in Scald: Gallery 7.2

Manual Gallery create test.

File

tests/scald_gallery.test, line 40
Tests for scald_gallery.module.

Class

ScaldGalleryTestCase
Test the Scald Gallery functionality.

Code

public function testScaldGalleryAddManual() {
  $title = $this
    ->randomName(30);
  $this
    ->drupalLogout();
  $web_user = $this
    ->drupalCreateUser(array(
    'view any atom',
    'fetch any atom',
    'edit own atom',
    'create atom of gallery type',
    'create atom of image type',
    'delete own atom',
  ));
  $this
    ->drupalLogin($web_user);
  $atom = $this
    ->createAtom();

  // Create a gallery atom.
  $edit = array(
    'title' => $title,
  );
  $this
    ->drupalPost('atom/add/gallery', $edit, t('Continue'));
  if ($this
    ->xpath('//input[@name="atom0[gallery_items][und][0][sid]"]')) {
    $edit = array(
      'atom0[gallery_items][und][0][sid]' => $atom->sid,
    );
    $this
      ->drupalPost(NULL, $edit, t('Finish'));
  }
  $atom = scald_fetch(2, TRUE);
  $this
    ->addAtomAction($atom, 'edit');

  // Check that a gallery atom has been created.
  $this
    ->drupalGet('atom/' . $atom->sid);
  $this
    ->assertTitle($title . ' | Drupal', 'Gallery atom can be accessed.');
  $this
    ->assertLink(t('Edit'), 0, 'User can edit atom.');
}