Commit 6d4b0ae8 authored by catch's avatar catch

Issue #2561229 by alexpott, dawehner: Upgrade content tests fails on postgres...

Issue #2561229 by alexpott, dawehner: Upgrade content tests fails on postgres for translated comment
parent 7210716a
......@@ -180,8 +180,8 @@ function checkBinaryOutput() {
* Verify that a binary data roundtrip returns the original string.
*/
protected function checkBinaryOutputSuccess() {
$bytea_output = db_query("SELECT 'encoding'::bytea AS output")->fetchField();
return ($bytea_output == 'encoding');
$bytea_output = db_query("SHOW bytea_output")->fetchField();
return ($bytea_output == 'escape');
}
/**
......
......@@ -10,9 +10,12 @@
use Drupal\Component\Utility\Crypt;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\Core\Database\Database;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\Language\Language;
use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
use Drupal\user\Entity\User;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\Request;
/**
......@@ -141,7 +144,7 @@ function __construct($test_id = NULL) {
* container that would normally be done via the installer.
*/
protected function setUp() {
$this->runDbTasks();
// Allow classes to set database dump files.
$this->setDatabaseDumpFiles();
......@@ -260,6 +263,33 @@ protected function runUpdates() {
$this->assertFalse(\Drupal::service('entity.definition_update_manager')->needsUpdates(), 'After all updates ran, entity schema is up to date.');
}
/**
* Runs the install database tasks for the driver used by the test runner.
*/
protected function runDbTasks() {
// Create a minimal container so that t() works.
// @see install_begin_request()
$container = new ContainerBuilder();
$container->setParameter('language.default_values', Language::$defaultValues);
$container
->register('language.default', 'Drupal\Core\Language\LanguageDefault')
->addArgument('%language.default_values%');
$container
->register('language_manager', 'Drupal\Core\Language\LanguageManager')
->addArgument(new Reference('language.default'));
$container
->register('string_translation', 'Drupal\Core\StringTranslation\TranslationManager')
->addArgument(new Reference('language_manager'));
\Drupal::setContainer($container);
require_once __DIR__ . '/../../../../../includes/install.inc';
$connection = Database::getConnection();
$errors = db_installer_object($connection->driver())->runTasks();
if (!empty($errors)) {
$this->fail('Failed to run installer database tasks: ' . implode(', ', $errors));
}
}
/**
* Replace User 1 with the user created here.
*/
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\system\Tests\Update\UpdatePathTestBaseFilledTest.php
* Contains \Drupal\system\Tests\Update\UpdatePathTestBaseFilledTest.
*/
namespace Drupal\system\Tests\Update;
......
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