You are here

public function ImageTest::testChmodFails in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Image/ImageTest.php \Drupal\Tests\Core\Image\ImageTest::testChmodFails()

Tests \Drupal\Core\Image\Image::save().

File

core/tests/Drupal/Tests/Core/Image/ImageTest.php, line 240
Contains \Drupal\Tests\Core\Image\ImageTest.

Class

ImageTest
Tests the image class.

Namespace

Drupal\Tests\Core\Image

Code

public function testChmodFails() {
  $this
    ->getTestImage();

  // This will fail if save() method isn't called on the toolkit.
  $toolkit = $this
    ->getToolkitMock();
  $toolkit
    ->expects($this
    ->once())
    ->method('save')
    ->will($this
    ->returnValue(TRUE));
  $image = $this
    ->getMock('Drupal\\Core\\Image\\Image', array(
    'chmod',
  ), array(
    $toolkit,
    $this->image
      ->getSource(),
  ));
  $image
    ->expects($this
    ->any())
    ->method('chmod')
    ->will($this
    ->returnValue(FALSE));
  $this
    ->assertFalse($image
    ->save());
}