function FileTestBase::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 FileTestBase::assertFileUnchanged()
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 37
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 assertFileUnchanged($before, $after) {
  $this
    ->assertEqual($before->fid, $after->fid, t('File id is the same: %file1 == %file2.', array(
    '%file1' => $before->fid,
    '%file2' => $after->fid,
  )), 'File unchanged');
  $this
    ->assertEqual($before->uid, $after->uid, t('File owner is the same: %file1 == %file2.', array(
    '%file1' => $before->uid,
    '%file2' => $after->uid,
  )), 'File unchanged');
  $this
    ->assertEqual($before->filename, $after->filename, t('File name is the same: %file1 == %file2.', array(
    '%file1' => $before->filename,
    '%file2' => $after->filename,
  )), 'File unchanged');
  $this
    ->assertEqual($before->uri, $after->uri, t('File path is the same: %file1 == %file2.', array(
    '%file1' => $before->uri,
    '%file2' => $after->uri,
  )), 'File unchanged');
  $this
    ->assertEqual($before->filemime, $after->filemime, t('File MIME type is the same: %file1 == %file2.', array(
    '%file1' => $before->filemime,
    '%file2' => $after->filemime,
  )), 'File unchanged');
  $this
    ->assertEqual($before->filesize, $after->filesize, t('File size is the same: %file1 == %file2.', array(
    '%file1' => $before->filesize,
    '%file2' => $after->filesize,
  )), 'File unchanged');
  $this
    ->assertEqual($before->status, $after->status, t('File status is the same: %file1 == %file2.', array(
    '%file1' => $before->status,
    '%file2' => $after->status,
  )), 'File unchanged');
}