diff -u b/tests/src/TestSite/SelectOtherInstallTestScript.php b/tests/src/TestSite/SelectOtherInstallTestScript.php --- b/tests/src/TestSite/SelectOtherInstallTestScript.php +++ b/tests/src/TestSite/SelectOtherInstallTestScript.php @@ -8,6 +8,7 @@ use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\node\Entity\NodeType; use Drupal\TestSite\TestSetupInterface; /** @@ -22,6 +23,9 @@ */ protected $randomGenerator; + /** + * {@inheritdoc} + */ protected $modules = [ 'node', 'field_ui', @@ -35,7 +39,7 @@ public function setup() { \Drupal::service('module_installer')->install($this->modules); - $this->installConfig(['node']); + $this->createContentType(['type' => 'page', 'name' => 'Page']); $options = $this->createOptions(); list($default_value, $label) = $this->getRandomOption($options); @@ -57,19 +61,24 @@ /** * Install configuration for modules. * - * @param array $modules - * An indexed array of module names. + * @param array $values + * Optional values to set on the content type. */ - protected function installConfig(array $modules) { - foreach ($modules as $module) { - if (\Drupal::service('module_handler')->moduleExists($module)) { - \Drupal::service('config.installer') - ->installDefaultConfig('module', $module); - } - else { - throw new \LogicException("${module} module is not enabled."); - } + protected function createContentType(array $values = []) { + if (!isset($values['type'])) { + $id = $this->randomMachineName(); + } + else { + $id = $values['type']; } + + $values += [ + 'type' => $id, + 'name' => $id, + ]; + + $type = NodeType::create($values); + $type->save(); } /**