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..0cf2586 100644
--- a/core/modules/block/lib/Drupal/block/BlockFormController.php
+++ b/core/modules/block/lib/Drupal/block/BlockFormController.php
@@ -290,8 +290,8 @@ 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);
@@ -328,7 +328,7 @@ public function submit(array $form, array &$form_state) {
'theme' => $form_state['values']['theme'],
),
'options' => array(
- 'query' => array('block-placement' => drupal_html_class($this->entity->id()))
+ 'query' => array('block-placement' => drupal_html_class($this->entity->id())),
),
);
}
diff --git a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php
index 4f6bdc2..568ffed 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..1f264a0 100644
--- a/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php
+++ b/core/modules/block/tests/Drupal/block/Tests/BlockConfigEntityUnitTest.php
@@ -84,6 +84,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..a02e17f 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
@@ -37,6 +37,9 @@ class BlockTest extends UnitTestCase {
*/
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;
}