Verified Commit 58831740 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3270940 by quietone: Move all non migration Color tests to the module...

Issue #3270940 by quietone: Move all non migration Color tests to the module in preparation of removal

(cherry picked from commit 25d335d5)
parent 7953bb57
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@ field.widget.settings.test_field_widget_multilingual:
  type: field.widget.settings.test_field_widget
  label: 'Test multiple field widget settings: multilingual'

field.widget.third_party.color:
field.widget.third_party.help:
  type: mapping
  label: 'Field test entity display color module third party settings'
  label: 'Field test entity display help module third party settings'
  mapping:
    foo:
      type: string
+11 −11
Original line number Diff line number Diff line
@@ -526,7 +526,7 @@ public function testGetDisplayModeOptions() {
   * Tests components dependencies additions.
   */
  public function testComponentDependencies() {
    $this->enableModules(['dblog', 'color']);
    $this->enableModules(['dblog', 'help']);
    $this->installSchema('dblog', ['watchdog']);
    $this->installEntitySchema('user');
    /** @var \Drupal\user\RoleInterface[] $roles */
@@ -577,7 +577,7 @@ public function testComponentDependencies() {
        'role2' => $roles[1]->id(),
      ],
      'third_party_settings' => [
        'color' => ['foo' => 'bar'],
        'help' => ['foo' => 'bar'],
      ],
    ];
    $form_display->setComponent($field_name, $component);
@@ -586,8 +586,8 @@ public function testComponentDependencies() {
    // Now, the form display should depend on both user roles $roles.
    $this->assertDependency('config', $dependencies[0], $form_display);
    $this->assertDependency('config', $dependencies[1], $form_display);
    // The form display should depend on 'color' module.
    $this->assertDependency('module', 'color', $form_display);
    // The form display should depend on 'help' module.
    $this->assertDependency('module', 'help', $form_display);

    // Delete the first user role entity.
    $roles[0]->delete();
@@ -600,14 +600,14 @@ public function testComponentDependencies() {
    $this->assertNoDependency('config', $dependencies[0], $form_display);
    // The form display should depend on 'anonymous' user role.
    $this->assertDependency('config', 'user.role.anonymous', $form_display);
    // The form display should depend on 'color' module.
    $this->assertDependency('module', 'color', $form_display);
    // The form display should depend on 'help' module.
    $this->assertDependency('module', 'help', $form_display);

    // Manually trigger the removal of configuration belonging to the module
    // because KernelTestBase::disableModules() is not aware of this.
    $this->container->get('config.manager')->uninstall('module', 'color');
    // Uninstall 'color' module.
    $this->disableModules(['color']);
    $this->container->get('config.manager')->uninstall('module', 'help');
    // Uninstall 'help' module.
    $this->disableModules(['help']);

    // Reload the form display.
    $form_display = EntityFormDisplay::load($form_display->id());
@@ -615,8 +615,8 @@ public function testComponentDependencies() {
    $this->assertNotEmpty($form_display);
    // The component is still enabled.
    $this->assertNotNull($form_display->getComponent($field_name));
    // The form display should not depend on 'color' module anymore.
    $this->assertNoDependency('module', 'color', $form_display);
    // The form display should not depend on 'help' module anymore.
    $this->assertNoDependency('module', 'help', $form_display);

    // Delete the 2nd user role entity.
    $roles[1]->delete();
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public function testHelp() {
    $page_text = $this->getTextContent();
    $start = strpos($page_text, 'Module overviews');
    $pos = $start;
    $list = ['Block', 'Color', 'Custom Block', 'History', 'Text Editor'];
    $list = ['Block', 'Breakpoint', 'Custom Block', 'History', 'Text Editor'];
    foreach ($list as $name) {
      $this->assertSession()->linkExists($name);
      $new_pos = strpos($page_text, $name, $start);
+6 −6
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@
 */
function module_test_system_info_alter(&$info, Extension $file, $type) {
  if (\Drupal::state()->get('module_test.dependency') == 'missing dependency') {
    if ($file->getName() == 'color') {
      // Make color module depend on config.
    if ($file->getName() == 'dblog') {
      // Make dblog module depend on config.
      $info['dependencies'][] = 'config';
    }
    elseif ($file->getName() == 'config') {
@@ -24,8 +24,8 @@ function module_test_system_info_alter(&$info, Extension $file, $type) {
    }
  }
  elseif (\Drupal::state()->get('module_test.dependency') == 'dependency') {
    if ($file->getName() == 'color') {
      // Make color module depend on config.
    if ($file->getName() == 'dblog') {
      // Make dblog module depend on config.
      $info['dependencies'][] = 'config';
    }
    elseif ($file->getName() == 'config') {
@@ -38,8 +38,8 @@ function module_test_system_info_alter(&$info, Extension $file, $type) {
    }
  }
  elseif (\Drupal::state()->get('module_test.dependency') == 'version dependency') {
    if ($file->getName() == 'color') {
      // Make color module depend on config.
    if ($file->getName() == 'dblog') {
      // Make dblog module depend on config.
      $info['dependencies'][] = 'config';
    }
    elseif ($file->getName() == 'config') {
+6 −6
Original line number Diff line number Diff line
@@ -208,26 +208,26 @@ public function testModuleEnableOrder() {
    $this->assertModules(['module_test'], TRUE);
    \Drupal::state()->set('module_test.dependency', 'dependency');
    // module_test creates a dependency chain:
    // - color depends on config
    // - dblog depends on config
    // - config depends on help
    $expected_order = ['help', 'config', 'color'];
    $expected_order = ['help', 'config', 'dblog'];

    // Enable the modules through the UI, verifying that the dependency chain
    // is correct.
    $edit = [];
    $edit['modules[color][enable]'] = 'color';
    $edit['modules[dblog][enable]'] = 'dblog';
    $this->drupalGet('admin/modules');
    $this->submitForm($edit, 'Install');
    $this->assertModules(['color'], FALSE);
    $this->assertModules(['dblog'], FALSE);
    // Note that dependencies are sorted alphabetically in the confirmation
    // message.
    $this->assertSession()->pageTextContains('You must enable the Configuration Manager, Help modules to install Color.');
    $this->assertSession()->pageTextContains('You must enable the Configuration Manager, Help modules to install Database Logging.');

    $edit['modules[config][enable]'] = 'config';
    $edit['modules[help][enable]'] = 'help';
    $this->drupalGet('admin/modules');
    $this->submitForm($edit, 'Install');
    $this->assertModules(['color', 'config', 'help'], TRUE);
    $this->assertModules(['dblog', 'config', 'help'], TRUE);

    // Check the actual order which is saved by module_test_modules_enabled().
    $module_order = \Drupal::state()->get('module_test.install_order', []);
Loading