Issue #2550407 by Berdir: Strict config schema breaks update tests, switch to testing the configuration at the end instead

8.0.x
Alex Pott 2015-08-13 09:19:17 +01:00
parent 8071554098
commit e27e962b4a
2 changed files with 30 additions and 0 deletions

View File

@ -8,6 +8,7 @@
namespace Drupal\system\Tests\Update;
use Drupal\Component\Utility\Crypt;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\Core\Database\Database;
use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
@ -35,6 +36,8 @@ use Symfony\Component\HttpFoundation\Request;
*/
abstract class UpdatePathTestBase extends WebTestBase {
use SchemaCheckTestTrait;
/**
* Modules to enable after the database is loaded.
*/
@ -100,6 +103,15 @@ abstract class UpdatePathTestBase extends WebTestBase {
*/
protected $updateUrl;
/**
* Disable strict config schema checking.
*
* The schema is verified at the end of running the update.
*
* @var bool
*/
protected $strictConfigSchema = FALSE;
/**
* Constructs an UpdatePathTestCase object.
*
@ -217,6 +229,17 @@ abstract class UpdatePathTestBase extends WebTestBase {
// Run the update hooks.
$this->clickLink(t('Apply pending updates'));
// The config schema can be incorrect while the update functions are being
// executed. But once the update has been completed, it needs to be valid
// again. Assert the schema of all configuration objects now.
$names = $this->container->get('config.storage')->listAll();
/** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */
$typed_config = $this->container->get('config.typed');
foreach ($names as $name) {
$config = $this->config($name);
$this->assertConfigSchema($typed_config, $name, $config->get());
}
}
/**

View File

@ -1203,3 +1203,10 @@ function system_update_8001(&$sandbox = NULL) {
}
}
/**
* Removes the system.filter configuration.
*/
function system_update_8002() {
\Drupal::configFactory()->getEditable('system.filter')->delete();
return t('The system.filter configuration has been moved to a container parameter, see default.services.yml for more information.');
}