comparison core/modules/image/tests/src/Functional/ImageAdminStylesTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\image\Functional; 3 namespace Drupal\Tests\image\Functional;
4 4
5 use Drupal\Core\Url;
5 use Drupal\Component\Render\FormattableMarkup; 6 use Drupal\Component\Render\FormattableMarkup;
6 use Drupal\Core\Entity\Entity\EntityViewDisplay; 7 use Drupal\Core\Entity\Entity\EntityViewDisplay;
7 use Drupal\image\Entity\ImageStyle; 8 use Drupal\image\Entity\ImageStyle;
8 use Drupal\image\ImageStyleInterface; 9 use Drupal\image\ImageStyleInterface;
9 use Drupal\node\Entity\Node; 10 use Drupal\node\Entity\Node;
31 // First, we need to make sure we have an image in our testing 32 // First, we need to make sure we have an image in our testing
32 // file directory. Copy over an image on the first run. 33 // file directory. Copy over an image on the first run.
33 if (!isset($file_path)) { 34 if (!isset($file_path)) {
34 $files = $this->drupalGetTestFiles('image'); 35 $files = $this->drupalGetTestFiles('image');
35 $file = reset($files); 36 $file = reset($files);
36 $file_path = file_unmanaged_copy($file->uri); 37 $file_path = \Drupal::service('file_system')->copy($file->uri, 'public://');
37 } 38 }
38 39
39 return $style->buildUrl($file_path) ? $file_path : FALSE; 40 return $style->buildUrl($file_path) ? $file_path : FALSE;
40 } 41 }
41 42
139 // These are added by a hook_image_style_presave() implemented in 140 // These are added by a hook_image_style_presave() implemented in
140 // image_module_test module. 141 // image_module_test module.
141 $this->assertEqual('bar', $style->getThirdPartySetting('image_module_test', 'foo'), 'Third party settings were added to the image style.'); 142 $this->assertEqual('bar', $style->getThirdPartySetting('image_module_test', 'foo'), 'Third party settings were added to the image style.');
142 143
143 // Ensure that the image style URI matches our expected path. 144 // Ensure that the image style URI matches our expected path.
144 $style_uri_path = $style->url(); 145 $style_uri_path = $style->toUrl()->toString();
145 $this->assertTrue(strpos($style_uri_path, $style_path) !== FALSE, 'The image style URI is correct.'); 146 $this->assertTrue(strpos($style_uri_path, $style_path) !== FALSE, 'The image style URI is correct.');
146 147
147 // Confirm that all effects on the image style have settings that match 148 // Confirm that all effects on the image style have settings that match
148 // what was saved. 149 // what was saved.
149 $uuids = []; 150 $uuids = [];
289 } 290 }
290 291
291 // Confirm that the empty text is correct on the image styles page. 292 // Confirm that the empty text is correct on the image styles page.
292 $this->drupalGet($admin_path); 293 $this->drupalGet($admin_path);
293 $this->assertRaw(t('There are currently no styles. <a href=":url">Add a new one</a>.', [ 294 $this->assertRaw(t('There are currently no styles. <a href=":url">Add a new one</a>.', [
294 ':url' => \Drupal::url('image.style_add'), 295 ':url' => Url::fromRoute('image.style_add')->toString(),
295 ])); 296 ]));
296 297
297 } 298 }
298 299
299 /** 300 /**