Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 95b6e687 authored by Andreas Hennings's avatar Andreas Hennings
Browse files

OEL-1281: Don't use injected services in tests, remove unnecessary assertions.

parent 46f29b35
No related branches found
No related tags found
5 merge requests!121OEL-1421: Fix cosmetic changes.,!116OEL-1394: Merge 1.x into EPIC-1293-Project, align with new version of card:search pattern,!115Upate the EPIC-1293-project,!105EPIC: OEL-1255: Migrate paragraphs,!97[OEL-1255] OEL-1281: Upgrade path from oe_bootstrap_theme_paragraphs
......@@ -14,20 +14,6 @@ use Drupal\Tests\BrowserTestBase;
*/
class InstallTest extends BrowserTestBase {
/**
* Module handler to ensure installed modules.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* Module installer.
*
* @var \Drupal\Core\Extension\ModuleInstallerInterface
*/
protected $moduleInstaller;
/**
* {@inheritdoc}
*/
......@@ -41,30 +27,6 @@ class InstallTest extends BrowserTestBase {
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->initServices();
}
/**
* Reloads services used by this test.
*/
protected function reloadServices(): void {
$this->rebuildContainer();
$this->initServices();
}
/**
* Initializes services.
*/
protected function initServices(): void {
$this->moduleHandler = $this->container->get('module_handler');
$this->moduleInstaller = $this->container->get('module_installer');
}
/**
* Test installation with legacy fields and data present.
*/
......@@ -141,12 +103,13 @@ class InstallTest extends BrowserTestBase {
$ids[$name] = $paragraph->id();
}
self::assertTrue($this->moduleHandler->moduleExists('oe_whitelabel_legacy_paragraphs_test'));
self::assertFalse($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs'));
self::assertTrue($this->moduleInstaller->install(['oe_whitelabel_paragraphs']));
self::assertFalse($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs'));
$this->reloadServices();
self::assertTrue($this->moduleHandler->moduleExists('oe_whitelabel_paragraphs'));
/** @var \Drupal\Core\Extension\ModuleInstallerInterface $installer */
$installer = \Drupal::service('module_installer');
$installer->install(['oe_whitelabel_paragraphs']);
$this->assertTrue(
\Drupal::moduleHandler()->moduleExists('oe_whitelabel_paragraphs'),
"Module 'oe_whitelabel_paragraphs was successfully installed.");
$expected_created = [
'oe_description_list' => [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment