You are here

protected function BlockContentTestBase::createBlockContent in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/block_content/src/Tests/BlockContentTestBase.php \Drupal\block_content\Tests\BlockContentTestBase::createBlockContent()
  2. 8 core/modules/block_content/src/Tests/Views/BlockContentTestBase.php \Drupal\block_content\Tests\Views\BlockContentTestBase::createBlockContent()
Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/Tests/Views/BlockContentTestBase.php \Drupal\block_content\Tests\Views\BlockContentTestBase::createBlockContent()

Creates a custom block.

Parameters

array $settings: (optional) An associative array of settings for the block_content, as used in entity_create().

Return value

\Drupal\block_content\Entity\BlockContent Created custom block.

3 calls to BlockContentTestBase::createBlockContent()
BlockContentFieldFilterTest::setUp in core/modules/block_content/src/Tests/Views/BlockContentFieldFilterTest.php
Sets up a Drupal site for running functional and integration tests.
BlockContentIntegrationTest::testBlockContentViewTypeArgument in core/modules/block_content/src/Tests/Views/BlockContentIntegrationTest.php
Tests basic block_content view with a block_content_type argument.
FieldTypeTest::testFieldType in core/modules/block_content/src/Tests/Views/FieldTypeTest.php

File

core/modules/block_content/src/Tests/Views/BlockContentTestBase.php, line 65
Contains \Drupal\block_content\Tests\Views\BlockContentTestBase.

Class

BlockContentTestBase
Base class for all block_content tests.

Namespace

Drupal\block_content\Tests\Views

Code

protected function createBlockContent(array $settings = array()) {
  $status = 0;
  $settings += array(
    'info' => $this
      ->randomMachineName(),
    'type' => 'basic',
    'langcode' => 'en',
  );
  if ($block_content = entity_create('block_content', $settings)) {
    $status = $block_content
      ->save();
  }
  $this
    ->assertEqual($status, SAVED_NEW, SafeMarkup::format('Created block content %info.', array(
    '%info' => $block_content
      ->label(),
  )));
  return $block_content;
}