function FileTestBase::assertDifferentFile

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

Parameters

$file1: File object to compare.

$file2: File object to compare.

8 calls to FileTestBase::assertDifferentFile()
CopyTest::testExistingError in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test that copying over an existing file fails when FILE_EXISTS_ERROR is specified.
CopyTest::testExistingRename in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test renaming when copying over a file that already exists.
CopyTest::testExistingReplace in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test replacement when copying over a file that already exists.
CopyTest::testNormal in drupal/core/modules/file/lib/Drupal/file/Tests/CopyTest.php
Test file copying in the normal, base case.
MoveTest::testExistingError in drupal/core/modules/file/lib/Drupal/file/Tests/MoveTest.php
Test that moving onto an existing file fails when FILE_EXISTS_ERROR is specified.

... See full list

File

drupal/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php, line 55
Definition of Drupal\system\Tests\File\FileTestBase.

Class

FileTestBase
Base class for file tests that adds some additional file specific assertions and helper functions.

Namespace

Drupal\system\Tests\File

Code

function assertDifferentFile($file1, $file2) {
  $this
    ->assertNotEqual($file1->fid, $file2->fid, t('Files have different ids: %file1 != %file2.', array(
    '%file1' => $file1->fid,
    '%file2' => $file2->fid,
  )), 'Different file');
  $this
    ->assertNotEqual($file1->uri, $file2->uri, t('Files have different paths: %file1 != %file2.', array(
    '%file1' => $file1->uri,
    '%file2' => $file2->uri,
  )), 'Different file');
}