function FileTestCase::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 FileTestCase::assertDifferentFile()
FileCopyTest::testExistingError in drupal/modules/simpletest/tests/file.test
Test that copying over an existing file fails when FILE_EXISTS_ERROR is specified.
FileCopyTest::testExistingRename in drupal/modules/simpletest/tests/file.test
Test renaming when copying over a file that already exists.
FileCopyTest::testExistingReplace in drupal/modules/simpletest/tests/file.test
Test replacement when copying over a file that already exists.
FileCopyTest::testNormal in drupal/modules/simpletest/tests/file.test
Test file copying in the normal, base case.
FileMoveTest::testExistingError in drupal/modules/simpletest/tests/file.test
Test that moving onto an existing file fails when FILE_EXISTS_ERROR is specified.

... See full list

File

drupal/modules/simpletest/tests/file.test, line 77
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Class

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

Code

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