You are here

function FileTestCase::assertDifferentFile in SimpleTest 7

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

... See full list

File

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, 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');
}