diff --git a/core/modules/comment/src/Tests/CommentPreviewTest.php b/core/modules/comment/src/Tests/CommentPreviewTest.php index 8d188c3..e2632cf 100644 --- a/core/modules/comment/src/Tests/CommentPreviewTest.php +++ b/core/modules/comment/src/Tests/CommentPreviewTest.php @@ -44,7 +44,11 @@ function testCommentPreview() { \Drupal::config('user.settings')->set('signatures', 1)->save(); $test_signature = $this->randomMachineName(); $edit['signature[value]'] = '' . $test_signature. ''; - $image = current($this->drupalGetTestFiles('image')); + foreach ($this->drupalGetTestFiles('image') as $image) { + if ($image->filename == 'image-test.png') { + break; + } + } $edit['files[user_picture_0]'] = drupal_realpath($image->uri); $this->drupalPostForm('user/' . $this->web_user->id() . '/edit', $edit, t('Save')); diff --git a/core/modules/image/src/Tests/ImageAdminStylesTest.php b/core/modules/image/src/Tests/ImageAdminStylesTest.php index ef53426..881475f 100644 --- a/core/modules/image/src/Tests/ImageAdminStylesTest.php +++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php @@ -298,7 +298,11 @@ function testStyleReplacement() { ->save(); // Create a new node with an image attached. - $test_image = current($this->drupalGetTestFiles('image')); + foreach ($this->drupalGetTestFiles('image') as $test_image) { + if ($test_image->filename == 'image-test.png') { + break; + } + } $nid = $this->uploadNodeImage($test_image, $field_name, 'article'); $node = Node::load($nid); @@ -436,7 +440,11 @@ function testConfigImport() { ->save(); // Create a new node with an image attached. - $test_image = current($this->drupalGetTestFiles('image')); + foreach ($this->drupalGetTestFiles('image') as $test_image) { + if ($test_image->filename == 'image-test.png') { + break; + } + } $nid = $this->uploadNodeImage($test_image, $field_name, 'article'); $node = Node::load($nid); diff --git a/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php b/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php index ec41a77..e9a1fb5 100644 --- a/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php +++ b/core/modules/rdf/src/Tests/ImageFieldAttributesTest.php @@ -63,7 +63,11 @@ protected function setUp() { ->save(); // Get the test image that simpletest provides. - $image = current($this->drupalGetTestFiles('image')); + foreach ($this->drupalGetTestFiles('image') as $image) { + if ($image->filename == 'image-test.png') { + break; + } + } // Save a node with the image. $nid = $this->uploadNodeImage($image, $this->fieldName, 'article'); diff --git a/core/modules/user/src/Tests/UserPictureTest.php b/core/modules/user/src/Tests/UserPictureTest.php index 639c382..d609413 100644 --- a/core/modules/user/src/Tests/UserPictureTest.php +++ b/core/modules/user/src/Tests/UserPictureTest.php @@ -48,7 +48,11 @@ function testCreateDeletePicture() { $this->drupalLogin($this->web_user); // Save a new picture. - $image = current($this->drupalGetTestFiles('image')); + foreach ($this->drupalGetTestFiles('image') as $image) { + if ($image->filename == 'image-test.png') { + break; + } + } $file = $this->saveUserPicture($image); // Verify that the image is displayed on the user account page. @@ -85,7 +89,11 @@ function testPictureOnNodeComment() { $this->drupalLogin($this->web_user); // Save a new picture. - $image = current($this->drupalGetTestFiles('image')); + foreach ($this->drupalGetTestFiles('image') as $image) { + if ($image->filename == 'image-test.png') { + break; + } + } $file = $this->saveUserPicture($image); $node = $this->drupalCreateNode(array('type' => 'article'));