Issue #3416074 by catch, longwave: UpdatePathTestBaseFilledTest is mostly pointless
parent
d0677640d2
commit
c5e634873a
|
@ -15,6 +15,7 @@ use Drupal\views\Entity\View;
|
|||
* Create, view, edit, delete, and change shortcut links.
|
||||
*
|
||||
* @group shortcut
|
||||
* @group #slow
|
||||
*/
|
||||
class ShortcutLinksTest extends ShortcutTestBase {
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use Symfony\Component\Routing\Route;
|
|||
* Tests low-level theme functions.
|
||||
*
|
||||
* @group Theme
|
||||
* @group #slow
|
||||
*/
|
||||
class ThemeTest extends BrowserTestBase {
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\system\Functional\UpdateSystem;
|
||||
|
||||
use Drupal\FunctionalTests\Update\UpdatePathTestBaseTest;
|
||||
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
use Drupal\user\Entity\User;
|
||||
|
@ -10,12 +10,12 @@ use Drupal\user\Entity\User;
|
|||
// cspell:ignore hola usuario
|
||||
|
||||
/**
|
||||
* Runs UpdatePathTestBaseTest with a dump filled with content.
|
||||
* Runs UpdatePathTestBase with a dump filled with content.
|
||||
*
|
||||
* @group #slow
|
||||
* @group Update
|
||||
*/
|
||||
class UpdatePathTestBaseFilledTest extends UpdatePathTestBaseTest {
|
||||
class UpdatePathTestBaseFilledTest extends UpdatePathTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -26,8 +26,9 @@ class UpdatePathTestBaseFilledTest extends UpdatePathTestBaseTest {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setDatabaseDumpFiles() {
|
||||
parent::setDatabaseDumpFiles();
|
||||
$this->databaseDumpFiles[0] = __DIR__ . '/../../../../tests/fixtures/update/drupal-9.4.0.filled.standard.php.gz';
|
||||
$this->databaseDumpFiles[] = __DIR__ . '/../../../../tests/fixtures/update/drupal-9.4.0.filled.standard.php.gz';
|
||||
$this->databaseDumpFiles[] = __DIR__ . '/../../../../tests/fixtures/update/drupal-8.update-test-schema-enabled.php';
|
||||
$this->databaseDumpFiles[] = __DIR__ . '/../../../../tests/fixtures/update/drupal-8.update-test-semver-update-n-enabled.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -417,4 +418,11 @@ class UpdatePathTestBaseFilledTest extends UpdatePathTestBaseTest {
|
|||
// Do not replace the user from our dump.
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the database was properly loaded.
|
||||
*/
|
||||
public function testDatabaseProperlyLoaded() {
|
||||
$this->testDatabaseLoaded();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait;
|
|||
* Tests load, save and delete for taxonomy terms.
|
||||
*
|
||||
* @group taxonomy
|
||||
* @group #slow
|
||||
*/
|
||||
class TermTest extends TaxonomyTestBase {
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use Drupal\views\Entity\View;
|
|||
* Tests the taxonomy index filter handler UI.
|
||||
*
|
||||
* @group taxonomy
|
||||
* @group #slow
|
||||
* @see \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid
|
||||
*/
|
||||
class TaxonomyIndexTidUiTest extends UITestBase {
|
||||
|
|
|
@ -11,6 +11,7 @@ use Drupal\field\Entity\FieldStorageConfig;
|
|||
* Tests the creation of telephone fields.
|
||||
*
|
||||
* @group telephone
|
||||
* @group #slow
|
||||
*/
|
||||
class TelephoneFieldTest extends BrowserTestBase {
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use Drupal\Tests\TestFileCreationTrait;
|
|||
* Tests the creation of text fields.
|
||||
*
|
||||
* @group text
|
||||
* @group #slow
|
||||
*/
|
||||
class TextFieldTest extends StringFieldTest {
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Drupal\FunctionalTests\Update;
|
||||
|
||||
use Drupal\Component\Utility\Crypt;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Core\Site\Settings;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
use Drupal\Core\Database\Database;
|
||||
|
@ -241,4 +242,58 @@ abstract class UpdatePathTestBase extends BrowserTestBase {
|
|||
$account->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the database was properly loaded.
|
||||
*/
|
||||
protected function testDatabaseLoaded() {
|
||||
// Set a value in the cache to prove caches are cleared.
|
||||
\Drupal::service('cache.default')->set(__CLASS__, 'Test');
|
||||
|
||||
/** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
|
||||
$update_registry = \Drupal::service('update.update_hook_registry');
|
||||
foreach (['user' => 9301, 'node' => 8700, 'system' => 8901, 'update_test_schema' => 8000] as $module => $schema) {
|
||||
$this->assertEquals($schema, $update_registry->getInstalledVersion($module), "Module $module schema is $schema");
|
||||
}
|
||||
|
||||
// Ensure that all {router} entries can be unserialized. If they cannot be
|
||||
// unserialized a notice will be thrown by PHP.
|
||||
|
||||
$result = \Drupal::database()->select('router', 'r')
|
||||
->fields('r', ['name', 'route'])
|
||||
->execute()
|
||||
->fetchAllKeyed(0, 1);
|
||||
// For the purpose of fetching the notices and displaying more helpful error
|
||||
// messages, let's override the error handler temporarily.
|
||||
set_error_handler(function ($severity, $message, $filename, $lineno) {
|
||||
throw new \ErrorException($message, 0, $severity, $filename, $lineno);
|
||||
});
|
||||
foreach ($result as $route_name => $route) {
|
||||
try {
|
||||
unserialize($route);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$this->fail(sprintf('Error "%s" while unserializing route %s', $e->getMessage(), Html::escape($route_name)));
|
||||
}
|
||||
}
|
||||
restore_error_handler();
|
||||
|
||||
// Before accessing the site we need to run updates first or the site might
|
||||
// be broken.
|
||||
$this->runUpdates();
|
||||
$this->assertEquals('standard', \Drupal::config('core.extension')->get('profile'));
|
||||
$this->assertEquals('Site-Install', \Drupal::config('system.site')->get('name'));
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertSession()->pageTextContains('Site-Install');
|
||||
|
||||
// Ensure that the database tasks have been run during set up. Neither MySQL
|
||||
// nor SQLite make changes that are testable.
|
||||
$database = $this->container->get('database');
|
||||
if ($database->driver() == 'pgsql') {
|
||||
$this->assertEquals('on', $database->query("SHOW standard_conforming_strings")->fetchField());
|
||||
$this->assertEquals('escape', $database->query("SHOW bytea_output")->fetchField());
|
||||
}
|
||||
// Ensure the test runners cache has been cleared.
|
||||
$this->assertFalse(\Drupal::service('cache.default')->get(__CLASS__));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Drupal\FunctionalTests\Update;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Site\Settings;
|
||||
|
||||
|
@ -31,55 +30,8 @@ class UpdatePathTestBaseTest extends UpdatePathTestBase {
|
|||
/**
|
||||
* Tests that the database was properly loaded.
|
||||
*/
|
||||
public function testDatabaseLoaded() {
|
||||
// Set a value in the cache to prove caches are cleared.
|
||||
\Drupal::service('cache.default')->set(__CLASS__, 'Test');
|
||||
|
||||
/** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
|
||||
$update_registry = \Drupal::service('update.update_hook_registry');
|
||||
foreach (['user' => 9301, 'node' => 8700, 'system' => 8901, 'update_test_schema' => 8000] as $module => $schema) {
|
||||
$this->assertEquals($schema, $update_registry->getInstalledVersion($module), "Module $module schema is $schema");
|
||||
}
|
||||
|
||||
// Ensure that all {router} entries can be unserialized. If they cannot be
|
||||
// unserialized a notice will be thrown by PHP.
|
||||
|
||||
$result = \Drupal::database()->select('router', 'r')
|
||||
->fields('r', ['name', 'route'])
|
||||
->execute()
|
||||
->fetchAllKeyed(0, 1);
|
||||
// For the purpose of fetching the notices and displaying more helpful error
|
||||
// messages, let's override the error handler temporarily.
|
||||
set_error_handler(function ($severity, $message, $filename, $lineno) {
|
||||
throw new \ErrorException($message, 0, $severity, $filename, $lineno);
|
||||
});
|
||||
foreach ($result as $route_name => $route) {
|
||||
try {
|
||||
unserialize($route);
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
$this->fail(sprintf('Error "%s" while unserializing route %s', $e->getMessage(), Html::escape($route_name)));
|
||||
}
|
||||
}
|
||||
restore_error_handler();
|
||||
|
||||
// Before accessing the site we need to run updates first or the site might
|
||||
// be broken.
|
||||
$this->runUpdates();
|
||||
$this->assertEquals('standard', \Drupal::config('core.extension')->get('profile'));
|
||||
$this->assertEquals('Site-Install', \Drupal::config('system.site')->get('name'));
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertSession()->pageTextContains('Site-Install');
|
||||
|
||||
// Ensure that the database tasks have been run during set up. Neither MySQL
|
||||
// nor SQLite make changes that are testable.
|
||||
$database = $this->container->get('database');
|
||||
if ($database->driver() == 'pgsql') {
|
||||
$this->assertEquals('on', $database->query("SHOW standard_conforming_strings")->fetchField());
|
||||
$this->assertEquals('escape', $database->query("SHOW bytea_output")->fetchField());
|
||||
}
|
||||
// Ensure the test runners cache has been cleared.
|
||||
$this->assertFalse(\Drupal::service('cache.default')->get(__CLASS__));
|
||||
public function testDatabaseProperlyLoaded() {
|
||||
$this->testDatabaseLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue