Skip to content
Snippets Groups Projects

Issue #3260698: Make it simpler to disable validators in tests

Merged Issue #3260698: Make it simpler to disable validators in tests
All threads resolved!
Merged Ted Bowman requested to merge issue/automatic_updates-3260698:3260698-ted-try into 8.x-2.x
All threads resolved!
1 file
+ 4
8
Compare changes
  • Side-by-side
  • Inline
@@ -3,7 +3,6 @@
namespace Drupal\Tests\automatic_updates\Functional;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Tests\automatic_updates\Traits\ValidationTestTrait;
use Drupal\Tests\BrowserTestBase;
@@ -93,18 +92,15 @@ abstract class AutomaticUpdatesFunctionalTestBase extends BrowserTestBase {
}
/**
* Disables validators in kernel and functional tests.
* Disables validators.
*
* This modifies the service container such that the disabled validators are
* still defined as services, but not tagged as event subscribers.
* This modifies the service container such that the disabled validators only
* point to stdClass.
*
* @param string[] $validators
* The service IDs of the validators to disable.
* @param \Drupal\Core\DependencyInjection\ContainerBuilder|null $container
* (optional) The service container to modify. Only meaningful in kernel
* tests.
*/
protected function disableValidators(array $validators, ContainerBuilder $container = NULL): void {
protected function disableValidators(array $validators): void {
$services_file = $this->siteDirectory . '/services.yml';
$services = file_get_contents($services_file);
$services = Yaml::decode($services);
Loading