Skip to content
Snippets Groups Projects
Commit 193dd554 authored by Edys Meza's avatar Edys Meza
Browse files

Issue #3167034: fixing more tests.

parent 7f6892f5
No related branches found
No related tags found
9 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage",!13Resolve #2903456,!6#3167034 "Leverage the 'loading' html attribute to enable lazy-load by default for images"
......@@ -2,9 +2,11 @@
namespace Drupal\Tests\editor\Functional;
use Drupal\Core\File\FileSystemInterface;
use Drupal\file\Entity\File;
use Drupal\node\NodeInterface;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\TestFileCreationTrait;
use Drupal\user\Entity\Role;
use Drupal\user\RoleInterface;
......@@ -15,6 +17,8 @@
*/
class EditorPrivateFileReferenceFilterTest extends BrowserTestBase {
use TestFileCreationTrait;
/**
* Modules to enable.
*
......@@ -49,6 +53,10 @@ public function testEditorPrivateFileReferenceFilter() {
// Create a content type with a body field.
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
// Get test files.
/** @var array stdClass */
$files = $this->getTestFiles('image');
$image = reset($files);
// Create a file in the 'private:// ' stream.
$filename = 'test.png';
$src = '/system/files/' . $filename;
......@@ -59,7 +67,7 @@ public function testEditorPrivateFileReferenceFilter() {
$file->setTemporary();
$file->setOwner($author);
// Create the file itself.
file_put_contents($file->getFileUri(), $this->randomString());
\Drupal::service('file_system')->copy($image->uri, $file->getFileUri(), FileSystemInterface::EXISTS_RENAME);
$file->save();
// The image should be visible for its author.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment