function WritableFileSystemValidatorTest::testWritableDuringPreApply
Tests the file system permissions validator during pre-apply.
@dataProvider providerWritable
Parameters
int $root_permissions: The file permissions for the root folder.
int $webroot_permissions: The file permissions for the web root folder.
int $vendor_permissions: The file permissions for the vendor folder.
string $webroot_relative_directory: The web root path, relative to the project root, or an empty string if the web root and project root are the same.
\Drupal\package_manager\ValidationResult[] $expected_results: The expected validation results.
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ WritableFileSystemValidatorTest.php, line 155
Class
- WritableFileSystemValidatorTest
- Unit tests the file system permissions validator.
Namespace
Drupal\Tests\package_manager\KernelCode
public function testWritableDuringPreApply(int $root_permissions, int $webroot_permissions, int $vendor_permissions, string $webroot_relative_directory, array $expected_results) : void {
$this->addEventTestListener(function () use ($webroot_permissions, $root_permissions, $vendor_permissions, $webroot_relative_directory) : void {
$this->setUpPermissions($root_permissions, $webroot_permissions, $vendor_permissions, $webroot_relative_directory);
// During pre-apply we don't care whether the staging root is writable.
/** @var \Drupal\package_manager_bypass\MockPathLocator $path_locator */
$path_locator = $this->container
->get(PathLocator::class);
$this->assertTrue(chmod($path_locator->getStagingRoot(), 0550));
});
$this->assertResults($expected_results, PreApplyEvent::class);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.