You are here

scald_gallery.test in Scald: Gallery 7.2

File

tests/scald_gallery.test
View source
<?php

/**
 * @file
 * Tests for scald_gallery.module.
 */

/**
 * Test the Scald Gallery functionality.
 */
class ScaldGalleryTestCase extends ScaldWebTestCase {

  /**
   * {@inheritdoc}
   */
  public static function getInfo() {
    return array(
      'name' => 'Scald Gallery',
      'description' => 'Test the Scald Gallery.',
      'group' => 'Scald',
    );
  }

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp(array(
      'scald_image',
      'scald_gallery',
      'mee',
    ));
    $this->web_user = $this
      ->drupalCreateUser(array(
      'create atom of gallery type',
      'view any atom',
      'fetch any atom',
      'edit own atom',
    ));
    $this
      ->drupalLogin($this->web_user);
  }

  /**
   * Manual Gallery create test.
   */
  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.');
  }

}

Classes

Namesort descending Description
ScaldGalleryTestCase Test the Scald Gallery functionality.