diff --git a/core/modules/block/block.js b/core/modules/block/block.js index 302c315..d6180f0 100644 --- a/core/modules/block/block.js +++ b/core/modules/block/block.js @@ -54,7 +54,9 @@ } var table = $('#blocks'); - var tableDrag = Drupal.tableDrag.blocks; // Get the blocks tableDrag object. + + // Get the blocks tableDrag object. + var tableDrag = Drupal.tableDrag.blocks; // Add a handler for when a row is swapped, update empty regions. tableDrag.row.prototype.onSwap = function (swappedRow) { diff --git a/core/modules/block/css/block.admin.css b/core/modules/block/css/block.admin.css index 407c7c0..1a4f4a4 100644 --- a/core/modules/block/css/block.admin.css +++ b/core/modules/block/css/block.admin.css @@ -66,8 +66,7 @@ a.block-demo-backlink:hover { } /* Wide screens */ -@media -screen and (min-width: 780px), +@media screen and (min-width: 780px), (orientation: landscape) and (min-device-height: 780px) { .block-list-primary { @@ -100,8 +99,8 @@ screen and (min-width: 780px), .block-list-secondary .form-color, .block-list-secondary textarea { -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; width: 100%; max-width: 100%; } @@ -113,8 +112,7 @@ screen and (min-width: 780px), * toolbar is on, we need to suppress layout for the original media width + the * toolbar width (240px). In this case, 240px + 780px. */ -@media -screen and (max-width: 1020px), +@media screen and (max-width: 1020px), (orientation: landscape) and (max-device-height: 1020px) { .toolbar-vertical .block-list-primary, diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php index e30c42d..6ee54b1 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Controller/CustomBlockController.php @@ -88,12 +88,12 @@ public function add(Request $request) { */ public function addForm(CustomBlockTypeInterface $custom_block_type, Request $request) { $block = $this->customBlockStorage->create(array( - 'type' => $custom_block_type->id() + 'type' => $custom_block_type->id(), )); if (($theme = $request->query->get('theme')) && in_array($theme, array_keys(list_themes()))) { - // We have navigated to this page from the block library and will keep track - // of the theme for redirecting the user to the configuration page for the - // newly created block in the given theme. + // We have navigated to this page from the block library and will keep + // track of the theme for redirecting the user to the configuration + // page for the newly created block in the given theme. $block->setTheme($theme); } return $this->entityFormBuilder()->getForm($block); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php index 5758788..8114fff 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php @@ -50,7 +50,7 @@ public function form(array $form, array &$form_state) { '#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => $block_type->revision, - '#description' => t('Create a new revision by default for this block type.') + '#description' => t('Create a new revision by default for this block type.'), ); if ($this->moduleHandler->moduleExists('content_translation')) { diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php index e05089e..585a89b 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php @@ -65,11 +65,11 @@ class CustomBlockBlock extends BlockBase implements ContainerFactoryPluginInterf * The plugin ID for the plugin instance. * @param array $plugin_definition * The plugin implementation definition. - * @param \Drupal\block\Plugin\Type\BlockManager + * @param \Drupal\block\Plugin\Type\BlockManager $block_manager * The Plugin Block Manager. * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The entity manager service. - * @param \Drupal\Core\Extension\ModuleHandlerInterface + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The Module Handler. * @param \Drupal\Core\Session\AccountInterface $account * The account for which view access should be checked. @@ -126,7 +126,7 @@ public function blockForm($form, &$form_state) { '#options' => $this->entityManager->getViewModeOptions('custom_block'), '#title' => t('View mode'), '#description' => t('Output the block in this view mode.'), - '#default_value' => $this->configuration['view_mode'] + '#default_value' => $this->configuration['view_mode'], ); $form['title']['#description'] = t('The title of the block as shown to the user.'); return $form; @@ -155,9 +155,9 @@ public function build() { return array( '#markup' => t('Block with uuid %uuid does not exist. Add custom block.', array( '%uuid' => $uuid, - '!url' => url('block/add') + '!url' => url('block/add'), )), - '#access' => $this->account->hasPermission('administer blocks') + '#access' => $this->account->hasPermission('administer blocks'), ); } } diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockBuildContentTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockBuildContentTest.php index cee6ce8..de7026d 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockBuildContentTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockBuildContentTest.php @@ -29,7 +29,8 @@ public static function getInfo() { public function testCustomBlockRebuildContent() { $block = $this->createCustomBlock(); - // Set a property in the content array so we can test for its existence later on. + // Set a property in the content array so we can test for its existence + // later on. $block->content['test_content_property'] = array( '#value' => $this->randomString(), ); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php index 167014e..60b3ae2 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php @@ -67,7 +67,7 @@ public function testCustomBlockCreation() { // Check that the Basic block has been created. $this->assertRaw(format_string('!block %name has been created.', array( '!block' => 'Basic block', - '%name' => $edit['info[0][value]'] + '%name' => $edit['info[0][value]'], )), 'Basic block created.'); // Change the view mode. @@ -92,7 +92,7 @@ public function testCustomBlockCreation() { // Check that the Basic block has been created. $this->assertRaw(format_string('A block with description %name already exists.', array( - '%name' => $edit['info[0][value]'] + '%name' => $edit['info[0][value]'], ))); $this->assertResponse(200); } diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php index 5c7d46b..a9e0268 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php @@ -97,7 +97,7 @@ public function testBlockFields() { $edit = array( 'info[0][value]' => $this->randomName(8), $this->field->getName() . '[0][url]' => 'http://example.com', - $this->field->getName() . '[0][title]' => 'Example.com' + $this->field->getName() . '[0][title]' => 'Example.com', ); $this->drupalPostForm(NULL, $edit, t('Save')); $block = entity_load('custom_block', 1); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php index 82bcb44..8785955 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockListTest.php @@ -23,6 +23,9 @@ class CustomBlockListTest extends WebTestBase { */ public static $modules = array('block', 'custom_block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Custom Block listing', diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php index ff0192e..27ea748 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockSaveTest.php @@ -53,7 +53,7 @@ public function testImport() { 'info' => $info, 'body' => array('value' => $this->randomName(32)), 'type' => 'basic', - 'id' => $test_id + 'id' => $test_id, ); $block = entity_create('custom_block', $block_array); $block->enforceIsNew(TRUE); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php index cf731fc..2b378aa 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTestBase.php @@ -32,7 +32,7 @@ * @var array */ protected $permissions = array( - 'administer blocks' + 'administer blocks', ); /** @@ -63,11 +63,11 @@ protected function setUp() { * Created custom block. */ protected function createCustomBlock($title = FALSE, $bundle = 'basic') { - $title = ($title ? : $this->randomName()); + $title = ($title ?: $this->randomName()); if ($custom_block = entity_create('custom_block', array( 'info' => $title, 'type' => $bundle, - 'langcode' => 'en' + 'langcode' => 'en', ))) { $custom_block->save(); } @@ -87,7 +87,7 @@ protected function createCustomBlockType($label) { $bundle = entity_create('custom_block_type', array( 'id' => $label, 'label' => $label, - 'revision' => FALSE + 'revision' => FALSE, )); $bundle->save(); return $bundle; diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php index 761936e..9ad6a96 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php @@ -30,11 +30,11 @@ class CustomBlockTranslationUITest extends ContentTranslationUITest { 'content_translation', 'block', 'field_ui', - 'custom_block' + 'custom_block', ); /** - * Declares test information. + * {@inheritdoc} */ public static function getInfo() { return array( @@ -63,7 +63,7 @@ public function getTranslatorPermissions() { 'translate any entity', 'access administration pages', 'administer blocks', - 'administer custom_block fields' + 'administer custom_block fields', )); } @@ -81,12 +81,12 @@ public function getTranslatorPermissions() { * Created custom block. */ protected function createCustomBlock($title = FALSE, $bundle = FALSE) { - $title = ($title ? : $this->randomName()); - $bundle = ($bundle ? : $this->bundle); + $title = ($title ?: $this->randomName()); + $bundle = ($bundle ?: $this->bundle); $custom_block = entity_create('custom_block', array( 'info' => $title, 'type' => $bundle, - 'langcode' => 'en' + 'langcode' => 'en', )); $custom_block->save(); return $custom_block; @@ -122,7 +122,7 @@ public function testDisabledBundle() { $bundle = entity_create('custom_block_type', array( 'id' => $disabled_bundle, 'label' => $disabled_bundle, - 'revision' => FALSE + 'revision' => FALSE, )); $bundle->save(); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php index 739f234..a1ba0fa 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTypeTest.php @@ -26,7 +26,7 @@ class CustomBlockTypeTest extends CustomBlockTestBase { */ protected $permissions = array( 'administer blocks', - 'administer custom_block fields' + 'administer custom_block fields', ); /** @@ -163,12 +163,13 @@ public function testsCustomBlockAddTypes() { // For each enabled theme, go to its block page and test the redirects. $themes = array('bartik', 'stark', 'seven'); foreach ($themes as $theme) { - // Test that adding a block from the 'place blocks' form sends you to the - // block configure form. + // Test that adding a block from the 'place blocks' form sends you to + // the block configure form. $path = $theme == $default_theme ? 'admin/structure/block' : "admin/structure/block/list/$theme"; $this->drupalGet($path); $this->clickLink(t('Add custom block')); - // The seven theme has markup inside the link, we cannot use clickLink(). + // The seven theme has markup inside the link, we cannot use + // clickLink(). if ($default_theme == 'seven') { $options = $theme != $default_theme ? array('query' => array('theme' => $theme)) : array(); $this->assertLinkByHref(url('block/add/foo', $options)); diff --git a/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php b/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php index d04ad15..1bf586c 100644 --- a/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php +++ b/core/modules/block/custom_block/tests/Drupal/custom_blocks/Tests/Menu/CustomBlockLocalTasksTest.php @@ -17,6 +17,9 @@ */ class CustomBlockLocalTasksTest extends LocalTaskIntegrationTest { + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Custom Block local tasks test', @@ -25,6 +28,9 @@ public static function getInfo() { ); } + /** + * {@inheritdoc} + */ public function setUp() { $this->directoryList = array( 'block' => 'core/modules/block', @@ -39,7 +45,6 @@ public function setUp() { * @dataProvider getCustomBlockListingRoutes */ public function testCustomBlockListLocalTasks($route) { - // $this->assertLocalTasks($route, array( 0 => array( 'block.admin_display', @@ -48,7 +53,7 @@ public function testCustomBlockListLocalTasks($route) { 1 => array( 'custom_block.list_sub', 'custom_block.type_list', - ) + ), )); } diff --git a/core/modules/block/js/block.admin.js b/core/modules/block/js/block.admin.js index 44a4a74..4dda8c8 100644 --- a/core/modules/block/js/block.admin.js +++ b/core/modules/block/js/block.admin.js @@ -53,6 +53,7 @@ else { $blocks.show(); $details.show(); + // Return
elements that had been closed before filtering // to a closed state. $details.filter('[data-drupal-block-state="forced-open"]').removeAttr('open data-drupal-block-state'); diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index adedc48..f6bb14a 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -294,7 +294,7 @@ public function getCacheBin() { * {@inheritdoc} */ public function getCacheMaxAge() { - return (int)$this->configuration['cache']['max_age']; + return (int) $this->configuration['cache']['max_age']; } /** diff --git a/core/modules/block/lib/Drupal/block/BlockFormController.php b/core/modules/block/lib/Drupal/block/BlockFormController.php index c4efba1..e90c5c5 100644 --- a/core/modules/block/lib/Drupal/block/BlockFormController.php +++ b/core/modules/block/lib/Drupal/block/BlockFormController.php @@ -290,9 +290,7 @@ public function validate(array $form, array &$form_state) { $form_state['values']['visibility']['role']['roles'] = array_filter($form_state['values']['visibility']['role']['roles']); // The Block Entity form puts all block plugin form elements in the // settings form element, so just pass that to the block for validation. - $settings = array( - 'values' => &$form_state['values']['settings'] - ); + $settings = array('values' => &$form_state['values']['settings']); // Call the plugin validate handler. $this->entity->getPlugin()->validateConfigurationForm($form, $settings); } @@ -327,9 +325,7 @@ public function submit(array $form, array &$form_state) { 'route_parameters' => array( 'theme' => $form_state['values']['theme'], ), - 'options' => array( - 'query' => array('block-placement' => drupal_html_class($this->entity->id())) - ), + 'options' => array('query' => array('block-placement' => drupal_html_class($this->entity->id()))), ); } diff --git a/core/modules/block/lib/Drupal/block/BlockPluginBag.php b/core/modules/block/lib/Drupal/block/BlockPluginBag.php index 5693281..3c327b4 100644 --- a/core/modules/block/lib/Drupal/block/BlockPluginBag.php +++ b/core/modules/block/lib/Drupal/block/BlockPluginBag.php @@ -44,8 +44,6 @@ public function __construct(PluginManagerInterface $manager, $instance_id, array /** * {@inheritdoc} - * - * @return \Drupal\block\BlockPluginInterface */ public function &get($instance_id) { return parent::get($instance_id); diff --git a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php index 4f6bdc2..dea63e7 100644 --- a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php +++ b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php @@ -59,7 +59,8 @@ public function build(); * * @todo This doesn't belong here. Move this into a new base class in * http://drupal.org/node/1764380. - * @todo This does not set a value in \Drupal::config(), so the name is confusing. + * @todo This does not set a value in \Drupal::config(), so the name is + * confusing. * * @see \Drupal\Component\Plugin\PluginBase::$configuration */ @@ -76,8 +77,8 @@ public function setConfigurationValue($key, $value); * @param array $form_state * An array containing the current state of the configuration form. * - * @return array $form - * The renderable form array representing the entire configuration form. + * @return array + * The renderable array $form representing the entire configuration form. */ public function blockForm($form, &$form_state); diff --git a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php index a6a925a..dfcac7d 100644 --- a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php +++ b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php @@ -77,7 +77,6 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la ); $build[$entity_id]['#cache']['tags'] = NestedArray::mergeDeep($default_cache_tags, $plugin->getCacheTags()); - if ($plugin->isCacheable()) { $build[$entity_id]['#pre_render'][] = array($this, 'buildBlock'); // Generic cache keys, with the block plugin's custom keys appended @@ -113,7 +112,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la } /** - * #pre_render callback for building a block. + * The #pre_render callback for building a block. * * Renders the content using the provided block plugin, and then: * - if there is no content, aborts rendering, and makes sure the block won't @@ -153,7 +152,7 @@ public function buildBlock($build) { ); } return $build; - } + } /** * {@inheritdoc} diff --git a/core/modules/block/lib/Drupal/block/Controller/BlockController.php b/core/modules/block/lib/Drupal/block/Controller/BlockController.php index ebd9bc9..e09b547 100644 --- a/core/modules/block/lib/Drupal/block/Controller/BlockController.php +++ b/core/modules/block/lib/Drupal/block/Controller/BlockController.php @@ -38,7 +38,7 @@ public function demo($theme) { // pages, it needs to know this is an actual administrative page. 'data' => array('currentPathIsAdmin' => TRUE), 'type' => 'setting', - ) + ), ), 'library' => array( 'block/drupal.block.admin', diff --git a/core/modules/block/lib/Drupal/block/Entity/Block.php b/core/modules/block/lib/Drupal/block/Entity/Block.php index 9e17171..cd95252 100644 --- a/core/modules/block/lib/Drupal/block/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Entity/Block.php @@ -116,7 +116,7 @@ public function getPluginBag() { } /** - * Overrides \Drupal\Core\Entity\Entity::label(); + * Overrides \Drupal\Core\Entity\Entity::label(). */ public function label() { $settings = $this->get('settings'); diff --git a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php index 9ee2ca9..f5fff81 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php @@ -41,6 +41,9 @@ class Block extends DisplayPluginBase { */ protected $usesAttachments = TRUE; + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -152,6 +155,7 @@ public function buildOptionsForm(&$form, &$form_state) { '#default_value' => $this->getOption('block_description'), ); break; + case 'block_category': $form['#title'] .= t('Block category'); $form['block_category'] = array( @@ -161,6 +165,7 @@ public function buildOptionsForm(&$form, &$form_state) { '#default_value' => $this->getOption('block_category'), ); break; + case 'block_hide_empty': $form['#title'] .= t('Block empty settings'); @@ -171,6 +176,7 @@ public function buildOptionsForm(&$form, &$form_state) { '#default_value' => $this->getOption('block_hide_empty'), ); break; + case 'exposed_form_options': $this->view->initHandlers(); if (!$this->usesExposed() && parent::usesExposed()) { @@ -180,6 +186,7 @@ public function buildOptionsForm(&$form, &$form_state) { ); } break; + case 'allow': $form['#title'] .= t('Allow settings in the block configuration'); @@ -194,11 +201,13 @@ public function buildOptionsForm(&$form, &$form_state) { '#options' => $options, ); break; + } } /** * Perform any necessary changes to the form values prior to storage. + * * There is no need for this function to actually store the data. */ public function submitOptionsForm(&$form, &$form_state) { @@ -225,9 +234,8 @@ public function submitOptionsForm(&$form, &$form_state) { * @param array $form_state * An array containing the current state of the configuration form. * - * @return array $form - * The renderable form array representing the entire configuration form. - * + * @return array + * The renderable array $form representing the entire configuration form. * @see \Drupal\views\Plugin\Block\ViewsBlock::blockForm() */ public function blockForm(ViewsBlock $block, array &$form, array &$form_state) { @@ -310,11 +318,11 @@ public function preBlockBuild(ViewsBlock $block) { * Block views use exposed widgets only if AJAX is set. */ public function usesExposed() { - if ($this->ajaxEnabled()) { - return parent::usesExposed(); - } - return FALSE; + if ($this->ajaxEnabled()) { + return parent::usesExposed(); } + return FALSE; + } /** * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::remove(). diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockAdminThemeTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockAdminThemeTest.php index d553440..a3d4b9b 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockAdminThemeTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockAdminThemeTest.php @@ -21,6 +21,9 @@ class BlockAdminThemeTest extends WebTestBase { */ public static $modules = array('block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Administration theme', @@ -32,7 +35,7 @@ public static function getInfo() { /** * Check for the accessibility of the admin theme on the block admin page. */ - function testAdminTheme() { + public function testAdminTheme() { // Create administrative user. $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer themes')); $this->drupalLogin($admin_user); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php index ce78720..14e3a0e 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php @@ -22,9 +22,9 @@ class BlockCacheTest extends WebTestBase { */ public static $modules = array('block', 'block_test'); - protected $admin_user; - protected $normal_user; - protected $normal_user_alt; + protected $adminUser; + protected $normalUser; + protected $normalUserAlt; /** * The block used by this test. @@ -33,6 +33,9 @@ class BlockCacheTest extends WebTestBase { */ protected $block; + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block caching', @@ -41,29 +44,32 @@ public static function getInfo() { ); } - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Create an admin user, log in and enable test blocks. - $this->admin_user = $this->drupalCreateUser(array('administer blocks', 'access administration pages')); - $this->drupalLogin($this->admin_user); + $this->adminUser = $this->drupalCreateUser(array('administer blocks', 'access administration pages')); + $this->drupalLogin($this->adminUser); // Create additional users to test caching modes. - $this->normal_user = $this->drupalCreateUser(); - $this->normal_user_alt = $this->drupalCreateUser(); + $this->normalUser = $this->drupalCreateUser(); + $this->normalUserAlt = $this->drupalCreateUser(); // Sync the roles, since drupalCreateUser() creates separate roles for // the same permission sets. - $this->normal_user_alt->roles = $this->normal_user->getRoles(); - $this->normal_user_alt->save(); + $this->normalUserAlt->roles = $this->normalUser->getRoles(); + $this->normalUserAlt->save(); // Enable our test block. - $this->block = $this->drupalPlaceBlock('test_cache'); + $this->block = $this->drupalPlaceBlock('test_cache'); } /** * Test "cache_context.user.roles" cache context. */ - function testCachePerRole() { + public function testCachePerRole() { $this->setBlockCacheConfig(array( 'max_age' => 600, 'contexts' => array('cache_context.user.roles'), @@ -72,7 +78,7 @@ function testCachePerRole() { // Enable our test block. Set some content for it to display. $current_content = $this->randomName(); \Drupal::state()->set('block_test.content', $current_content); - $this->drupalLogin($this->normal_user); + $this->drupalLogin($this->normalUser); $this->drupalGet(''); $this->assertText($current_content, 'Block content displays.'); @@ -97,15 +103,15 @@ function testCachePerRole() { $this->drupalGet(''); $this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.'); - $this->drupalLogin($this->normal_user_alt); + $this->drupalLogin($this->normalUserAlt); $this->drupalGet(''); $this->assertText($old_content, 'User with the same roles sees per-role cached content.'); - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); $this->drupalGet(''); $this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.'); - $this->drupalLogin($this->normal_user); + $this->drupalLogin($this->normalUser); $this->drupalGet(''); $this->assertText($old_content, 'Block is served from the per-role cache.'); } @@ -113,7 +119,7 @@ function testCachePerRole() { /** * Test a cacheable block without any cache context. */ - function testCacheGlobal() { + public function testCacheGlobal() { $this->setBlockCacheConfig(array( 'max_age' => 600, )); @@ -136,7 +142,7 @@ function testCacheGlobal() { /** * Test non-cacheable block. */ - function testNoCache() { + public function testNoCache() { $this->setBlockCacheConfig(array( 'max_age' => 0, )); @@ -158,7 +164,7 @@ function testNoCache() { /** * Test "cache_context.user" cache context. */ - function testCachePerUser() { + public function testCachePerUser() { $this->setBlockCacheConfig(array( 'max_age' => 600, 'contexts' => array('cache_context.user'), @@ -166,7 +172,7 @@ function testCachePerUser() { $current_content = $this->randomName(); \Drupal::state()->set('block_test.content', $current_content); - $this->drupalLogin($this->normal_user); + $this->drupalLogin($this->normalUser); $this->drupalGet(''); $this->assertText($current_content, 'Block content displays.'); @@ -178,11 +184,11 @@ function testCachePerUser() { $this->drupalGet(''); $this->assertText($old_content, 'Block is served from per-user cache.'); - $this->drupalLogin($this->normal_user_alt); + $this->drupalLogin($this->normalUserAlt); $this->drupalGet(''); $this->assertText($current_content, 'Per-user block cache is not served for other users.'); - $this->drupalLogin($this->normal_user); + $this->drupalLogin($this->normalUser); $this->drupalGet(''); $this->assertText($old_content, 'Per-user block cache is persistent.'); } @@ -190,7 +196,7 @@ function testCachePerUser() { /** * Test "cache_context.url" cache context. */ - function testCachePerPage() { + public function testCachePerPage() { $this->setBlockCacheConfig(array( 'max_age' => 600, 'contexts' => array('cache_context.url'), diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php index 3fa85d6..d05c63a 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php @@ -26,6 +26,9 @@ class BlockHiddenRegionTest extends WebTestBase { */ public static $modules = array('block', 'block_test', 'search'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Blocks not in hidden region', @@ -34,7 +37,10 @@ public static function getInfo() { ); } - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Create administrative user. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php index 52120f1..0bc9a82 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHookOperationTest.php @@ -22,6 +22,9 @@ class BlockHookOperationTest extends WebTestBase { */ public static $modules = array('block', 'entity_test'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block operations hook', @@ -30,7 +33,10 @@ public static function getInfo() { ); } - public function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); $permissions = array( @@ -42,7 +48,7 @@ public function setUp() { $this->drupalLogin($admin_user); } - /* + /** * Tests the block list to see if the test_operation link is added. */ public function testBlockOperationAlter() { diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php index 63579b9..f433e7e 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlTest.php @@ -21,6 +21,9 @@ class BlockHtmlTest extends WebTestBase { */ public static $modules = array('block', 'block_test'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block HTML', @@ -29,7 +32,10 @@ public static function getInfo() { ); } - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); $this->drupalLogin($this->root_user); @@ -46,7 +52,7 @@ function setUp() { /** * Tests for valid HTML for a block. */ - function testHtml() { + public function testHtml() { $this->drupalGet(''); // Ensure that a block's ID is converted to an HTML valid ID, and that diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php index 6214e0c..b34e6eb 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockInterfaceTest.php @@ -16,6 +16,9 @@ class BlockInterfaceTest extends DrupalUnitTestBase { public static $modules = array('system', 'block', 'block_test', 'user'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block Plugins Tests', diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php index b44c4e2..5bde02a 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockInvalidRegionTest.php @@ -21,6 +21,9 @@ class BlockInvalidRegionTest extends WebTestBase { */ public static $modules = array('block', 'block_test'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Blocks in invalid regions', @@ -29,7 +32,10 @@ public static function getInfo() { ); } - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Create an admin user. $admin_user = $this->drupalCreateUser(array( @@ -43,7 +49,7 @@ function setUp() { /** * Tests that blocks assigned to invalid regions work correctly. */ - function testBlockInInvalidRegion() { + public function testBlockInInvalidRegion() { // Enable a test block and place it in an invalid region. $block = $this->drupalPlaceBlock('test_html'); $block->set('region', 'invalid_region'); @@ -51,7 +57,8 @@ function testBlockInInvalidRegion() { $warning_message = t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $block->id(), '%region' => 'invalid_region')); - // Clearing the cache should disable the test block placed in the invalid region. + // Clearing the cache should disable the test block placed in the + // invalid region. $this->drupalPostForm('admin/config/development/performance', array(), 'Clear all caches'); $this->assertRaw($warning_message, 'Enabled block was in the invalid region and has been disabled.'); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php index 5fec407..d634064 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageCacheTest.php @@ -30,6 +30,9 @@ class BlockLanguageCacheTest extends WebTestBase { */ protected $langcodes = array(); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Multilingual blocks', @@ -38,7 +41,10 @@ public static function getInfo() { ); } - public function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Create test languages. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php index 246e92c..103a97b 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php @@ -26,6 +26,9 @@ class BlockLanguageTest extends WebTestBase { */ public static $modules = array('language', 'block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Language block visibility', @@ -34,7 +37,10 @@ public static function getInfo() { ); } - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Create a new user, allow him to manage the blocks and the languages. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php index e343019..7fecb5d 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php @@ -21,6 +21,9 @@ class BlockPreprocessUnitTest extends WebTestBase { */ public static $modules = array('block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block preprocess', @@ -32,7 +35,7 @@ public static function getInfo() { /** * Tests block classes with template_preprocess_block(). */ - function testBlockClasses() { + public function testBlockClasses() { // Define a block with a derivative to be preprocessed, which includes both // an underscore (not transformed) and a hyphen (transformed to underscore), // and generates possibilities for each level of derivative. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php index b6aa269..a685297 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockRenderOrderTest.php @@ -21,6 +21,9 @@ class BlockRenderOrderTest extends WebTestBase { */ public static $modules = array('node', 'block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block Render Order', @@ -29,7 +32,10 @@ public static function getInfo() { ); } - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Create a test user. $end_user = $this->drupalCreateUser(array( @@ -41,7 +47,7 @@ function setUp() { /** * Tests the render order of the blocks. */ - function testBlockRenderOrder() { + public function testBlockRenderOrder() { // Enable test blocks and place them in the same region. $region = 'header'; $test_blocks = array( diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php index a84bdc4..6475902 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php @@ -33,14 +33,20 @@ class BlockStorageUnitTest extends DrupalUnitTestBase { */ protected $controller; + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block storage', 'description' => 'Tests the storage of blocks.', - 'group' => 'Block' + 'group' => 'Block', ); } + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php index 604b1a7..2595ab2 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php @@ -21,6 +21,9 @@ class BlockTemplateSuggestionsUnitTest extends WebTestBase { */ public static $modules = array('block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block template suggestions', @@ -32,7 +35,7 @@ public static function getInfo() { /** * Tests template suggestions from block_theme_suggestions_block(). */ - function testBlockThemeHookSuggestions() { + public function testBlockThemeHookSuggestions() { // Define a block with a derivative to be preprocessed, which includes both // an underscore (not transformed) and a hyphen (transformed to underscore), // and generates possibilities for each level of derivative. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 4fa4e63..33de03c 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -15,6 +15,9 @@ */ class BlockTest extends BlockTestBase { + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block functionality', @@ -26,7 +29,7 @@ public static function getInfo() { /** * Tests block visibility. */ - function testBlockVisibility() { + public function testBlockVisibility() { $block_name = 'system_powered_by_block'; // Create a random title for the block. $title = $this->randomName(8); @@ -64,10 +67,9 @@ function testBlockVisibility() { } /** - * Test block visibility when using "pages" restriction but leaving - * "pages" textarea empty + * Test block visibility with "pages" restriction and "pages" textarea empty. */ - function testBlockVisibilityListedEmpty() { + public function testBlockVisibilityListedEmpty() { $block_name = 'system_powered_by_block'; // Create a random title for the block. $title = $this->randomName(8); @@ -99,7 +101,7 @@ function testBlockVisibilityListedEmpty() { /** * Test configuring and moving a module-define block to specific regions. */ - function testBlock() { + public function testBlock() { // Select the 'Powered by Drupal' block to be configured and moved. $block = array(); $block['id'] = 'system_powered_by_block'; @@ -107,7 +109,8 @@ function testBlock() { $block['theme'] = \Drupal::config('system.theme')->get('default'); $block['region'] = 'header'; - // Set block title to confirm that interface works and override any custom titles. + // Set block title to confirm that interface works and override any custom + // titles. $this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], array('settings[label]' => $block['settings[label]'], 'id' => $block['id'], 'region' => $block['region']), t('Save block')); $this->assertText(t('The block configuration has been saved.'), 'Block title set.'); // Check to see if the block was created by checking its configuration. @@ -130,7 +133,7 @@ function testBlock() { // Confirm that the block instance title and markup are not displayed. $this->drupalGet('node'); - $this->assertNoText(t($block['settings[label]'])); + $this->assertNoText(t('@label', array('@label' => $block['settings[label]']))); // Check for
if the machine name // is my_block_instance_name. $xpath = $this->buildXPathQuery('//div[@id=:id]/*', array(':id' => 'block-' . str_replace('_', '-', strtolower($block['id'])))); @@ -184,7 +187,7 @@ public function testBlockThemeSelector() { /** * Test block title display settings. */ - function testHideBlockTitle() { + public function testHideBlockTitle() { $block_name = 'system_powered_by_block'; // Create a random title for the block. $title = $this->randomName(8); @@ -227,7 +230,7 @@ function testHideBlockTitle() { * The machine name of the theme region to move the block to, for example * 'header' or 'sidebar_first'. */ - function moveBlockToRegion(array $block, $region) { + public function moveBlockToRegion(array $block, $region) { // Set the created block to a specific region. $block += array('theme' => \Drupal::config('system.theme')->get('default')); $edit = array(); @@ -235,11 +238,11 @@ function moveBlockToRegion(array $block, $region) { $this->drupalPostForm('admin/structure/block', $edit, t('Save blocks')); // Confirm that the block was moved to the proper region. - $this->assertText(t('The block settings have been updated.'), format_string('Block successfully moved to %region_name region.', array( '%region_name' => $region))); + $this->assertText(t('The block settings have been updated.'), format_string('Block successfully moved to %region_name region.', array('%region_name' => $region))); // Confirm that the block is being displayed. $this->drupalGet(''); - $this->assertText(t($block['settings[label]']), 'Block successfully being displayed on the page.'); + $this->assertText(t('@label', array('@label' => $block['settings[label]'])), 'Block successfully being displayed on the page.'); // Confirm that the custom block was found at the proper region. $xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', array( diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php b/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php index 88073c3..27ef318 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php @@ -35,7 +35,10 @@ */ protected $adminUser; - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Use the test page as the front page. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php index f185f58..7abfcda 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php @@ -21,6 +21,9 @@ class BlockTitleXSSTest extends WebTestBase { */ public static $modules = array('block', 'block_test'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block XSS Title', @@ -29,6 +32,9 @@ public static function getInfo() { ); } + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); @@ -38,7 +44,7 @@ protected function setUp() { /** * Test XSS in title. */ - function testXSSInTitle() { + public function testXSSInTitle() { \Drupal::state()->set('block_test.content', $this->randomName()); $this->drupalGet(''); $this->assertNoRaw('', 'The block title was properly sanitized when rendered.'); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php index 356d480..7032146 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockUiTest.php @@ -42,6 +42,9 @@ class BlockUiTest extends WebTestBase { */ protected $adminUser; + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block UI', @@ -50,7 +53,10 @@ public static function getInfo() { ); } - function setUp() { + /** + * {@inheritdoc} + */ + protected function setUp() { parent::setUp(); // Create and log in an administrative user. $this->adminUser = $this->drupalCreateUser(array( @@ -96,7 +102,7 @@ public function testBlockDemoUiPage() { /** * Test block admin page exists and functions correctly. */ - function testBlockAdminUiPage() { + public function testBlockAdminUiPage() { // Visit the blocks admin ui. $this->drupalGet('admin/structure/block'); // Look for the blocks table. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php index 63bbf45..2b72a90 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockViewBuilderTest.php @@ -204,14 +204,14 @@ public function testBlockViewBuilderAlter() { // Basic: non-empty block. $build = $this->getBlockRenderArray(); - $this->assertTrue(isset($build['#suffix']) && $build['#suffix'] === '
Goodbye!', 'A block with content is altered.'); - $this->assertIdentical(drupal_render($build), 'Llamas > unicorns!
Goodbye!'); + $this->assertTrue(isset($build['#suffix']) && $build['#suffix'] === '
Goodbye!', 'A block with content is altered.'); + $this->assertIdentical(drupal_render($build), 'Llamas > unicorns!
Goodbye!'); // Basic: empty block. \Drupal::state()->set('block_test.content', NULL); $build = $this->getBlockRenderArray(); - $this->assertTrue(isset($build['#suffix']) && $build['#suffix'] === '
Goodbye!', 'A block without content is altered.'); - $this->assertIdentical(drupal_render($build), '
Goodbye!'); + $this->assertTrue(isset($build['#suffix']) && $build['#suffix'] === '
Goodbye!', 'A block without content is altered.'); + $this->assertIdentical(drupal_render($build), '
Goodbye!'); // Disable the block view alter hook that adds a suffix, for basic testing. \Drupal::state()->set('block_test_view_alter_suffix', FALSE); @@ -237,7 +237,9 @@ public function testBlockViewBuilderAlter() { $cache_entry = $this->container->get('cache.render')->get($cid); $this->assertTrue($cache_entry, 'The block render element has been cached with the expected cache ID.'); $expected_flattened_tags = array('content:1', 'block_view:1', 'block:test_block', 'block_plugin:test_cache'); - $this->assertIdentical($cache_entry->tags, array_combine($expected_flattened_tags, $expected_flattened_tags)); //, 'The block render element has been cached with the expected cache tags.'); + + // The block render element has been cached with the expected cache tags. + $this->assertIdentical($cache_entry->tags, array_combine($expected_flattened_tags, $expected_flattened_tags)); $this->container->get('cache.render')->delete($cid); // Advanced: cached block, but an alter hook adds an additional cache tag. @@ -251,7 +253,9 @@ public function testBlockViewBuilderAlter() { $cache_entry = $this->container->get('cache.render')->get($cid); $this->assertTrue($cache_entry, 'The block render element has been cached with the expected cache ID.'); $expected_flattened_tags = array('content:1', 'block_view:1', 'block:test_block', 'block_plugin:test_cache', $alter_add_tag . ':1'); - $this->assertIdentical($cache_entry->tags, array_combine($expected_flattened_tags, $expected_flattened_tags)); //, 'The block render element has been cached with the expected cache tags.'); + + // The block render element has been cached with the expected cache tags. + $this->assertIdentical($cache_entry->tags, array_combine($expected_flattened_tags, $expected_flattened_tags)); $this->container->get('cache.render')->delete($cid); // Advanced: cached block, but an alter hook adds a #pre_render callback to @@ -259,8 +263,8 @@ public function testBlockViewBuilderAlter() { \Drupal::state()->set('block_test_view_alter_append_pre_render_prefix', TRUE); $build = $this->getBlockRenderArray(); $this->assertFalse(isset($build['#prefix']), 'The appended #pre_render callback has not yet run before calling drupal_render().'); - $this->assertIdentical(drupal_render($build), 'Hiya!
'); - $this->assertTrue(isset($build['#prefix']) && $build['#prefix'] === 'Hiya!
', 'A cached block without content is altered.'); + $this->assertIdentical(drupal_render($build), 'Hiya!
'); + $this->assertTrue(isset($build['#prefix']) && $build['#prefix'] === 'Hiya!
', 'A cached block without content is altered.'); // Restore the previous request method. $this->container->get('request')->setMethod($request_method); diff --git a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php index c544960..d1a201c 100644 --- a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php @@ -21,6 +21,9 @@ class NewDefaultThemeBlocksTest extends WebTestBase { */ public static $modules = array('block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'New default theme blocks', @@ -32,7 +35,7 @@ public static function getInfo() { /** * Check the enabled Bartik blocks are correctly copied over. */ - function testNewDefaultThemeBlocks() { + public function testNewDefaultThemeBlocks() { $default_theme = \Drupal::config('system.theme')->get('default'); // Add two instances of the user login block. diff --git a/core/modules/block/lib/Drupal/block/Tests/NonDefaultBlockAdminTest.php b/core/modules/block/lib/Drupal/block/Tests/NonDefaultBlockAdminTest.php index 72f3d1d..a6e7ec6 100644 --- a/core/modules/block/lib/Drupal/block/Tests/NonDefaultBlockAdminTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/NonDefaultBlockAdminTest.php @@ -18,6 +18,9 @@ class NonDefaultBlockAdminTest extends WebTestBase { */ public static $modules = array('block'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Non default theme admin', @@ -29,7 +32,7 @@ public static function getInfo() { /** * Test non-default theme admin. */ - function testNonDefaultBlockAdmin() { + public function testNonDefaultBlockAdmin() { $admin_user = $this->drupalCreateUser(array('administer blocks', 'administer themes')); $this->drupalLogin($admin_user); $new_theme = 'bartik'; diff --git a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php index ca906ea..c4a2483 100644 --- a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php @@ -35,6 +35,9 @@ class DisplayBlockTest extends ViewTestBase { */ public static $testViews = array('test_view_block', 'test_view_block2'); + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => ' Display: Block', @@ -43,6 +46,9 @@ public static function getInfo() { ); } + /** + * {@inheritdoc} + */ protected function setUp() { parent::setUp(); @@ -200,8 +206,8 @@ public function testViewsBlockForm() { // Place the same block again and make sure we have a new ID. $this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, array(), t('Save block')); $block = $storage->load('views_block__test_view_block_block_1_' . $i); - // This will only return a result if our new block has been created with the - // expected machine name. + // This will only return a result if our new block has been created with + // the expected machine name. $this->assertTrue(!empty($block), 'The expected block was loaded.'); } diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php index 913130b..3a5faff 100644 --- a/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php @@ -19,6 +19,9 @@ */ class BlockBaseTest extends UnitTestCase { + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Base plugin', @@ -30,7 +33,7 @@ public static function getInfo() { /** * Tests the machine name suggestion. * - * @see \Drupal\block\BlockBase::getMachineNameSuggestion(). + * @see \Drupal\block\BlockBase::getMachineNameSuggestion() */ public function testGetMachineNameSuggestion() { $transliteraton = $this->getMockBuilder('Drupal\Core\Transliteration\PHPTransliteration') @@ -48,7 +51,7 @@ public function testGetMachineNameSuggestion() { $this->assertEquals('adminlabel', $block_base->getMachineNameSuggestion()); // Test with more unicodes. - $definition = array('admin_label' =>'über åwesome', 'provider' => 'block_test'); + $definition = array('admin_label' => 'über åwesome', 'provider' => 'block_test'); $block_base = new TestBlockInstantiation($config, 'test_block_instantiation', $definition); $this->assertEquals('uberawesome', $block_base->getMachineNameSuggestion()); } diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php index 98d8d6d..d6fb278 100644 --- a/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php @@ -22,14 +22,16 @@ class BlockConfigEntityUnitTest extends UnitTestCase { /** * The entity type used for testing. * - * @var \Drupal\Core\Entity\EntityTypeInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityTypeInterface + * \PHPUnit_Framework_MockObject_MockObject */ protected $entityType; /** * The entity manager used for testing. * - * @var \Drupal\Core\Entity\EntityManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\EntityManagerInterface + * \PHPUnit_Framework_MockObject_MockObject */ protected $entityManager; @@ -43,7 +45,8 @@ class BlockConfigEntityUnitTest extends UnitTestCase { /** * The UUID generator used for testing. * - * @var \Drupal\Component\Uuid\UuidInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Component\Uuid\UuidInterface + * \PHPUnit_Framework_MockObject_MockObject */ protected $uuid; @@ -84,6 +87,8 @@ public function setUp() { } /** + * Tests the config entity dependency calculation. + * * @covers ::calculateDependencies */ public function testCalculateDependencies() { diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php index 760060b..e327b61 100644 --- a/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php @@ -17,6 +17,9 @@ */ class BlockFormControllerTest extends UnitTestCase { + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block form controller', @@ -64,8 +67,8 @@ public function testGetUniqueMachineName() { $block_form_controller = new BlockFormController($entity_manager, $language_manager, $config_factory); - // Ensure that the block with just one other instance gets the next available - // name suggestion. + // Ensure that the block with just one other instance gets the next + // available name suggestion. $this->assertEquals('test_2', $block_form_controller->getUniqueMachineName($blocks['test'])); // Ensure that the block with already three instances (_0, _1, _2) gets the diff --git a/core/modules/block/tests/Drupal/block/Tests/CategoryAutocompleteTest.php b/core/modules/block/tests/Drupal/block/Tests/CategoryAutocompleteTest.php index 5ff93f2..6da35b5 100644 --- a/core/modules/block/tests/Drupal/block/Tests/CategoryAutocompleteTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/CategoryAutocompleteTest.php @@ -28,6 +28,9 @@ class CategoryAutocompleteTest extends UnitTestCase { */ protected $autocompleteController; + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block category autocomplete', @@ -36,6 +39,9 @@ public static function getInfo() { ); } + /** + * {@inheritdoc} + */ public function setUp() { $block_manager = $this->getMockBuilder('Drupal\block\Plugin\Type\BlockManager') ->disableOriginalConstructor() @@ -71,6 +77,7 @@ public function testAutocompleteSuggestions($string, $suggestions) { * Data provider for testAutocompleteSuggestions(). * * @return array + * An array of test autocomplete suggestions. */ public function providerTestAutocompleteSuggestions() { $test_parameters = array(); diff --git a/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php b/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php index bf7a3e4..fc843fb 100644 --- a/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/Menu/BlockLocalTasksTest.php @@ -18,6 +18,9 @@ */ class BlockLocalTasksTest extends LocalTaskIntegrationTest { + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => 'Block local tasks test', @@ -26,13 +29,14 @@ public static function getInfo() { ); } + /** + * {@inheritdoc} + */ public function setUp() { $this->directoryList = array('block' => 'core/modules/block'); parent::setUp(); - $config_factory = $this->getConfigFactoryStub(array('system.theme' => array( - 'default' => 'test_c', - ))); + $config_factory = $this->getConfigFactoryStub(array('system.theme' => array('default' => 'test_c'))); $themes = array(); $themes['test_a'] = (object) array( diff --git a/core/modules/block/tests/Drupal/block/Tests/Plugin/views/display/BlockTest.php b/core/modules/block/tests/Drupal/block/Tests/Plugin/views/display/BlockTest.php index 765cc57..2d13035 100644 --- a/core/modules/block/tests/Drupal/block/Tests/Plugin/views/display/BlockTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/Plugin/views/display/BlockTest.php @@ -19,24 +19,30 @@ class BlockTest extends UnitTestCase { /** * The view executable. * - * @var \Drupal\views\ViewExecutable|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\views\ViewExecutable + * \PHPUnit_Framework_MockObject_MockObject */ protected $executable; /** * The views block plugin. * - * @var \Drupal\views\Plugin\Block\ViewsBlock|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\views\Plugin\Block\ViewsBlock + * \PHPUnit_Framework_MockObject_MockObject */ protected $blockPlugin; /** * The tested block display plugin. * - * @var \Drupal\block\Plugin\views\display\Block|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\block\Plugin\views\display\Block + * \PHPUnit_Framework_MockObject_MockObject */ protected $blockDisplay; + /** + * {@inheritdoc} + */ public static function getInfo() { return array( 'name' => ' Views: Display Block', diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module index a527ae1..d840cca 100644 --- a/core/modules/block/tests/modules/block_test/block_test.module +++ b/core/modules/block/tests/modules/block_test/block_test.module @@ -21,7 +21,7 @@ function block_test_block_alter(&$block_info) { */ function block_test_block_view_test_cache_alter(array &$build, BlockPluginInterface $block) { if (\Drupal::state()->get('block_test_view_alter_suffix') !== NULL) { - $build['#suffix'] = '
Goodbye!'; + $build['#suffix'] = '
Goodbye!'; } if (\Drupal::state()->get('block_test_view_alter_cache_key') !== NULL) { $build['#cache']['keys'][] = \Drupal::state()->get('block_test_view_alter_cache_key'); @@ -38,6 +38,6 @@ function block_test_block_view_test_cache_alter(array &$build, BlockPluginInterf * #pre_render callback for a block to alter its content. */ function block_test_pre_render_alter_content($build) { - $build['#prefix'] = 'Hiya!
'; + $build['#prefix'] = 'Hiya!
'; return $build; }