function FileManagedTestBase::assertFileUnchanged in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/file/src/Tests/FileManagedTestBase.php \Drupal\file\Tests\FileManagedTestBase::assertFileUnchanged()
Asserts that two files have the same values (except timestamp).
Parameters
\Drupal\file\FileInterface $before: File object to compare.
\Drupal\file\FileInterface $after: File object to compare.
File
- core/
modules/ file/ src/ Tests/ FileManagedTestBase.php, line 100 - Contains \Drupal\file\Tests\FileManagedTestBase.
Class
- FileManagedTestBase
- Base class for file tests that use the file_test module to test uploads and hooks.
Namespace
Drupal\file\TestsCode
function assertFileUnchanged(FileInterface $before, FileInterface $after) {
$this
->assertEqual($before
->id(), $after
->id(), t('File id is the same: %file1 == %file2.', array(
'%file1' => $before
->id(),
'%file2' => $after
->id(),
)), 'File unchanged');
$this
->assertEqual($before
->getOwner()
->id(), $after
->getOwner()
->id(), t('File owner is the same: %file1 == %file2.', array(
'%file1' => $before
->getOwner()
->id(),
'%file2' => $after
->getOwner()
->id(),
)), 'File unchanged');
$this
->assertEqual($before
->getFilename(), $after
->getFilename(), t('File name is the same: %file1 == %file2.', array(
'%file1' => $before
->getFilename(),
'%file2' => $after
->getFilename(),
)), 'File unchanged');
$this
->assertEqual($before
->getFileUri(), $after
->getFileUri(), t('File path is the same: %file1 == %file2.', array(
'%file1' => $before
->getFileUri(),
'%file2' => $after
->getFileUri(),
)), 'File unchanged');
$this
->assertEqual($before
->getMimeType(), $after
->getMimeType(), t('File MIME type is the same: %file1 == %file2.', array(
'%file1' => $before
->getMimeType(),
'%file2' => $after
->getMimeType(),
)), 'File unchanged');
$this
->assertEqual($before
->getSize(), $after
->getSize(), t('File size is the same: %file1 == %file2.', array(
'%file1' => $before
->getSize(),
'%file2' => $after
->getSize(),
)), 'File unchanged');
$this
->assertEqual($before
->isPermanent(), $after
->isPermanent(), t('File status is the same: %file1 == %file2.', array(
'%file1' => $before
->isPermanent(),
'%file2' => $after
->isPermanent(),
)), 'File unchanged');
}