public function FileManagedUnitTestBase::assertFileUnchanged in Drupal 9
Same name and namespace in other branches
- 8 core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php \Drupal\Tests\file\Kernel\FileManagedUnitTestBase::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.
14 calls to FileManagedUnitTestBase::assertFileUnchanged()
- CopyTest::testExistingError in core/
modules/ file/ tests/ src/ Kernel/ CopyTest.php - Tests that copying over an existing file fails when instructed to do so.
- CopyTest::testExistingRename in core/
modules/ file/ tests/ src/ Kernel/ CopyTest.php - Tests renaming when copying over a file that already exists.
- CopyTest::testExistingReplace in core/
modules/ file/ tests/ src/ Kernel/ CopyTest.php - Tests replacement when copying over a file that already exists.
- CopyTest::testNormal in core/
modules/ file/ tests/ src/ Kernel/ CopyTest.php - Tests file copying in the normal, base case.
- MoveTest::testExistingError in core/
modules/ file/ tests/ src/ Kernel/ MoveTest.php - Tests that moving onto an existing file fails when instructed to do so.
File
- core/
modules/ file/ tests/ src/ Kernel/ FileManagedUnitTestBase.php, line 110
Class
- FileManagedUnitTestBase
- Base class for file unit tests that use the file_test module to test uploads and hooks.
Namespace
Drupal\Tests\file\KernelCode
public function assertFileUnchanged(FileInterface $before, FileInterface $after) {
$this
->assertEquals($before
->id(), $after
->id(), 'File id is the same');
$this
->assertEquals($before
->getOwner()
->id(), $after
->getOwner()
->id(), 'File owner is the same');
$this
->assertEquals($before
->getFilename(), $after
->getFilename(), 'File name is the same');
$this
->assertEquals($before
->getFileUri(), $after
->getFileUri(), 'File path is the same');
$this
->assertEquals($before
->getMimeType(), $after
->getMimeType(), 'File MIME type is the same');
$this
->assertEquals($before
->getSize(), $after
->getSize(), 'File size is the same');
$this
->assertEquals($before
->isPermanent(), $after
->isPermanent(), 'File status is the same');
}