Unverified Commit 741daa78 authored by alexpott's avatar alexpott

Issue #2978952 by martin107, Lendude, yogeshmpawar, Mile23: Deprecate...

Issue #2978952 by martin107, Lendude, yogeshmpawar, Mile23: Deprecate Drupal\simpletest\InstallerTestBase, convert children to BTB

(cherry picked from commit 5ba03273)
parent fd96ff1e
<?php
namespace Drupal\config\Tests;
namespace Drupal\Tests\config\Functional;
use Drupal\FunctionalTests\Installer\InstallerTestBase;
use Drupal\Core\Config\InstallStorage;
use Drupal\Core\Serialization\Yaml;
use Drupal\simpletest\InstallerTestBase;
/**
* Tests install profile config overrides can not add unmet dependencies.
......@@ -21,16 +21,41 @@ class ConfigInstallProfileUnmetDependenciesTest extends InstallerTestBase {
protected $profile = 'testing_config_overrides';
/**
* Set to TRUE if the expected exception is thrown.
* Contains the expected exception if it is thrown.
*
* @var bool
* @var \Drupal\Core\Config\UnmetDependenciesException
*/
protected $expectedException = FALSE;
/**
* {@inheritdoc}
*/
protected function prepareEnvironment() {
parent::prepareEnvironment();
$this->copyTestingOverrides();
}
/**
* {@inheritdoc}
*/
protected function setUp() {
// Copy the testing_config_overrides install profile so we can change the
// configuration to include a dependency that can not be met. File API
// functions are not available yet.
// During set up an UnmetDependenciesException should be thrown, which will
// be re-thrown by TestHttpClientMiddleware as a standard Exception.
try {
parent::setUp();
}
catch (\Exception $exception) {
$this->expectedException = $exception;
}
}
/**
* Copy the testing_config_overrides install profile.
*
* So we can change the configuration to include a dependency that can not be
* met. File API functions are not available yet.
*/
protected function copyTestingOverrides() {
$dest = $this->siteDirectory . '/profiles/testing_config_overrides';
mkdir($dest, 0777, TRUE);
$source = DRUPAL_ROOT . '/core/profiles/testing_config_overrides';
......@@ -50,33 +75,6 @@ protected function setUp() {
$action = Yaml::decode(file_get_contents($config_file));
$action['dependencies']['module'][] = 'action';
file_put_contents($config_file, Yaml::encode($action));
parent::setUp();
}
/**
* {@inheritdoc}
*
* Override the error method so we can test for the expected exception.
*/
protected function error($message = '', $group = 'Other', array $caller = NULL) {
if ($group == 'User notice') {
// Since 'User notice' is set by trigger_error() which is used for debug
// set the message to a status of 'debug'.
return $this->assert('debug', $message, 'Debug', $caller);
}
if ($group == 'Drupal\Core\Config\UnmetDependenciesException') {
$this->expectedException = TRUE;
return FALSE;
}
return $this->assert('exception', $message, $group, $caller);
}
/**
* {@inheritdoc}
*/
protected function setUpSite() {
// This step is not reached due to the exception.
}
/**
......@@ -84,12 +82,12 @@ protected function setUpSite() {
*/
public function testInstalled() {
if ($this->expectedException) {
$this->pass('Expected Drupal\Core\Config\UnmetDependenciesException exception thrown');
$this->assertContains('Configuration objects provided by <em class="placeholder">user</em> have unmet dependencies: <em class="placeholder">system.action.user_block_user_action (action)</em>', $this->expectedException->getMessage());
$this->assertContains('Drupal\Core\Config\UnmetDependenciesException', $this->expectedException->getMessage());
}
else {
$this->fail('Expected Drupal\Core\Config\UnmetDependenciesException exception thrown');
$this->fail('Expected Drupal\Core\Config\UnmetDependenciesException exception not thrown');
}
$this->assertErrorLogged('Configuration objects provided by <em class="placeholder">user</em> have unmet dependencies: <em class="placeholder">system.action.user_block_user_action (action)</em>');
}
}
<?php
namespace Drupal\config_translation\Tests;
namespace Drupal\Tests\config_translation\Functional;
use Drupal\simpletest\InstallerTestBase;
use Drupal\FunctionalTests\Installer\InstallerTestBase;
/**
* Installs the config translation module on a site installed in non english.
......
......@@ -2,6 +2,8 @@
namespace Drupal\simpletest;
@trigger_error(__NAMESPACE__ . '\InstallerTestBase is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\FunctionalTests\Installer\InstallerTestBase, see https://www.drupal.org/node/2988752.', E_USER_DEPRECATED);
use Drupal\Core\DrupalKernel;
use Drupal\Core\Language\Language;
use Drupal\Core\Session\UserSession;
......@@ -13,6 +15,10 @@
/**
* Base class for testing the interactive installer.
*
* @deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0.
* Use \Drupal\FunctionalTests\Installer\InstallerTestBase. See
* https://www.drupal.org/node/2988752
*/
abstract class InstallerTestBase extends WebTestBase {
......
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