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

... See full list

File

modules/simpletest/tests/file.test, line 77

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.