Commit 44949a18 authored by webchick's avatar webchick

Issue #2555183 by jhedstrom, Gábor Hojtsy, mikeryan, stefan.r, xjm: Fix the...

Issue #2555183 by jhedstrom, Gábor Hojtsy, mikeryan, stefan.r, xjm: Fix the filled update tests, they are broken
parent 6c04c93e
...@@ -17,9 +17,9 @@ class BlockContextMappingUpdateFilledTest extends BlockContextMappingUpdateTest ...@@ -17,9 +17,9 @@ class BlockContextMappingUpdateFilledTest extends BlockContextMappingUpdateTest
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
$this->databaseDumpFiles[0] = __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz'; $this->databaseDumpFiles[0] = __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz';
parent::setUp();
} }
} }
...@@ -28,12 +28,11 @@ class BlockContextMappingUpdateTest extends UpdatePathTestBase { ...@@ -28,12 +28,11 @@ class BlockContextMappingUpdateTest extends UpdatePathTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [ $this->databaseDumpFiles = [
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php', __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.block-context-manager-2354889.php',
]; ];
parent::setUp();
} }
/** /**
......
...@@ -17,9 +17,9 @@ class SqlContentEntityStorageSchemaIndexFilledTest extends SqlContentEntityStora ...@@ -17,9 +17,9 @@ class SqlContentEntityStorageSchemaIndexFilledTest extends SqlContentEntityStora
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setUp() { protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
$this->databaseDumpFiles[0] = __DIR__ . '/../../../../tests/fixtures/update/drupal-8.filled.standard.php.gz'; $this->databaseDumpFiles[0] = __DIR__ . '/../../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
parent::setUp();
} }
} }
...@@ -19,11 +19,10 @@ class SqlContentEntityStorageSchemaIndexTest extends UpdatePathTestBase { ...@@ -19,11 +19,10 @@ class SqlContentEntityStorageSchemaIndexTest extends UpdatePathTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [ $this->databaseDumpFiles = [
__DIR__ . '/../../../../tests/fixtures/update/drupal-8.bare.standard.php.gz', __DIR__ . '/../../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
]; ];
parent::setUp();
} }
/** /**
......
...@@ -17,9 +17,9 @@ class MenuTreeSerializationTitleFilledTest extends MenuTreeSerializationTitleTes ...@@ -17,9 +17,9 @@ class MenuTreeSerializationTitleFilledTest extends MenuTreeSerializationTitleTes
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setUp() { protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
$this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz'; $this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
parent::setUp();
} }
} }
...@@ -19,11 +19,10 @@ class MenuTreeSerializationTitleTest extends UpdatePathTestBase { ...@@ -19,11 +19,10 @@ class MenuTreeSerializationTitleTest extends UpdatePathTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [ $this->databaseDumpFiles = [
__DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz', __DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
]; ];
parent::setUp();
} }
/** /**
......
...@@ -16,9 +16,9 @@ class RouterIndexOptimizationFilledTest extends RouterIndexOptimizationTest { ...@@ -16,9 +16,9 @@ class RouterIndexOptimizationFilledTest extends RouterIndexOptimizationTest {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setUp() { protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
$this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz'; $this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
parent::setUp();
} }
} }
...@@ -15,11 +15,10 @@ class RouterIndexOptimizationTest extends UpdatePathTestBase { ...@@ -15,11 +15,10 @@ class RouterIndexOptimizationTest extends UpdatePathTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [ $this->databaseDumpFiles = [
__DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz', __DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
]; ];
parent::setUp();
} }
/** /**
......
...@@ -130,9 +130,6 @@ abstract class UpdatePathTestBase extends WebTestBase { ...@@ -130,9 +130,6 @@ abstract class UpdatePathTestBase extends WebTestBase {
function __construct($test_id = NULL) { function __construct($test_id = NULL) {
parent::__construct($test_id); parent::__construct($test_id);
$this->zlibInstalled = function_exists('gzopen'); $this->zlibInstalled = function_exists('gzopen');
// Set the update url.
$this->updateUrl = Url::fromRoute('system.db_update');
} }
/** /**
...@@ -144,6 +141,10 @@ function __construct($test_id = NULL) { ...@@ -144,6 +141,10 @@ function __construct($test_id = NULL) {
* container that would normally be done via the installer. * container that would normally be done via the installer.
*/ */
protected function setUp() { protected function setUp() {
// Allow classes to set database dump files.
$this->setDatabaseDumpFiles();
// We are going to set a missing zlib requirement property for usage // We are going to set a missing zlib requirement property for usage
// during the performUpgrade() and tearDown() methods. Also set that the // during the performUpgrade() and tearDown() methods. Also set that the
// tests failed. // tests failed.
...@@ -152,6 +153,11 @@ protected function setUp() { ...@@ -152,6 +153,11 @@ protected function setUp() {
return; return;
} }
// Set the update url. This must be set here rather than in
// self::__construct() or the old URL generator will leak additional test
// sites.
$this->updateUrl = Url::fromRoute('system.db_update');
// These methods are called from parent::setUp(). // These methods are called from parent::setUp().
$this->setBatch(); $this->setBatch();
$this->initUserSession(); $this->initUserSession();
...@@ -191,6 +197,11 @@ protected function setUp() { ...@@ -191,6 +197,11 @@ protected function setUp() {
$account->save(); $account->save();
} }
/**
* Set database dump files to be used.
*/
abstract protected function setDatabaseDumpFiles();
/** /**
* Add settings that are missed since the installer isn't run. * Add settings that are missed since the installer isn't run.
*/ */
...@@ -238,6 +249,9 @@ protected function runUpdates() { ...@@ -238,6 +249,9 @@ protected function runUpdates() {
// Run the update hooks. // Run the update hooks.
$this->clickLink(t('Apply pending updates')); $this->clickLink(t('Apply pending updates'));
// Ensure there are no failed updates.
$this->assertNoRaw('<strong>' . t('Failed:') . '</strong>');
// The config schema can be incorrect while the update functions are being // 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 // executed. But once the update has been completed, it needs to be valid
// again. Assert the schema of all configuration objects now. // again. Assert the schema of all configuration objects now.
......
...@@ -17,9 +17,8 @@ class UpdatePathTestBaseFilledTest extends UpdatePathTestBaseTest { ...@@ -17,9 +17,8 @@ class UpdatePathTestBaseFilledTest extends UpdatePathTestBaseTest {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz'; $this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
parent::setUp();
} }
} }
...@@ -24,9 +24,8 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase { ...@@ -24,9 +24,8 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [__DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz']; $this->databaseDumpFiles = [__DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz'];
parent::setUp();
} }
/** /**
......
...@@ -17,9 +17,9 @@ class UpdatePathWithBrokenRoutingFilledTest extends UpdatePathWithBrokenRoutingT ...@@ -17,9 +17,9 @@ class UpdatePathWithBrokenRoutingFilledTest extends UpdatePathWithBrokenRoutingT
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles[0] = '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz'; parent::setDatabaseDumpFiles();
parent::setUp(); $this->databaseDumpFiles[0] = __DIR__ . '/../../../tests/fixtures/update/drupal-8.filled.standard.php.gz';
} }
} }
...@@ -17,22 +17,17 @@ class UpdatePathWithBrokenRoutingTest extends UpdatePathTestBase { ...@@ -17,22 +17,17 @@ class UpdatePathWithBrokenRoutingTest extends UpdatePathTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [ $this->databaseDumpFiles = [
__DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz', __DIR__ . '/../../../tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../tests/fixtures/update/drupal-8.broken_routing.php', __DIR__ . '/../../../tests/fixtures/update/drupal-8.broken_routing.php',
]; ];
parent::setUp();
} }
/** /**
* Tests running update.php with some form of broken routing. * Tests running update.php with some form of broken routing.
*/ */
public function testWithBrokenRouting() { public function testWithBrokenRouting() {
// Make sure we can get to the front page.
$this->drupalGet('<front>');
$this->assertResponse(200);
// Simulate a broken router, and make sure the front page is // Simulate a broken router, and make sure the front page is
// inaccessible. // inaccessible.
\Drupal::state()->set('update_script_test_broken_inbound', TRUE); \Drupal::state()->set('update_script_test_broken_inbound', TRUE);
......
...@@ -17,9 +17,9 @@ class EntityViewsDataUpdateFilledTest extends EntityViewsDataUpdateTest { ...@@ -17,9 +17,9 @@ class EntityViewsDataUpdateFilledTest extends EntityViewsDataUpdateTest {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
parent::setDatabaseDumpFiles();
$this->databaseDumpFiles[0] = __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz'; $this->databaseDumpFiles[0] = __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz';
parent::setUp();
} }
} }
...@@ -22,13 +22,11 @@ class EntityViewsDataUpdateTest extends UpdatePathTestBase { ...@@ -22,13 +22,11 @@ class EntityViewsDataUpdateTest extends UpdatePathTestBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function setUp() { protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [ $this->databaseDumpFiles = [
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php', __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.views-entity-views-data-2455125.php',
]; ];
parent::setUp();
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment