function FileManagedUnitTestBase::assertFileUnchanged
Same name in other branches
- 9 core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php \Drupal\Tests\file\Kernel\FileManagedUnitTestBase::assertFileUnchanged()
- 8.9.x core/modules/file/tests/src/Kernel/FileManagedUnitTestBase.php \Drupal\Tests\file\Kernel\FileManagedUnitTestBase::assertFileUnchanged()
- 10 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.
13 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.
- FileRepositoryTest::testExistingError in core/
modules/ file/ tests/ src/ Kernel/ FileRepositoryTest.php - Tests that writeData() fails overwriting an existing file.
File
-
core/
modules/ file/ tests/ src/ Kernel/ FileManagedUnitTestBase.php, line 111
Class
- FileManagedUnitTestBase
- Provides a base class for testing file uploads and hook invocations.
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');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.