Skip to content
Snippets Groups Projects
Commit 99d1c92d authored by Adam G-H's avatar Adam G-H
Browse files

Bypass FS validator

parent e8489a0d
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ namespace Drupal\package_manager_bypass;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Drupal\Core\Site\Settings;
/**
* Defines services to bypass Package Manager's core functionality.
......@@ -20,6 +21,12 @@ class PackageManagerBypassServiceProvider extends ServiceProviderBase {
->setClass(Beginner::class);
$container->getDefinition('package_manager.stager')
->setClass(Stager::class);
// Allow functional tests to disable specific validators as necessary.
// Kernel tests can override the ::register() method and modify the
// container directly.
$validators = Settings::get('package_manager_bypass_validators', []);
array_walk($validators, [$container, 'removeDefinition']);
}
}
......@@ -22,7 +22,32 @@ class ExcludedPathsTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['package_manager'];
protected static $modules = [
'package_manager',
'package_manager_bypass',
];
/**
* {@inheritdoc}
*/
protected function prepareSettings() {
parent::prepareSettings();
// Disable the filesystem permissions validator, since we cannot guarantee
// that the current code base will be writable in all testing situations.
// We test this validator functionally in Automatic Updates' build tests,
// since those do give us control over the filesystem permissions.
// @see \Drupal\Tests\automatic_updates\Build\CoreUpdateTest::assertReadOnlyFileSystemError()
// @see \Drupal\Tests\package_manager\Kernel\WritableFileSystemValidatorTest
$this->writeSettings([
'settings' => [
'package_manager_bypass_validators' => (object) [
'value' => ['package_manager.validator.file_system'],
'required' => TRUE,
],
],
]);
}
/**
* Tests that certain paths are excluded from staging areas.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment