diff --git a/core/modules/block/src/Tests/BlockTemplateSuggestionsTest.php b/core/modules/block/src/Tests/BlockTemplateSuggestionsTest.php index 4b2ed695e72b00f6c426bec4fc842fdd296876cd..3c61d84b7b568e5857fe5ae35f0b42bd68558d55 100644 --- a/core/modules/block/src/Tests/BlockTemplateSuggestionsTest.php +++ b/core/modules/block/src/Tests/BlockTemplateSuggestionsTest.php @@ -7,6 +7,7 @@ namespace Drupal\block\Tests; +use Drupal\block\Entity\Block; use Drupal\simpletest\WebTestBase; /** @@ -31,8 +32,7 @@ function testBlockThemeHookSuggestions() { // an underscore (not transformed) and a hyphen (transformed to underscore), // and generates possibilities for each level of derivative. // @todo Clarify this comment. - /** @var \Drupal\block\BlockInterface $block */ - $block = entity_create('block', array( + $block = Block::create(array( 'plugin' => 'system_menu_block:admin', 'region' => 'footer', 'id' => 'machinename', diff --git a/core/modules/block_content/src/Tests/BlockContentCacheTagsTest.php b/core/modules/block_content/src/Tests/BlockContentCacheTagsTest.php index 8f543c3733c7d036f164eb8d6e2c45b3d5207986..567d5e1319d39131cea582a6c40e04ffe0682729 100644 --- a/core/modules/block_content/src/Tests/BlockContentCacheTagsTest.php +++ b/core/modules/block_content/src/Tests/BlockContentCacheTagsTest.php @@ -7,6 +7,8 @@ namespace Drupal\block_content\Tests; +use Drupal\block_content\Entity\BlockContent; +use Drupal\block_content\Entity\BlockContentType; use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Language\LanguageInterface; @@ -29,7 +31,7 @@ class BlockContentCacheTagsTest extends EntityCacheTagsTestBase { * {@inheritdoc} */ protected function createEntity() { - $block_content_type = entity_create('block_content_type', array( + $block_content_type = BlockContentType::create(array( 'id' => 'basic', 'label' => 'basic', 'revision' => FALSE @@ -38,7 +40,7 @@ protected function createEntity() { block_content_add_body_field($block_content_type->id()); // Create a "Llama" custom block. - $block_content = entity_create('block_content', array( + $block_content = BlockContent::create(array( 'info' => 'Llama', 'type' => 'basic', 'body' => array( diff --git a/core/modules/block_content/src/Tests/BlockContentSaveTest.php b/core/modules/block_content/src/Tests/BlockContentSaveTest.php index 75c2801478b910b170491edb37727f60cff9baca..894099fb5250cc58a2d38ef1db1040f474613a20 100644 --- a/core/modules/block_content/src/Tests/BlockContentSaveTest.php +++ b/core/modules/block_content/src/Tests/BlockContentSaveTest.php @@ -46,7 +46,7 @@ public function testImport() { 'type' => 'basic', 'id' => $test_id ); - $block = entity_create('block_content', $block_array); + $block = BlockContent::create($block_array); $block->enforceIsNew(TRUE); $block->save(); diff --git a/core/modules/block_content/src/Tests/BlockContentTestBase.php b/core/modules/block_content/src/Tests/BlockContentTestBase.php index ceb58466d557a6de02b7b3168941c6c32f0808e3..cc6e3ada6f85e18a38acbea194cf18311d6cfa31 100644 --- a/core/modules/block_content/src/Tests/BlockContentTestBase.php +++ b/core/modules/block_content/src/Tests/BlockContentTestBase.php @@ -7,6 +7,8 @@ namespace Drupal\block_content\Tests; +use Drupal\block_content\Entity\BlockContent; +use Drupal\block_content\Entity\BlockContentType; use Drupal\simpletest\WebTestBase; /** @@ -78,7 +80,7 @@ protected function setUp() { */ protected function createBlockContent($title = FALSE, $bundle = 'basic', $save = TRUE) { $title = ($title ? : $this->randomMachineName()); - $block_content = entity_create('block_content', array( + $block_content = BlockContent::create(array( 'info' => $title, 'type' => $bundle, 'langcode' => 'en' @@ -101,7 +103,7 @@ protected function createBlockContent($title = FALSE, $bundle = 'basic', $save = * Created custom block type. */ protected function createBlockContentType($label, $create_body = FALSE) { - $bundle = entity_create('block_content_type', array( + $bundle = BlockContentType::create(array( 'id' => $label, 'label' => $label, 'revision' => FALSE, diff --git a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php index 4e4fd6b551748889b0ad0788bedbb1fa8673c45e..c32fb45af39fcf58be2ef8e1ea60eb6d26ae96a3 100644 --- a/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php +++ b/core/modules/block_content/src/Tests/BlockContentTranslationUITest.php @@ -7,6 +7,8 @@ namespace Drupal\block_content\Tests; +use Drupal\block_content\Entity\BlockContent; +use Drupal\block_content\Entity\BlockContentType; use Drupal\Component\Utility\Unicode; use Drupal\content_translation\Tests\ContentTranslationUITestBase; @@ -60,7 +62,7 @@ protected function setUp() { */ protected function setupBundle() { // Create the basic bundle since it is provided by standard. - $bundle = entity_create('block_content_type', array( + $bundle = BlockContentType::create(array( 'id' => $this->bundle, 'label' => $this->bundle, 'revision' => FALSE @@ -96,7 +98,7 @@ public function getTranslatorPermissions() { protected function createBlockContent($title = FALSE, $bundle = FALSE) { $title = ($title ? : $this->randomMachineName()); $bundle = ($bundle ? : $this->bundle); - $block_content = entity_create('block_content', array( + $block_content = BlockContent::create(array( 'info' => $title, 'type' => $bundle, 'langcode' => 'en' @@ -162,7 +164,7 @@ protected function doTestBasicTranslation() { public function testDisabledBundle() { // Create a bundle that does not have translation enabled. $disabled_bundle = $this->randomMachineName(); - $bundle = entity_create('block_content_type', array( + $bundle = BlockContentType::create(array( 'id' => $disabled_bundle, 'label' => $disabled_bundle, 'revision' => FALSE diff --git a/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php b/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php index 4d65dcf7662261cfc62e8e66a9ca67a538d03933..fdbec957e59934ac8b6b96162dbdeacb2ceeecab 100644 --- a/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php +++ b/core/modules/block_content/src/Tests/Views/BlockContentTestBase.php @@ -7,6 +7,7 @@ namespace Drupal\block_content\Tests\Views; +use Drupal\block_content\Entity\BlockContent; use Drupal\block_content\Entity\BlockContentType; use Drupal\Component\Utility\SafeMarkup; use Drupal\views\Tests\ViewTestBase; @@ -69,7 +70,7 @@ protected function createBlockContent(array $settings = array()) { 'type' => 'basic', 'langcode' => 'en', ); - if ($block_content = entity_create('block_content', $settings)) { + if ($block_content = BlockContent::create($settings)) { $status = $block_content->save(); } $this->assertEqual($status, SAVED_NEW, SafeMarkup::format('Created block content %info.', array('%info' => $block_content->label()))); @@ -100,7 +101,7 @@ protected function createBlockContentType(array $values = array()) { 'label' => $id, 'revision' => FALSE ); - $bundle = entity_create('block_content_type', $values); + $bundle = BlockContentType::create($values); $status = $bundle->save(); block_content_add_body_field($bundle->id()); diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php index 352ce81bbbe791e66efffa743b6c08f9c8d42450..9671feb23cc489ec7b996b4cdf97e386ad3f80c9 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php @@ -7,6 +7,7 @@ namespace Drupal\config_translation\Tests; +use Drupal\block_content\Entity\BlockContentType; use Drupal\Component\Utility\Unicode; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; @@ -189,7 +190,7 @@ protected function doVocabularyListTest() { public function doCustomContentTypeListTest() { // Create a test custom block type to decouple looking for translate // operations link so this does not test more than necessary. - $block_content_type = entity_create('block_content_type', array( + $block_content_type = BlockContentType::create(array( 'id' => Unicode::strtolower($this->randomMachineName(16)), 'label' => $this->randomMachineName(), 'revision' => FALSE @@ -395,7 +396,7 @@ public function doFieldListTest() { )); // Create a block content type. - $block_content_type = entity_create('block_content_type', array( + $block_content_type = BlockContentType::create(array( 'id' => 'basic', 'label' => 'Basic', 'revision' => FALSE diff --git a/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php b/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php index 4e6db75bb2aabc5ad74b59045aa3e1f1d3deb5cc..6b1a81f392885e246749f788e00a94f80a7fd671 100644 --- a/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php +++ b/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php @@ -7,7 +7,7 @@ namespace Drupal\system\Tests\Block; use Drupal\system\Entity\Menu; - +use Drupal\block\Entity\Block; use Drupal\Core\Render\Element; use Drupal\simpletest\KernelTestBase; use Drupal\system\Tests\Routing\MockRouteProvider; @@ -157,7 +157,7 @@ protected function setUp() { */ public function testSystemMenuBlockConfigDependencies() { - $block = entity_create('block', array( + $block = Block::create(array( 'plugin' => 'system_menu_block:' . $this->menu->id(), 'region' => 'footer', 'id' => 'machinename', diff --git a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php index 46ddaadc4c0dc23beb85a9db648e9f366456e127..8e401cd9cd161aa70ec8d6554a656fb9e08f9a46 100644 --- a/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php +++ b/core/modules/system/src/Tests/Entity/EntityCrudHookTest.php @@ -87,7 +87,7 @@ protected function assertHookMessageOrder($messages) { * Tests hook invocations for CRUD operations on blocks. */ public function testBlockHooks() { - $entity = entity_create('block', array( + $entity = Block::create(array( 'id' => 'stark_test_html', 'plugin' => 'test_html', 'theme' => 'stark', diff --git a/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php index 6a5064cf652f15b4e41cb751ccfbc47f49a22e27..15863a74aa38ff4f1c2ab122ffb95cb277ba52e4 100644 --- a/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php +++ b/core/modules/views/src/Tests/Plugin/BlockDependenciesTest.php @@ -8,6 +8,7 @@ namespace Drupal\views\Tests\Plugin; use Drupal\views\Tests\ViewKernelTestBase; +use Drupal\block\Entity\Block; /** * Tests views block config dependencies functionality. @@ -106,7 +107,7 @@ protected function createBlock($plugin_id, array $settings = array()) { $values['visibility'][$id]['id'] = $id; } $values['settings'] = $settings; - $block = entity_create('block', $values); + $block = Block::create($values); $block->save(); return $block; }