diff --git a/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php b/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php index 2e9ad4812bf178df171c1eed9ffe6d977e17a8fa..e9b95a50efe857846cd262b3ad23311005f9eb74 100644 --- a/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php +++ b/package_manager/tests/modules/package_manager_bypass/src/PackageManagerBypassServiceProvider.php @@ -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']); } } diff --git a/package_manager/tests/src/Functional/ExcludedPathsTest.php b/package_manager/tests/src/Functional/ExcludedPathsTest.php index 3fbe8808ab6063c5abccc41f9d649dcc2657b50e..97ed57a8a29ad10434f9849f0bc87cab338c2d99 100644 --- a/package_manager/tests/src/Functional/ExcludedPathsTest.php +++ b/package_manager/tests/src/Functional/ExcludedPathsTest.php @@ -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.