function FileTestCase::assertFileUnchanged
Check that two files have the same values for all fields other than the timestamp.
Parameters
$before: File object to compare.
$after: File object to compare.
14 calls to FileTestCase::assertFileUnchanged()
- 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.
File
-
modules/
simpletest/ tests/ file.test, line 59
Class
- FileTestCase
- Base class for file tests that adds some additional file specific assertions and helper functions.
Code
function assertFileUnchanged($before, $after) {
$this->assertEqual($before->fid, $after->fid, format_string('File id is the same: %file1 == %file2.', array(
'%file1' => $before->fid,
'%file2' => $after->fid,
)), 'File unchanged');
$this->assertEqual($before->uid, $after->uid, format_string('File owner is the same: %file1 == %file2.', array(
'%file1' => $before->uid,
'%file2' => $after->uid,
)), 'File unchanged');
$this->assertEqual($before->filename, $after->filename, format_string('File name is the same: %file1 == %file2.', array(
'%file1' => $before->filename,
'%file2' => $after->filename,
)), 'File unchanged');
$this->assertEqual($before->uri, $after->uri, format_string('File path is the same: %file1 == %file2.', array(
'%file1' => $before->uri,
'%file2' => $after->uri,
)), 'File unchanged');
$this->assertEqual($before->filemime, $after->filemime, format_string('File MIME type is the same: %file1 == %file2.', array(
'%file1' => $before->filemime,
'%file2' => $after->filemime,
)), 'File unchanged');
$this->assertEqual($before->filesize, $after->filesize, format_string('File size is the same: %file1 == %file2.', array(
'%file1' => $before->filesize,
'%file2' => $after->filesize,
)), 'File unchanged');
$this->assertEqual($before->status, $after->status, format_string('File status is the same: %file1 == %file2.', array(
'%file1' => $before->status,
'%file2' => $after->status,
)), 'File unchanged');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.