createContentType example

/** * {@inheritdoc} */
  protected $defaultTheme = 'starterkit_theme';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->createContentType(['type' => 'bundle_with_section_field']);

    $this->drupalLogin($this->drupalCreateUser([
      'configure any layout',
      'create and edit custom blocks',
      'administer node display',
      'administer node fields',
      'access contextual links',
    ]));

    // Enable layout builder.     $this->drupalGet(static::FIELD_UI_PREFIX . '/display/default');
    
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->createContentType(['type' => 'bundle_with_section_field']);
    $this->createNode([
      'type' => 'bundle_with_section_field',
      'title' => 'The first node title',
      'body' => [
        [
          'value' => 'The first node body',
        ],
      ],
    ]);
  }

  
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->createContentType(['type' => 'bundle_with_section_field']);
    LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')
      ->enableLayoutBuilder()
      ->setOverridable()
      ->save();

    $this->createNode([
      'type' => 'bundle_with_section_field',
      'title' => 'The first node title',
      'body' => [
        [
          'value' => 'The first node body',
        ],
/** * {@inheritdoc} */
  protected function setUp($import_test_views = TRUE): void {
    parent::setUp($import_test_views);

    $this->installConfig(['node', 'filter']);
    $this->installEntitySchema('user');
    $this->installEntitySchema('node');
    $this->installEntitySchema('path_alias');
    $this->createContentType(['type' => 'article']);
  }

  /** * Tests correct processing of link fields. * * This overlaps with \Drupal\Tests\views\Functional\Plugin\DisplayFeedTest to * ensure that root-relative links also work in a scenario without * subdirectory. */
  public function testLink() {
    // Set up the current user as uid 1 so the test doesn't need to deal with
/** * {@inheritdoc} */
  protected $defaultTheme = 'starterkit_theme';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->createContentType(['type' => 'bundle_with_section_field']);
    $this->createNode([
      'type' => 'bundle_with_section_field',
      'title' => 'The first node title',
      'body' => [
        [
          'value' => 'Node body',
        ],
      ],
    ]);

    $bundle = BlockContentType::create([
      
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->createContentType([
      'type' => 'bundle_with_section_field',
    ]);
    $this->createNode(['type' => 'bundle_with_section_field']);

    $this->drupalLogin($this->drupalCreateUser([
      'configure any layout',
      'administer node display',
      'administer display modes',
    ], 'foobar'));
  }

  
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    \Drupal::state()->set('system_test.module_hidden', FALSE);
    $this->createContentType(['type' => 'page']);
  }

  /** * Tests mixed case paths. */
  public function testMixedCasePaths() {
    // Tests paths defined by routes from standard modules as anonymous.     $this->drupalGet('user/login');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextMatches('/Log in/');
    $this->drupalGet('User/Login');
    

  protected function getTranslatorPermissions() {
    return array_merge(parent::getTranslatorPermissions()$this->commonPermissions);
  }

  /** * {@inheritdoc} */
  protected function setupBundle() {
    parent::setupBundle();
    $this->createContentType(['type' => $this->bundle]);
    $this->createEditorialWorkflow();
  }

  /** * Loads the active revision translation for the specified entity. * * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity being edited. * @param string $langcode * The translation language code. * * @return \Drupal\Core\Entity\ContentEntityInterface|null * The active revision translation or NULL if none could be identified. */
/** * {@inheritdoc} */
  protected $defaultTheme = 'starterkit_theme';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->createContentType(['type' => 'bundle_with_section_field']);
    LayoutBuilderEntityViewDisplay::load('node.bundle_with_section_field.default')
      ->enableLayoutBuilder()
      ->setOverridable()
      ->save();
    $this->createNode(['type' => 'bundle_with_section_field']);
  }

  /** * Tests that validation messages are shown on the block form. */
  public function testValidationMessage() {
    
/** * {@inheritdoc} */
  protected $defaultTheme = 'starterkit_theme';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->createContentType(['type' => 'bundle_for_this_particular_test']);
    LayoutBuilderEntityViewDisplay::load('node.bundle_for_this_particular_test.default')
      ->enableLayoutBuilder()
      ->setOverridable()
      ->save();

    $this->drupalLogin($this->drupalCreateUser([
      'configure any layout',
      'access contextual links',
    ]));
  }

  

  protected $blockStorage;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->drupalPlaceBlock('local_tasks_block');

    $this->createContentType(['type' => 'bundle_with_section_field', 'new_revision' => TRUE]);
    $this->createNode([
      'type' => 'bundle_with_section_field',
      'title' => 'The node title',
      'body' => [
        [
          'value' => 'The node body',
        ],
      ],
    ]);
    $this->createNode([
      'type' => 'bundle_with_section_field',
      
/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    // Enable AJAX on the /admin/content View.     \Drupal::configFactory()->getEditable('views.view.content')
      ->set('display.default.display_options.use_ajax', TRUE)
      ->save();

    $this->createContentType(['type' => 'article']);
    $this->createNode(['title' => 'Tiny paws and playful mews, kittens bring joy in every hue', 'type' => 'article']);

    $user = $this->drupalCreateUser([
      'access content overview',
      'administer nodes',
      'bypass node access',
    ]);
    $this->drupalLogin($user);
  }

  /** * Ensures that redirects work with ajax. */
protected $defaultTheme = 'starterkit_theme';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->drupalPlaceBlock('local_tasks_block');

    // Create two nodes.     $this->createContentType([
      'type' => 'bundle_with_section_field',
      'name' => 'Bundle with section field',
    ]);
    $this->createNode([
      'type' => 'bundle_with_section_field',
      'title' => 'The first node title',
      'body' => [
        [
          'value' => 'The first node body',
        ],
      ],
    ]);
/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->setTestLogger();
    $this->migrateLookup = $this->container->get('migrate.lookup');
    $this->installEntitySchema('node');
    $this->installEntitySchema('user');
    $this->installConfig(['node', 'user']);
    $this->createContentType(['type' => 'node_lookup']);
  }

  /** * Tests scenarios around single id lookups. */
  public function testSingleLookup() {
    $this->executeMigration('sample_lookup_migration');

    // Test numerically indexed source id.     $result = $this->migrateLookup->lookup('sample_lookup_migration', [17]);
    $this->assertSame('1', $result[0]['nid']);

    
$this->setUpCurrentUser();

    $this->installSchema('node', ['node_access']);

    $this->installEntitySchema('workspace');
    $this->installSchema('workspaces', ['workspace_association']);
    $this->installEntitySchema('node');
    $this->installEntitySchema('path_alias');

    $this->installConfig(['filter', 'node', 'system']);

    $this->createContentType(['type' => 'page']);

    $this->entityTypeManager = \Drupal::entityTypeManager();
    $this->state = \Drupal::state();
    $this->workspaceManager = \Drupal::service('workspaces.manager');
  }

  /** * Tests the deletion of workspaces. */
  public function testDeletingWorkspaces() {
    $admin = $this->createUser([
      
Home | Imprint | This part of the site doesn't use cookies.