You are here

function ImageGalleryTest::createImage in Image 6

Same name and namespace in other branches
  1. 7 contrib/image_gallery/tests/image_gallery.test \ImageGalleryTest::createImage()
1 call to ImageGalleryTest::createImage()
ImageGalleryTest::testBasic in contrib/image_gallery/tests/image_gallery.test

File

contrib/image_gallery/tests/image_gallery.test, line 87

Class

ImageGalleryTest

Code

function createImage($edit = array()) {
  $defaults = array(
    'title' => $this
      ->randomName(),
    'body' => $this
      ->randomName(),
    'files[image]' => realpath('misc' . DIRECTORY_SEPARATOR . 'druplicon.png'),
  );
  $edit = $edit + $defaults;
  $this
    ->drupalPost('node/add/image', $edit, 'Save');
  $this
    ->assertWantedRaw(t('@type %title has been created.', array(
    '@type' => 'Image',
    '%title' => $edit['title'],
  )), 'Image created. %s');
  if ($node = node_load(array(
    'title' => $edit['title'],
  ))) {
    $this
      ->assertNotNull($node, 'Image found in database. %s');
    return $node;
  }
  return FALSE;
}