You are here

public function FileManagedTestBase::assertDifferentFile in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Functional/FileManagedTestBase.php \Drupal\Tests\file\Functional\FileManagedTestBase::assertDifferentFile()
  2. 9 core/modules/file/tests/src/Functional/FileManagedTestBase.php \Drupal\Tests\file\Functional\FileManagedTestBase::assertDifferentFile()

Asserts that two files are not the same by comparing the fid and filepath.

Parameters

\Drupal\file\FileInterface $file1: File object to compare.

\Drupal\file\FileInterface $file2: File object to compare.

File

core/modules/file/tests/src/Functional/FileManagedTestBase.php, line 115

Class

FileManagedTestBase
Base class for file tests that use the file_test module to test uploads and hooks.

Namespace

Drupal\Tests\file\Functional

Code

public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
  $this
    ->assertNotEquals($file1
    ->id(), $file2
    ->id());
  $this
    ->assertNotEquals($file1
    ->getFileUri(), $file2
    ->getFileUri());
}