protected function ContentEntitySourceUnitTest::drupalCreateContentType

Creates a custom content type based on default settings.

Parameters

$settings: An array of settings to change from the defaults. Example: 'type' => 'foo'.

Return value

Created content type.

5 calls to ContentEntitySourceUnitTest::drupalCreateContentType()
ContentEntitySourceUnitTest::testAcceptTranslation in sources/content/tests/src/Kernel/ContentEntitySourceUnitTest.php
Test node acceptTranslation.
ContentEntitySourceUnitTest::testContinuousJobItems in sources/content/tests/src/Kernel/ContentEntitySourceUnitTest.php
Test creation of continuous job items.
ContentEntitySourceUnitTest::testNode in sources/content/tests/src/Kernel/ContentEntitySourceUnitTest.php
Test node field extraction.
ContentEntitySourceUnitTest::testRequestDataForSpecificLanguage in sources/content/tests/src/Kernel/ContentEntitySourceUnitTest.php
Test if the source is able to pull content in requested language.
ContentEntitySourceUnitTest::testSubmitContinuousOnCron in sources/content/tests/src/Kernel/ContentEntitySourceUnitTest.php
Test submit continuous job items on cron.

File

sources/content/tests/src/Kernel/ContentEntitySourceUnitTest.php, line 497

Class

ContentEntitySourceUnitTest
Content entity Source unit tests.

Namespace

Drupal\Tests\tmgmt_content\Kernel

Code

protected function drupalCreateContentType($settings = array()) {
  $name = strtolower($this
    ->randomMachineName(8));
  $values = array(
    'type' => $name,
    'name' => $name,
    'base' => 'node_content',
    'title_label' => 'Title',
    'body_label' => 'Body',
    'has_title' => 1,
    'has_body' => 1,
  );
  $type = NodeType::create($values);
  $saved = $type
    ->save();
  node_add_body_field($type);
  $this
    ->assertEquals(SAVED_NEW, $saved);
  return $type;
}