public function ReadOnlyFilesystemTest::testDifferentLogicDiskNotWritable in Automatic Updates 8
Tests the readiness check on read-only file system.
@covers ::run
File
- tests/
src/ Kernel/ ReadinessChecker/ ReadOnlyFilesystemTest.php, line 119
Class
- ReadOnlyFilesystemTest
- @coversDefaultClass \Drupal\automatic_updates\ReadinessChecker\ReadOnlyFilesystem
Namespace
Drupal\Tests\automatic_updates\Kernel\ReadinessCheckerCode
public function testDifferentLogicDiskNotWritable() {
$root = self::getVfsRoot();
// Assert messages if both core and vendor directory are not writable.
$file_system = $this
->createMock(FileSystemInterface::class);
$file_system
->expects($this
->any())
->method('copy')
->willThrowException(new FileException());
$readOnly = new TestReadOnlyFileSystem($root, $this->container
->get('logger.channel.automatic_updates'), $file_system);
$this
->assertEquals([
"Drupal core filesystem at \"{$root}/core\" is read only. Updates to Drupal core cannot be applied against a read only file system.",
"Vendor filesystem at \"{$root}/vendor\" is read only. Updates to the site's code base cannot be applied against a read only file system.",
], $readOnly
->run());
// Assert messages if core directory is not writable.
$file_system = $this
->createMock(FileSystemInterface::class);
$file_system
->method('copy')
->withConsecutive([
'vfs://root/core/core.api.php',
'vfs://root/core/core.api.php.automatic_updates',
], [
'vfs://root/vendor/composer/LICENSE',
'vfs://root/vendor/composer/LICENSE.automatic_updates',
])
->willReturnOnConsecutiveCalls(FALSE, TRUE);
$readOnly = new TestReadOnlyFileSystem($root, $this->container
->get('logger.channel.automatic_updates'), $file_system);
$this
->assertEquals([
"Drupal core filesystem at \"{$root}/core\" is read only. Updates to Drupal core cannot be applied against a read only file system.",
], $readOnly
->run());
// Assert messages if vendor directory is not writable.
$file_system = $this
->createMock(FileSystemInterface::class);
$file_system
->method('copy')
->withConsecutive([
'vfs://root/core/core.api.php',
'vfs://root/core/core.api.php.automatic_updates',
], [
'vfs://root/vendor/composer/LICENSE',
'vfs://root/vendor/composer/LICENSE.automatic_updates',
])
->willReturnOnConsecutiveCalls(TRUE, FALSE);
$readOnly = new TestReadOnlyFileSystem($root, $this->container
->get('logger.channel.automatic_updates'), $file_system);
$this
->assertEquals([
"Vendor filesystem at \"{$root}/vendor\" is read only. Updates to the site's code base cannot be applied against a read only file system.",
], $readOnly
->run());
}