comparison core/modules/image/src/Tests/ImageDimensionsTest.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
11:bfffd8d7479a 12:7a779792577d
171 $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); 171 $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
172 $this->drupalGet($this->getAbsoluteUrl($url)); 172 $this->drupalGet($this->getAbsoluteUrl($url));
173 $this->assertResponse(200, 'Image was generated at the URL.'); 173 $this->assertResponse(200, 'Image was generated at the URL.');
174 $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); 174 $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
175 175
176
177 // Add a crop effect. 176 // Add a crop effect.
178 $effect = [ 177 $effect = [
179 'id' => 'image_crop', 178 'id' => 'image_crop',
180 'data' => [ 179 'data' => [
181 'width' => 30, 180 'width' => 30,
206 'weight' => 7, 205 'weight' => 7,
207 ]; 206 ];
208 207
209 $effect_id = $style->addImageEffect($effect); 208 $effect_id = $style->addImageEffect($effect);
210 $style->save(); 209 $style->save();
211 $this->assertEqual($this->getImageTag($variables), '<img src="' . $url . '" width="41" height="41" alt="" class="image-style-test" />'); 210 // @todo Uncomment this once
212 $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); 211 // https://www.drupal.org/project/drupal/issues/2670966 is resolved.
213 $this->drupalGet($this->getAbsoluteUrl($url)); 212 // $this->assertEqual($this->getImageTag($variables), '<img src="' . $url . '" width="41" height="41" alt="" class="image-style-test" />');
214 $this->assertResponse(200, 'Image was generated at the URL.'); 213 $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
215 $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.'); 214 $this->drupalGet($this->getAbsoluteUrl($url));
216 $image_file = $image_factory->get($generated_uri); 215 $this->assertResponse(200, 'Image was generated at the URL.');
217 $this->assertEqual($image_file->getWidth(), 41); 216 $this->assertTrue(file_exists($generated_uri), 'Generated file does exist after we accessed it.');
218 $this->assertEqual($image_file->getHeight(), 41); 217 $image_file = $image_factory->get($generated_uri);
218 // @todo Uncomment this once
219 // https://www.drupal.org/project/drupal/issues/2670966 is resolved.
220 // $this->assertEqual($image_file->getWidth(), 41);
221 // $this->assertEqual($image_file->getHeight(), 41);
219 222
220 $effect_plugin = $style->getEffect($effect_id); 223 $effect_plugin = $style->getEffect($effect_id);
221 $style->deleteImageEffect($effect_plugin); 224 $style->deleteImageEffect($effect_plugin);
222 225
223 // Ensure that an effect can unset dimensions. 226 // Ensure that an effect can unset dimensions.