Verified Commit abde03f3 authored by Jess's avatar Jess
Browse files

Issue #3043127 by liam morland, mohit_aghera, pancho, smustgrave, xjm,...

Issue #3043127 by liam morland, mohit_aghera, pancho, smustgrave, xjm, quietone: FileFieldTestBase::assertFileEntryNotExists() should be documented, typehinted, and accept a null value for $message

(cherry picked from commit f9563f61)
parent 0abe4670
Loading
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -17161,12 +17161,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/file/tests/src/Functional/FileFieldTestBase.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\file\\\\Functional\\\\FileFieldTestBase\\:\\:assertFileEntryNotExists\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/file/tests/src/Functional/FileFieldTestBase.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\file\\\\Functional\\\\FileFieldTestBase\\:\\:assertFileIsPermanent\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+6 −1
Original line number Diff line number Diff line
@@ -227,8 +227,13 @@ public function assertFileEntryExists($file, $message = NULL) {

  /**
   * Asserts that a file does not exist in the database.
   *
   * @param \Drupal\file\FileInterface $file
   *   The file to be validated.
   * @param string|null $message
   *   (optional) A message to display with the assertion.
   */
  public function assertFileEntryNotExists($file, $message) {
  public function assertFileEntryNotExists(FileInterface $file, ?string $message = NULL): void {
    $this->container->get('entity_type.manager')->getStorage('file')->resetCache();
    $message = $message ?? sprintf('File %s exists in database at the correct path.', $file->getFileUri());
    $this->assertNull(File::load($file->id()), $message);