BlockTemplateSuggestionsTest.php in Zircon Profile 8
File
core/modules/block/src/Tests/BlockTemplateSuggestionsTest.php
View source
<?php
namespace Drupal\block\Tests;
use Drupal\simpletest\WebTestBase;
class BlockTemplateSuggestionsTest extends WebTestBase {
public static $modules = array(
'block',
);
function testBlockThemeHookSuggestions() {
$block = entity_create('block', array(
'plugin' => 'system_menu_block:admin',
'region' => 'footer',
'id' => 'machinename',
));
$variables = array();
$plugin = $block
->getPlugin();
$variables['elements']['#configuration'] = $plugin
->getConfiguration();
$variables['elements']['#plugin_id'] = $plugin
->getPluginId();
$variables['elements']['#id'] = $block
->id();
$variables['elements']['#base_plugin_id'] = $plugin
->getBaseId();
$variables['elements']['#derivative_plugin_id'] = $plugin
->getDerivativeId();
$variables['elements']['content'] = array();
$suggestions = block_theme_suggestions_block($variables);
$this
->assertEqual($suggestions, array(
'block__system',
'block__system_menu_block',
'block__system_menu_block__admin',
'block__machinename',
));
}
}