comparison core/modules/image/src/Tests/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
67 */ 67 */
68 public function previewNodeImage($image, $field_name, $type) { 68 public function previewNodeImage($image, $field_name, $type) {
69 $edit = [ 69 $edit = [
70 'title[0][value]' => $this->randomMachineName(), 70 'title[0][value]' => $this->randomMachineName(),
71 ]; 71 ];
72 $edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri); 72 $edit['files[' . $field_name . '_0]'] = \Drupal::service('file_system')->realpath($image->uri);
73 $this->drupalPostForm('node/add/' . $type, $edit, t('Preview')); 73 $this->drupalPostForm('node/add/' . $type, $edit, t('Preview'));
74 } 74 }
75 75
76 /** 76 /**
77 * Upload an image to a node. 77 * Upload an image to a node.
87 */ 87 */
88 public function uploadNodeImage($image, $field_name, $type, $alt = '') { 88 public function uploadNodeImage($image, $field_name, $type, $alt = '') {
89 $edit = [ 89 $edit = [
90 'title[0][value]' => $this->randomMachineName(), 90 'title[0][value]' => $this->randomMachineName(),
91 ]; 91 ];
92 $edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri); 92 $edit['files[' . $field_name . '_0]'] = \Drupal::service('file_system')->realpath($image->uri);
93 $this->drupalPostForm('node/add/' . $type, $edit, t('Save')); 93 $this->drupalPostForm('node/add/' . $type, $edit, t('Save'));
94 if ($alt) { 94 if ($alt) {
95 // Add alt text. 95 // Add alt text.
96 $this->drupalPostForm(NULL, [$field_name . '[0][alt]' => $alt], t('Save')); 96 $this->drupalPostForm(NULL, [$field_name . '[0][alt]' => $alt], t('Save'));
97 } 97 }