comparison core/modules/image/tests/src/Functional/ImageFieldTestBase.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children c2387f117808
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
64 */ 64 */
65 public function previewNodeImage($image, $field_name, $type) { 65 public function previewNodeImage($image, $field_name, $type) {
66 $edit = [ 66 $edit = [
67 'title[0][value]' => $this->randomMachineName(), 67 'title[0][value]' => $this->randomMachineName(),
68 ]; 68 ];
69 $edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri); 69 $edit['files[' . $field_name . '_0]'] = \Drupal::service('file_system')->realpath($image->uri);
70 $this->drupalPostForm('node/add/' . $type, $edit, t('Preview')); 70 $this->drupalPostForm('node/add/' . $type, $edit, t('Preview'));
71 } 71 }
72 72
73 /** 73 /**
74 * Upload an image to a node. 74 * Upload an image to a node.
84 */ 84 */
85 public function uploadNodeImage($image, $field_name, $type, $alt = '') { 85 public function uploadNodeImage($image, $field_name, $type, $alt = '') {
86 $edit = [ 86 $edit = [
87 'title[0][value]' => $this->randomMachineName(), 87 'title[0][value]' => $this->randomMachineName(),
88 ]; 88 ];
89 $edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri); 89 $edit['files[' . $field_name . '_0]'] = \Drupal::service('file_system')->realpath($image->uri);
90 $this->drupalPostForm('node/add/' . $type, $edit, t('Save and publish')); 90 $this->drupalPostForm('node/add/' . $type, $edit, t('Save and publish'));
91 if ($alt) { 91 if ($alt) {
92 // Add alt text. 92 // Add alt text.
93 $this->drupalPostForm(NULL, [$field_name . '[0][alt]' => $alt], t('Save and publish')); 93 $this->drupalPostForm(NULL, [$field_name . '[0][alt]' => $alt], t('Save and publish'));
94 } 94 }