Update core 8.3.0
This commit is contained in:
parent
da7a7918f8
commit
cd7a898e66
6144 changed files with 132297 additions and 87747 deletions
|
@ -15,9 +15,9 @@ use Drupal\block_content\Entity\BlockContent;
|
|||
*/
|
||||
function block_content_test_block_content_view(array &$build, BlockContent $block_content, $view_mode) {
|
||||
// Add extra content.
|
||||
$build['extra_content'] = array(
|
||||
$build['extra_content'] = [
|
||||
'#markup' => '<blink>Yowser</blink>',
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Functional;
|
||||
|
||||
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;
|
||||
use Drupal\system\Tests\Entity\EntityCacheTagsTestBase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
* Tests the Custom Block entity's cache tags.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class BlockContentCacheTagsTest extends EntityCacheTagsTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['block_content'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function createEntity() {
|
||||
$block_content_type = BlockContentType::create([
|
||||
'id' => 'basic',
|
||||
'label' => 'basic',
|
||||
'revision' => FALSE
|
||||
]);
|
||||
$block_content_type->save();
|
||||
block_content_add_body_field($block_content_type->id());
|
||||
|
||||
// Create a "Llama" custom block.
|
||||
$block_content = BlockContent::create([
|
||||
'info' => 'Llama',
|
||||
'type' => 'basic',
|
||||
'body' => [
|
||||
'value' => 'The name "llama" was adopted by European settlers from native Peruvians.',
|
||||
'format' => 'plain_text',
|
||||
],
|
||||
]);
|
||||
$block_content->save();
|
||||
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Drupal\block_content\BlockContentAccessControlHandler::checkAccess()
|
||||
*/
|
||||
protected function getAccessCacheContextsForEntity(EntityInterface $entity) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Each comment must have a comment body, which always has a text format.
|
||||
*/
|
||||
protected function getAdditionalCacheTagsForEntity(EntityInterface $entity) {
|
||||
return ['config:filter.format.plain_text'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the block is cached with the correct contexts and tags.
|
||||
*/
|
||||
public function testBlock() {
|
||||
$block = $this->drupalPlaceBlock('block_content:' . $this->entity->uuid());
|
||||
$build = $this->container->get('entity.manager')->getViewBuilder('block')->view($block, 'block');
|
||||
|
||||
// Render the block.
|
||||
// @todo The request stack manipulation won't be necessary once
|
||||
// https://www.drupal.org/node/2367555 is fixed and the
|
||||
// corresponding $request->isMethodSafe() checks are removed from
|
||||
// Drupal\Core\Render\Renderer.
|
||||
$request_stack = $this->container->get('request_stack');
|
||||
$request_stack->push(new Request());
|
||||
$this->container->get('renderer')->renderRoot($build);
|
||||
$request_stack->pop();
|
||||
|
||||
// Expected keys, contexts, and tags for the block.
|
||||
// @see \Drupal\block\BlockViewBuilder::viewMultiple()
|
||||
$expected_block_cache_keys = ['entity_view', 'block', $block->id()];
|
||||
$expected_block_cache_contexts = ['languages:' . LanguageInterface::TYPE_INTERFACE, 'theme', 'user.permissions'];
|
||||
$expected_block_cache_tags = Cache::mergeTags(['block_view', 'rendered'], $block->getCacheTags());
|
||||
$expected_block_cache_tags = Cache::mergeTags($expected_block_cache_tags, $block->getPlugin()->getCacheTags());
|
||||
|
||||
// Expected contexts and tags for the BlockContent entity.
|
||||
// @see \Drupal\Core\Entity\EntityViewBuilder::getBuildDefaults().
|
||||
$expected_entity_cache_contexts = ['theme'];
|
||||
$expected_entity_cache_tags = Cache::mergeTags(['block_content_view'], $this->entity->getCacheTags());
|
||||
$expected_entity_cache_tags = Cache::mergeTags($expected_entity_cache_tags, $this->getAdditionalCacheTagsForEntity($this->entity));
|
||||
|
||||
// Verify that what was render cached matches the above expectations.
|
||||
$cid = $this->createCacheId($expected_block_cache_keys, $expected_block_cache_contexts);
|
||||
$redirected_cid = $this->createCacheId($expected_block_cache_keys, Cache::mergeContexts($expected_block_cache_contexts, $expected_entity_cache_contexts));
|
||||
$this->verifyRenderCache($cid, Cache::mergeTags($expected_block_cache_tags, $expected_entity_cache_tags), ($cid !== $redirected_cid) ? $redirected_cid : NULL);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Functional;
|
||||
|
||||
/**
|
||||
* Create a block and test block access by attempting to view the block.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class BlockContentPageViewTest extends BlockContentTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['block_content_test'];
|
||||
|
||||
/**
|
||||
* Checks block edit and fallback functionality.
|
||||
*/
|
||||
public function testPageEdit() {
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$block = $this->createBlockContent();
|
||||
|
||||
// Attempt to view the block.
|
||||
$this->drupalGet('block-content/' . $block->id());
|
||||
|
||||
// Assert response was '200' and not '403 Access denied'.
|
||||
$this->assertResponse('200', 'User was able the view the block');
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertRaw(t('This block is broken or missing. You may be missing content or you might need to enable the original module.'));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Functional;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\user\Entity\User;
|
||||
use Drupal\user\UserInterface;
|
||||
|
||||
/**
|
||||
* Create a block with revisions.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class BlockContentRevisionsTest extends BlockContentTestBase {
|
||||
|
||||
/**
|
||||
* Stores blocks created during the test.
|
||||
* @var array
|
||||
*/
|
||||
protected $blocks;
|
||||
|
||||
/**
|
||||
* Stores log messages used during the test.
|
||||
* @var array
|
||||
*/
|
||||
protected $revisionLogs;
|
||||
|
||||
/**
|
||||
* Sets the test up.
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
/** @var UserInterface $user */
|
||||
$user = User::load(1);
|
||||
|
||||
// Create initial block.
|
||||
$block = $this->createBlockContent('initial');
|
||||
|
||||
$blocks = [];
|
||||
$logs = [];
|
||||
|
||||
// Get original block.
|
||||
$blocks[] = $block->getRevisionId();
|
||||
$logs[] = '';
|
||||
|
||||
// Create three revisions.
|
||||
$revision_count = 3;
|
||||
for ($i = 0; $i < $revision_count; $i++) {
|
||||
$block->setNewRevision(TRUE);
|
||||
$block->setRevisionLogMessage($this->randomMachineName(32));
|
||||
$block->setRevisionUser($this->adminUser);
|
||||
$block->setRevisionCreationTime(REQUEST_TIME);
|
||||
$logs[] = $block->getRevisionLogMessage();
|
||||
$block->save();
|
||||
$blocks[] = $block->getRevisionId();
|
||||
}
|
||||
|
||||
$this->blocks = $blocks;
|
||||
$this->revisionLogs = $logs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks block revision related operations.
|
||||
*/
|
||||
public function testRevisions() {
|
||||
$blocks = $this->blocks;
|
||||
$logs = $this->revisionLogs;
|
||||
|
||||
foreach ($blocks as $delta => $revision_id) {
|
||||
// Confirm the correct revision text appears.
|
||||
/** @var \Drupal\block_content\BlockContentInterface $loaded */
|
||||
$loaded = $this->container->get('entity_type.manager')
|
||||
->getStorage('block_content')
|
||||
->loadRevision($revision_id);
|
||||
// Verify revision log is the same.
|
||||
$this->assertEqual($loaded->getRevisionLogMessage(), $logs[$delta], format_string('Correct log message found for revision @revision', [
|
||||
'@revision' => $loaded->getRevisionId(),
|
||||
]));
|
||||
if ($delta > 0) {
|
||||
$this->assertTrue($loaded->getRevisionUser() instanceof UserInterface, 'Revision User found.');
|
||||
$this->assertTrue(is_numeric($loaded->getRevisionUserId()), 'Revision User ID found.');
|
||||
$this->assertTrue(is_numeric($loaded->getRevisionCreationTime()), 'Revision time found.');
|
||||
}
|
||||
}
|
||||
|
||||
// Confirm that this is the default revision.
|
||||
$this->assertTrue($loaded->isDefaultRevision(), 'Third block revision is the default one.');
|
||||
|
||||
// Make a new revision and set it to not be default.
|
||||
// This will create a new revision that is not "front facing".
|
||||
// Save this as a non-default revision.
|
||||
$loaded->setNewRevision();
|
||||
$loaded->isDefaultRevision(FALSE);
|
||||
$loaded->body = $this->randomMachineName(8);
|
||||
$loaded->save();
|
||||
|
||||
$this->drupalGet('block/' . $loaded->id());
|
||||
$this->assertNoText($loaded->body->value, 'Revision body text is not present on default version of block.');
|
||||
|
||||
// Verify that the non-default revision id is greater than the default
|
||||
// revision id.
|
||||
$default_revision = BlockContent::load($loaded->id());
|
||||
$this->assertTrue($loaded->getRevisionId() > $default_revision->getRevisionId(), 'Revision id is greater than default revision id.');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Functional;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
|
||||
/**
|
||||
* Tests $block_content->save() for saving content.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class BlockContentSaveTest extends BlockContentTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['block_content_test'];
|
||||
|
||||
/**
|
||||
* Sets the test up.
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalLogin($this->adminUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether custom block IDs are saved properly during an import.
|
||||
*/
|
||||
public function testImport() {
|
||||
// Custom block ID must be a number that is not in the database.
|
||||
$max_id = db_query('SELECT MAX(id) FROM {block_content}')->fetchField();
|
||||
$test_id = $max_id + mt_rand(1000, 1000000);
|
||||
$info = $this->randomMachineName(8);
|
||||
$block_array = [
|
||||
'info' => $info,
|
||||
'body' => ['value' => $this->randomMachineName(32)],
|
||||
'type' => 'basic',
|
||||
'id' => $test_id
|
||||
];
|
||||
$block = BlockContent::create($block_array);
|
||||
$block->enforceIsNew(TRUE);
|
||||
$block->save();
|
||||
|
||||
// Verify that block_submit did not wipe the provided id.
|
||||
$this->assertEqual($block->id(), $test_id, 'Block imported using provide id');
|
||||
|
||||
// Test the import saved.
|
||||
$block_by_id = BlockContent::load($test_id);
|
||||
$this->assertTrue($block_by_id, 'Custom block load by block ID.');
|
||||
$this->assertIdentical($block_by_id->body->value, $block_array['body']['value']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests determining changes in hook_block_presave().
|
||||
*
|
||||
* Verifies the static block load cache is cleared upon save.
|
||||
*/
|
||||
public function testDeterminingChanges() {
|
||||
// Initial creation.
|
||||
$block = $this->createBlockContent('test_changes');
|
||||
$this->assertEqual($block->getChangedTime(), REQUEST_TIME, 'Creating a block sets default "changed" timestamp.');
|
||||
|
||||
// Update the block without applying changes.
|
||||
$block->save();
|
||||
$this->assertEqual($block->label(), 'test_changes', 'No changes have been determined.');
|
||||
|
||||
// Apply changes.
|
||||
$block->setInfo('updated');
|
||||
$block->save();
|
||||
|
||||
// The hook implementations block_content_test_block_content_presave() and
|
||||
// block_content_test_block_content_update() determine changes and change
|
||||
// the title as well as programmatically set the 'changed' timestamp.
|
||||
$this->assertEqual($block->label(), 'updated_presave_update', 'Changes have been determined.');
|
||||
$this->assertEqual($block->getChangedTime(), 979534800, 'Saving a custom block uses "changed" timestamp set in presave hook.');
|
||||
|
||||
// Test the static block load cache to be cleared.
|
||||
$block = BlockContent::load($block->id());
|
||||
$this->assertEqual($block->label(), 'updated_presave', 'Static cache has been cleared.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests saving a block on block insert.
|
||||
*
|
||||
* This test ensures that a block has been fully saved when
|
||||
* hook_block_content_insert() is invoked, so that the block can be saved again
|
||||
* in a hook implementation without errors.
|
||||
*
|
||||
* @see block_test_block_insert()
|
||||
*/
|
||||
public function testBlockContentSaveOnInsert() {
|
||||
// block_content_test_block_content_insert() triggers a save on insert if the
|
||||
// title equals 'new'.
|
||||
$block = $this->createBlockContent('new');
|
||||
$this->assertEqual($block->label(), 'BlockContent ' . $block->id(), 'Custom block saved on block insert.');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Functional;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\block_content\Entity\BlockContentType;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
* Sets up block content types.
|
||||
*/
|
||||
abstract class BlockContentTestBase extends BrowserTestBase {
|
||||
|
||||
/**
|
||||
* Profile to use.
|
||||
*/
|
||||
protected $profile = 'testing';
|
||||
|
||||
/**
|
||||
* Admin user
|
||||
*
|
||||
* @var \Drupal\user\UserInterface
|
||||
*/
|
||||
protected $adminUser;
|
||||
|
||||
/**
|
||||
* Permissions to grant admin user.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $permissions = [
|
||||
'administer blocks'
|
||||
];
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['block', 'block_content'];
|
||||
|
||||
/**
|
||||
* Whether or not to auto-create the basic block type during setup.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $autoCreateBasicBlockType = TRUE;
|
||||
|
||||
/**
|
||||
* Sets the test up.
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
if ($this->autoCreateBasicBlockType) {
|
||||
$this->createBlockContentType('basic', TRUE);
|
||||
}
|
||||
|
||||
$this->adminUser = $this->drupalCreateUser($this->permissions);
|
||||
$this->drupalPlaceBlock('local_actions_block');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a custom block.
|
||||
*
|
||||
* @param bool|string $title
|
||||
* (optional) Title of block. When no value is given uses a random name.
|
||||
* Defaults to FALSE.
|
||||
* @param string $bundle
|
||||
* (optional) Bundle name. Defaults to 'basic'.
|
||||
* @param bool $save
|
||||
* (optional) Whether to save the block. Defaults to TRUE.
|
||||
*
|
||||
* @return \Drupal\block_content\Entity\BlockContent
|
||||
* Created custom block.
|
||||
*/
|
||||
protected function createBlockContent($title = FALSE, $bundle = 'basic', $save = TRUE) {
|
||||
$title = $title ?: $this->randomMachineName();
|
||||
$block_content = BlockContent::create([
|
||||
'info' => $title,
|
||||
'type' => $bundle,
|
||||
'langcode' => 'en'
|
||||
]);
|
||||
if ($block_content && $save === TRUE) {
|
||||
$block_content->save();
|
||||
}
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a custom block type (bundle).
|
||||
*
|
||||
* @param string $label
|
||||
* The block type label.
|
||||
* @param bool $create_body
|
||||
* Whether or not to create the body field
|
||||
*
|
||||
* @return \Drupal\block_content\Entity\BlockContentType
|
||||
* Created custom block type.
|
||||
*/
|
||||
protected function createBlockContentType($label, $create_body = FALSE) {
|
||||
$bundle = BlockContentType::create([
|
||||
'id' => $label,
|
||||
'label' => $label,
|
||||
'revision' => FALSE,
|
||||
]);
|
||||
$bundle->save();
|
||||
if ($create_body) {
|
||||
block_content_add_body_field($bundle->id());
|
||||
}
|
||||
return $bundle;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\block_content\Functional;
|
||||
|
||||
use Drupal\block_content\Entity\BlockContent;
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
||||
/**
|
||||
* Create a block and test block edit functionality.
|
||||
*
|
||||
* @group block_content
|
||||
*/
|
||||
class PageEditTest extends BlockContentTestBase {
|
||||
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks block edit functionality.
|
||||
*/
|
||||
public function testPageEdit() {
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
$title_key = 'info[0][value]';
|
||||
$body_key = 'body[0][value]';
|
||||
// Create block to edit.
|
||||
$edit = [];
|
||||
$edit['info[0][value]'] = Unicode::strtolower($this->randomMachineName(8));
|
||||
$edit[$body_key] = $this->randomMachineName(16);
|
||||
$this->drupalPostForm('block/add/basic', $edit, t('Save'));
|
||||
|
||||
// Check that the block exists in the database.
|
||||
$blocks = \Drupal::entityQuery('block_content')->condition('info', $edit['info[0][value]'])->execute();
|
||||
$block = BlockContent::load(reset($blocks));
|
||||
$this->assertTrue($block, 'Custom block found in database.');
|
||||
|
||||
// Load the edit page.
|
||||
$this->drupalGet('block/' . $block->id());
|
||||
$this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
|
||||
$this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
|
||||
|
||||
// Edit the content of the block.
|
||||
$edit = [];
|
||||
$edit[$title_key] = $this->randomMachineName(8);
|
||||
$edit[$body_key] = $this->randomMachineName(16);
|
||||
// Stay on the current page, without reloading.
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
|
||||
// Edit the same block, creating a new revision.
|
||||
$this->drupalGet("block/" . $block->id());
|
||||
$edit = [];
|
||||
$edit['info[0][value]'] = $this->randomMachineName(8);
|
||||
$edit[$body_key] = $this->randomMachineName(16);
|
||||
$edit['revision'] = TRUE;
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
|
||||
// Ensure that the block revision has been created.
|
||||
\Drupal::entityManager()->getStorage('block_content')->resetCache([$block->id()]);
|
||||
$revised_block = BlockContent::load($block->id());
|
||||
$this->assertNotIdentical($block->getRevisionId(), $revised_block->getRevisionId(), 'A new revision has been created.');
|
||||
|
||||
// Test deleting the block.
|
||||
$this->drupalGet("block/" . $revised_block->id());
|
||||
$this->clickLink(t('Delete'));
|
||||
$this->assertText(format_string('Are you sure you want to delete the custom block @label?', ['@label' => $revised_block->label()]));
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
|||
*/
|
||||
class MigrateBlockContentBodyFieldTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = array('block', 'block_content', 'filter', 'text');
|
||||
public static $modules = ['block', 'block_content', 'filter', 'text'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -13,7 +13,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
|||
*/
|
||||
class MigrateBlockContentTypeTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = array('block', 'block_content', 'filter', 'text');
|
||||
public static $modules = ['block', 'block_content', 'filter', 'text'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -13,11 +13,11 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
|||
*/
|
||||
class MigrateCustomBlockTest extends MigrateDrupal7TestBase {
|
||||
|
||||
public static $modules = array(
|
||||
public static $modules = [
|
||||
'block_content',
|
||||
'filter',
|
||||
'text',
|
||||
);
|
||||
];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -13,32 +13,32 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|||
class BlockContentLocalTasksTest extends LocalTaskIntegrationTestBase {
|
||||
|
||||
protected function setUp() {
|
||||
$this->directoryList = array(
|
||||
$this->directoryList = [
|
||||
'block' => 'core/modules/block',
|
||||
'block_content' => 'core/modules/block_content',
|
||||
);
|
||||
];
|
||||
parent::setUp();
|
||||
|
||||
$config_factory = $this->getConfigFactoryStub(array('system.theme' => array(
|
||||
$config_factory = $this->getConfigFactoryStub(['system.theme' => [
|
||||
'default' => 'test_c',
|
||||
)));
|
||||
]]);
|
||||
|
||||
$themes = array();
|
||||
$themes['test_a'] = (object) array(
|
||||
$themes = [];
|
||||
$themes['test_a'] = (object) [
|
||||
'status' => 0,
|
||||
);
|
||||
$themes['test_b'] = (object) array(
|
||||
];
|
||||
$themes['test_b'] = (object) [
|
||||
'status' => 1,
|
||||
'info' => array(
|
||||
'info' => [
|
||||
'name' => 'test_b',
|
||||
),
|
||||
);
|
||||
$themes['test_c'] = (object) array(
|
||||
],
|
||||
];
|
||||
$themes['test_c'] = (object) [
|
||||
'status' => 1,
|
||||
'info' => array(
|
||||
'info' => [
|
||||
'name' => 'test_c',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
$theme_handler = $this->getMock('Drupal\Core\Extension\ThemeHandlerInterface');
|
||||
$theme_handler->expects($this->any())
|
||||
->method('listInfo')
|
||||
|
@ -56,25 +56,25 @@ class BlockContentLocalTasksTest extends LocalTaskIntegrationTestBase {
|
|||
* @dataProvider getBlockContentListingRoutes
|
||||
*/
|
||||
public function testBlockContentListLocalTasks($route) {
|
||||
$this->assertLocalTasks($route, array(
|
||||
0 => array(
|
||||
$this->assertLocalTasks($route, [
|
||||
0 => [
|
||||
'block.admin_display',
|
||||
'entity.block_content.collection',
|
||||
),
|
||||
1 => array(
|
||||
],
|
||||
1 => [
|
||||
'block_content.list_sub',
|
||||
'entity.block_content_type.collection',
|
||||
),
|
||||
));
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a list of routes to test.
|
||||
*/
|
||||
public function getBlockContentListingRoutes() {
|
||||
return array(
|
||||
array('entity.block_content.collection', 'entity.block_content_type.collection'),
|
||||
);
|
||||
return [
|
||||
['entity.block_content.collection', 'entity.block_content_type.collection'],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue