You are here

function ImageTestCase::testImageNodeValidation in Image 7

Same name and namespace in other branches
  1. 6 tests/image.test \ImageTestCase::testImageNodeValidation()

Verify that images cannot be created without a file.

File

tests/image.test, line 121

Class

ImageTestCase
Test image functionality.

Code

function testImageNodeValidation() {

  // Create an image node without image file.
  $edit = array(
    'title' => $this
      ->randomName(),
    'body' => $this
      ->randomName(),
  );
  $this
    ->drupalPost('node/add/image', $edit, t('Save'));
  $this
    ->assertRaw(t('You must upload an image.'), t('Refused node creation without image.'));
  $node = node_load(array(
    'title' => $edit['title'],
  ));
  $this
    ->assertFalse($node, t('Image node is not found in database.'));
}