1 image_example.test public ImageExampleTestCase::testImageExamplePage()

Tests for image block provided by module.

File

modules/examples/image_example/tests/image_example.test, line 76
Test case for testing the image example module.

Class

ImageExampleTestCase
Functional tests for the Image Example module.

Code

public function testImageExamplePage() {
  // Login the admin user.
  $this->backdropLogin($this->webUser);
  $this->backdropCreateNode(array('promote' => 1));

  // Upload an image to the image page.
  $images = $this->backdropGetTestFiles('image');
  $edit = array(
    'files[image_example_image_fid]' => backdrop_realpath($images[0]->uri),
    'image_example_style_name' => 'image_example_style',
  );
  $this->backdropPost('image_example/styles', $edit, t('Save'));
  $this->assertText(t('The image @image_name was uploaded', array('@image_name' => $images[0]->filename)), 'Image uploaded to image block.');

  // Verify the image is displayed.
  $this->backdropGet('image_example/styles');
  $fid = config_get('image_example.settings', 'image_example_image_fid');
  $image = isset($fid) ? file_load($fid) : NULL;
  $this->assertRaw(file_uri_target($image->uri), 'Image is displayed');
}