/**
  * Test that GD::failedResample() returns true for the current image
  * manipulation only if it previously failed
  * @return void
  */
 public function testFailedResample()
 {
     $fullPath = realpath(dirname(__FILE__) . '/gdtest/nonimagedata.jpg');
     $fullPath2 = realpath(dirname(__FILE__) . '/gdtest/test_gif.gif');
     // Load invalid file
     $gd = new GDBackend();
     $gd->loadFrom($fullPath);
     // Cache should refre to this file
     $this->assertTrue($gd->failedResample($fullPath, filemtime($fullPath)));
     $this->assertFalse($gd->failedResample($fullPath2, filemtime($fullPath2)));
 }
Example #2
0
 /**
  * Test that GD::failedResample() returns true for the current image
  * manipulation only if it previously failed
  * @return void
  */
 public function testFailedResample()
 {
     $fullPath = realpath(dirname(__FILE__) . '/gdtest/test_jpg.jpg');
     try {
         $gdFailure = new GDBackend_Failure($fullPath, array('ScaleWidth-failed', 123));
         $this->fail('GDBackend_Failure should throw an exception when setting image resource');
     } catch (GDBackend_Failure_Exception $e) {
         $gd = new GDBackend($fullPath, array('ScaleWidth', 123));
         $this->assertTrue($gd->failedResample($fullPath, 'ScaleWidth-failed|123'));
         $this->assertFalse($gd->failedResample($fullPath, 'ScaleWidth-not-failed|123'));
     }
 }