',
+ )
+ );
$form['visibility']['path']['visibility'] = array(
'#type' => 'radios',
@@ -291,7 +297,7 @@ public function validate(array $form, array &$form_state) {
// 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']
+ 'values' => &$form_state['values']['settings'],
);
// Call the plugin validate handler.
$this->entity->getPlugin()->validateConfigurationForm($form, $settings);
@@ -328,7 +334,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/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php
index 65db261..ddf2b31 100644
--- a/core/modules/block/lib/Drupal/block/BlockListController.php
+++ b/core/modules/block/lib/Drupal/block/BlockListController.php
@@ -336,9 +336,9 @@ public function buildForm(array $form, array &$form_state) {
// Sort the plugins first by category, then by label.
$plugins = $this->blockManager->getDefinitions();
uasort($plugins, function ($a, $b) {
- if ($a['category'] != $b['category']) {
- return strnatcasecmp($a['category'], $b['category']);
- }
+ if ($a['category'] != $b['category']) {
+ return strnatcasecmp($a['category'], $b['category']);
+ }
return strnatcasecmp($a['admin_label'], $b['admin_label']);
});
foreach ($plugins as $plugin_id => $plugin_definition) {
diff --git a/core/modules/block/lib/Drupal/block/BlockPluginBag.php b/core/modules/block/lib/Drupal/block/BlockPluginBag.php
index d1f4fbb..f6ec078 100644
--- a/core/modules/block/lib/Drupal/block/BlockPluginBag.php
+++ b/core/modules/block/lib/Drupal/block/BlockPluginBag.php
@@ -44,8 +44,8 @@ public function __construct(PluginManagerInterface $manager, $instance_id, array
/**
* {@inheritdoc}
- *
* @return \Drupal\block\BlockPluginInterface
+ * Return 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 047efd9..25e192b 100644
--- a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php
+++ b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php
@@ -58,7 +58,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
*/
@@ -75,7 +76,7 @@ public function setConfigurationValue($key, $value);
* @param array $form_state
* An array containing the current state of the configuration form.
*
- * @return array $form
+ * @return array
* The renderable form array 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 a076dc9..263d7e1 100644
--- a/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
+++ b/core/modules/block/lib/Drupal/block/BlockViewBuilder.php
@@ -98,6 +98,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
/**
* {@inheritdoc}
*/
- public function resetCache(array $ids = NULL) { }
+ public function resetCache(array $ids = NULL) {
+ }
}
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 cb49cac..b08aab5 100644
--- a/core/modules/block/lib/Drupal/block/Entity/Block.php
+++ b/core/modules/block/lib/Drupal/block/Entity/Block.php
@@ -113,7 +113,7 @@ public function getPluginBag() {
}
/**
- * Overrides \Drupal\Core\Entity\Entity::label();
+ * Overrides \Drupal\Core\Entity\Entity::label();.
*/
public function label() {
$settings = $this->get('settings');
@@ -127,7 +127,7 @@ public function label() {
}
/**
- * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
+ * Overrides \..\Core\Config\Entity\ConfigEntityBase::getExportProperties();.
*/
public function getExportProperties() {
$properties = parent::getExportProperties();
diff --git a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php
index 980a59f..8f3d549 100644
--- a/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php
+++ b/core/modules/block/lib/Drupal/block/Plugin/Type/BlockManager.php
@@ -48,7 +48,8 @@ class BlockManager extends DefaultPluginManager {
* The language manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke the alter hook with.
- * @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
+ * @param \Drupal\Core\StringTranslation\TranslationInterface
+ * $translation_manager
* The translation manager.
*/
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler, TranslationInterface $translation_manager) {
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 657b635..92ba068 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;
+ /**
+ * The display block handler returns the structure necessary for a block.
+ */
protected function defineOptions() {
$options = parent::defineOptions();
@@ -161,8 +164,9 @@ protected function blockCachingModes() {
}
/**
- * Provide a single method to figure caching type, keeping a sensible default
- * for when it's unset.
+ * Provide a single method to figure caching type.
+ *
+ * keeping a sensible default for when it's unset.
*/
public function getCacheType() {
$cache_type = $this->getOption('block_caching');
@@ -187,6 +191,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(
@@ -196,6 +201,7 @@ public function buildOptionsForm(&$form, &$form_state) {
'#default_value' => $this->getOption('block_category'),
);
break;
+
case 'block_caching':
$form['#title'] .= t('Block caching type');
@@ -206,6 +212,7 @@ public function buildOptionsForm(&$form, &$form_state) {
'#default_value' => $this->getCacheType(),
);
break;
+
case 'block_hide_empty':
$form['#title'] .= t('Block empty settings');
@@ -216,6 +223,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()) {
@@ -225,6 +233,7 @@ public function buildOptionsForm(&$form, &$form_state) {
);
}
break;
+
case 'allow':
$form['#title'] .= t('Allow settings in the block configuration');
@@ -239,11 +248,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) {
@@ -271,9 +282,9 @@ public function submitOptionsForm(&$form, &$form_state) {
* @param array $form_state
* An array containing the current state of the configuration form.
*
- * @return array $form
+ * @return array
* The renderable form array representing the entire configuration form.
- *
+ *
* @see \Drupal\views\Plugin\Block\ViewsBlock::blockForm()
*/
public function blockForm(ViewsBlock $block, array &$form, array &$form_state) {
@@ -356,18 +367,17 @@ 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().
*/
public function remove() {
parent::remove();
-
$plugin_id = 'views_block:' . $this->view->storage->id() . '-' . $this->display['id'];
foreach (entity_load_multiple_by_properties('block', array('plugin' => $plugin_id)) as $block) {
$block->delete();
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockAdminThemeTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockAdminThemeTest.php
index d553440..02f90d6 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');
+ /**
+ * Tests the block system with admin themes.
+ */
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 7414efd..e2ce790 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;
+ /**
+ * Test block caching.
+ */
public static function getInfo() {
return array(
'name' => 'Block caching',
@@ -41,7 +44,10 @@ public static function getInfo() {
);
}
- function setUp() {
+ /**
+ * Test block caching.
+ */
+ public function setUp() {
parent::setUp();
// Create an admin user, log in and enable test blocks.
@@ -57,35 +63,31 @@ function setUp() {
$this->normal_user_alt->save();
// Enable our test block.
- $this->block = $this->drupalPlaceBlock('test_cache');
+ $this->block = $this->drupalPlaceBlock('test_cache');
}
/**
* Test DRUPAL_CACHE_PER_ROLE.
*/
- function testCachePerRole() {
+ public function testCachePerRole() {
$this->setCacheMode(DRUPAL_CACHE_PER_ROLE);
-
// 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->drupalGet('');
$this->assertText($current_content, 'Block content displays.');
-
// Change the content, but the cached copy should still be served.
$old_content = $current_content;
$current_content = $this->randomName();
\Drupal::state()->set('block_test.content', $current_content);
$this->drupalGet('');
$this->assertText($old_content, 'Block is served from the cache.');
-
// Clear the cache and verify that the stale data is no longer there.
Cache::invalidateTags(array('content' => TRUE));
$this->drupalGet('');
$this->assertNoText($old_content, 'Block cache clear removes stale cache data.');
$this->assertText($current_content, 'Fresh block content is displayed after clearing the cache.');
-
// Test whether the cached data is served for the correct users.
$old_content = $current_content;
$current_content = $this->randomName();
@@ -93,15 +95,12 @@ function testCachePerRole() {
$this->drupalLogout();
$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->drupalGet('');
$this->assertText($old_content, 'User with the same roles sees per-role cached content.');
-
$this->drupalLogin($this->admin_user);
$this->drupalGet('');
$this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.');
-
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
$this->assertText($old_content, 'Block is served from the per-role cache.');
@@ -110,7 +109,7 @@ function testCachePerRole() {
/**
* Test DRUPAL_CACHE_GLOBAL.
*/
- function testCacheGlobal() {
+ public function testCacheGlobal() {
$this->setCacheMode(DRUPAL_CACHE_GLOBAL);
$current_content = $this->randomName();
\Drupal::state()->set('block_test.content', $current_content);
@@ -130,7 +129,7 @@ function testCacheGlobal() {
/**
* Test DRUPAL_NO_CACHE.
*/
- function testNoCache() {
+ public function testNoCache() {
$this->setCacheMode(DRUPAL_NO_CACHE);
$current_content = $this->randomName();
\Drupal::state()->set('block_test.content', $current_content);
@@ -149,7 +148,7 @@ function testNoCache() {
/**
* Test DRUPAL_CACHE_PER_USER.
*/
- function testCachePerUser() {
+ public function testCachePerUser() {
$this->setCacheMode(DRUPAL_CACHE_PER_USER);
$current_content = $this->randomName();
\Drupal::state()->set('block_test.content', $current_content);
@@ -177,7 +176,7 @@ function testCachePerUser() {
/**
* Test DRUPAL_CACHE_PER_PAGE.
*/
- function testCachePerPage() {
+ public function testCachePerPage() {
$this->setCacheMode(DRUPAL_CACHE_PER_PAGE);
$current_content = $this->randomName();
\Drupal::state()->set('block_test.content', $current_content);
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php
index 3fa85d6..a43a957 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');
+ /**
+ * Tests that hidden regions do not inherit blocks when a theme is enabled.
+ */
public static function getInfo() {
return array(
'name' => 'Blocks not in hidden region',
@@ -34,7 +37,10 @@ public static function getInfo() {
);
}
- function setUp() {
+ /**
+ * Tests that hidden regions do not inherit blocks when a theme is enabled.
+ */
+ public 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..e2de8a9 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');
+ /**
+ * Functional tests for the hook_entity_operations_alter().
+ */
public static function getInfo() {
return array(
'name' => 'Block operations hook',
@@ -30,6 +33,9 @@ public static function getInfo() {
);
}
+ /**
+ * Functional tests for the hook_entity_operations_alter().
+ */
public function setUp() {
parent::setUp();
@@ -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..bd3ad10 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');
+ /**
+ * Modules to enable.
+ */
public static function getInfo() {
return array(
'name' => 'Block HTML',
@@ -29,7 +32,10 @@ public static function getInfo() {
);
}
- function setUp() {
+ /**
+ * Modules to enable.
+ */
+ public 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 a694b4e..add9d80 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');
+ /**
+ * Test BlockInterface methods to ensure no external dependencies exist.
+ */
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..875b3c4 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');
+ /**
+ * Modules to enable.
+ */
public static function getInfo() {
return array(
'name' => 'Blocks in invalid regions',
@@ -29,7 +32,10 @@ public static function getInfo() {
);
}
- function setUp() {
+ /**
+ * Modules to enable.
+ */
+ public function setUp() {
parent::setUp();
// Create an admin user.
$admin_user = $this->drupalCreateUser(array(
@@ -43,15 +49,21 @@ 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');
$block->save();
- $warning_message = t('The block %info was assigned to the invalid region %region and has been disabled.', array('%info' => $block->id(), '%region' => 'invalid_region'));
+ $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..18273b4 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();
+ /**
+ * List of langcodes.
+ */
public static function getInfo() {
return array(
'name' => 'Multilingual blocks',
@@ -38,6 +41,9 @@ public static function getInfo() {
);
}
+ /**
+ * List of langcodes.
+ */
public function setUp() {
parent::setUp();
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php
index 246e92c..01fd0ad 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');
+ /**
+ * Modules to enable.
+ */
public static function getInfo() {
return array(
'name' => 'Language block visibility',
@@ -34,11 +37,20 @@ public static function getInfo() {
);
}
- function setUp() {
+ /**
+ * Modules to enable.
+ */
+ public function setUp() {
parent::setUp();
// Create a new user, allow him to manage the blocks and the languages.
- $this->adminUser = $this->drupalCreateUser(array('administer blocks', 'administer languages', 'administer site configuration'));
+ $this->adminUser = $this->drupalCreateUser(
+ array(
+ 'administer blocks',
+ 'administer languages',
+ 'administer site configuration',
+ )
+ );
$this->drupalLogin($this->adminUser);
// Add predefined language.
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockPreprocessUnitTest.php
index e343019..e355f85 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');
+ /**
+ * Modules to enable.
+ */
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 0521aa9..c60f843 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');
+ /**
+ * Modules to enable.
+ */
public static function getInfo() {
return array(
'name' => 'Block Render Order',
@@ -29,7 +32,10 @@ public static function getInfo() {
);
}
- function setUp() {
+ /**
+ * Modules to enable.
+ */
+ public 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 36ed74a..556322c 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;
+ /**
+ * The block storage controller.
+ */
public static function getInfo() {
return array(
'name' => 'Block storage',
'description' => 'Tests the storage of blocks.',
- 'group' => 'Block'
+ 'group' => 'Block',
);
}
+ /**
+ * The block storage controller.
+ */
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..a307408 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');
+ /**
+ * Modules to enable.
+ */
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.
@@ -52,7 +55,14 @@ function testBlockThemeHookSuggestions() {
$variables['elements']['#derivative_plugin_id'] = $plugin->getDerivativeId();
$variables['elements']['content'] = array();
$suggestions = block_theme_suggestions_block($variables);
- $this->assertEqual($suggestions, array('block__system', 'block__system_menu_block', 'block__system_menu_block__admin', 'block__machinename'));
+ $this->assertEqual($suggestions,
+ array(
+ 'block__system',
+ 'block__system_menu_block',
+ 'block__system_menu_block__admin',
+ 'block__machinename',
+ )
+ );
}
}
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
index e7b99e1..b888a2e 100644
--- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
@@ -14,6 +14,9 @@
*/
class BlockTest extends BlockTestBase {
+ /**
+ * Provides testing for basic block module functionality.
+ */
public static function getInfo() {
return array(
'name' => 'Block functionality',
@@ -25,7 +28,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);
@@ -63,10 +66,11 @@ function testBlockVisibility() {
}
/**
- * Test block visibility when using "pages" restriction but leaving
- * "pages" textarea empty
+ * Test block visibility when using "pages" restriction.
+ *
+ * but leaving "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);
@@ -98,7 +102,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';
@@ -106,8 +110,15 @@ 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.
- $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'));
+ // 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.
$instance = entity_load('block', $block['id']);
@@ -129,10 +140,14 @@ function testBlock() {
// Confirm that the block instance title and markup are not displayed.
$this->drupalGet('node');
- $this->assertNoText(t($block['settings[label]']));
+ $this->assertNoText($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']))));
+ $xpath = $this->buildXPathQuery('//div[@id=:id]/*',
+ array(
+ ':id' => 'block-' . str_replace('_', '-', strtolower($block['id'])),
+ )
+ );
$this->assertNoFieldByXPath($xpath, FALSE, 'Block found in no regions.');
// Test deleting the block from the edit form.
@@ -183,7 +198,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);
@@ -226,7 +241,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();
@@ -234,11 +249,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($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(
@@ -251,7 +266,7 @@ function moveBlockToRegion(array $block, $region) {
/**
* Test _block_rehash().
*/
- function testBlockRehash() {
+ public function testBlockRehash() {
\Drupal::moduleHandler()->install(array('block_test'));
$this->assertTrue(\Drupal::moduleHandler()->moduleExists('block_test'), 'Test block module enabled.');
diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php b/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php
index 39aa634..5db07cc 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() {
+ /**
+ * A test user with administrative privileges.
+ */
+ public 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..9fad8e7 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');
+ /**
+ * Tests block XSS in title.
+ */
public static function getInfo() {
return array(
'name' => 'Block XSS Title',
@@ -29,6 +32,9 @@ public static function getInfo() {
);
}
+ /**
+ * Tests block XSS in title.
+ */
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..3bee35a 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;
+ /**
+ * The block entities used by this test.
+ */
public static function getInfo() {
return array(
'name' => 'Block UI',
@@ -50,7 +53,10 @@ public static function getInfo() {
);
}
- function setUp() {
+ /**
+ * The block entities used by this test.
+ */
+ public 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/NewDefaultThemeBlocksTest.php b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php
index c544960..96f8fdc 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');
+ /**
+ * Modules to enable.
+ */
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..3529e23 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');
+ /**
+ * Modules to enable.
+ */
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 8f2ddc0..a62ac51 100644
--- a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php
+++ b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php
@@ -25,7 +25,13 @@ class DisplayBlockTest extends ViewTestBase {
*
* @var array
*/
- public static $modules = array('node', 'block_test_views', 'test_page_test', 'contextual', 'views_ui');
+ public static $modules = array(
+ 'node',
+ 'block_test_views',
+ 'test_page_test',
+ 'contextual',
+ 'views_ui',
+ );
/**
* Views used by this test.
@@ -34,6 +40,9 @@ class DisplayBlockTest extends ViewTestBase {
*/
public static $testViews = array('test_view_block', 'test_view_block2');
+ /**
+ * Views used by this test.
+ */
public static function getInfo() {
return array(
'name' => ' Display: Block',
@@ -42,6 +51,9 @@ public static function getInfo() {
);
}
+ /**
+ * Views used by this test.
+ */
protected function setUp() {
parent::setUp();
@@ -212,7 +224,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
+ // 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.');
}
@@ -280,7 +293,13 @@ public function testBlockRendering() {
* Tests the contextual links on a Views block.
*/
public function testBlockContextualLinks() {
- $this->drupalLogin($this->drupalCreateUser(array('administer views', 'access contextual links', 'administer blocks')));
+ $this->drupalLogin($this->drupalCreateUser(
+ array(
+ 'administer views',
+ 'access contextual links',
+ 'administer blocks',
+ )
+ ));
$block = $this->drupalPlaceBlock('views_block:test_view_block-block_1');
$this->drupalGet('test-page');
diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php
index f0d04ec..4d6f61e 100644
--- a/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php
+++ b/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php
@@ -24,6 +24,9 @@
*/
class BlockBaseTest extends UnitTestCase {
+ /**
+ * Tests the base block plugin.
+ */
public static function getInfo() {
return array(
'name' => 'Base plugin',
@@ -35,7 +38,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')
@@ -53,7 +56,7 @@ public function testGetMachineNameSuggestion() {
$this->assertEquals('adminlabel', $block_base->getMachineNameSuggestion());
// Test with more unicodes.
- $definition = array('admin_label' =>'über åwesome', 'module' => 'block_test');
+ $definition = array('admin_label' => 'über åwesome', 'module' => '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/BlockFormControllerTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockFormControllerTest.php
index aa54731..729e313 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 {
+ /**
+ * Tests the block form controller.
+ */
public static function getInfo() {
return array(
'name' => 'Block form controller',
@@ -45,7 +48,14 @@ public function testGetUniqueMachineName() {
$query->expects($this->exactly(5))
->method('execute')
- ->will($this->returnValue(array('test', 'other_test', 'other_test_1', 'other_test_2')));
+ ->will($this->returnValue(
+ array(
+ 'test',
+ 'other_test',
+ 'other_test_1',
+ 'other_test_2',
+ )
+ ));
$block_storage = $this->getMock('Drupal\Core\Config\Entity\ConfigStorageControllerInterface');
$block_storage->expects($this->exactly(5))
@@ -64,7 +74,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
+ // 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']));
diff --git a/core/modules/block/tests/Drupal/block/Tests/CategoryAutocompleteTest.php b/core/modules/block/tests/Drupal/block/Tests/CategoryAutocompleteTest.php
index 5ff93f2..4e3cd5c 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;
+ /**
+ * Tests the block category autocomplete.
+ */
public static function getInfo() {
return array(
'name' => 'Block category autocomplete',
@@ -36,6 +39,9 @@ public static function getInfo() {
);
}
+ /**
+ * Tests the block category autocomplete.
+ */
public function setUp() {
$block_manager = $this->getMockBuilder('Drupal\block\Plugin\Type\BlockManager')
->disableOriginalConstructor()
@@ -70,7 +76,8 @@ public function testAutocompleteSuggestions($string, $suggestions) {
/**
* Data provider for testAutocompleteSuggestions().
*
- * @return array
+ * @return array
+ * $test_parameters.
*/
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..5324fb0 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 {
+ /**
+ * Tests existence of block local tasks.
+ */
public static function getInfo() {
return array(
'name' => 'Block local tasks test',
@@ -26,13 +29,16 @@ public static function getInfo() {
);
}
+ /**
+ * Tests existence of block local tasks.
+ */
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(
@@ -82,8 +88,18 @@ public function testBlockAdminDisplay($route, $expected) {
*/
public function providerTestBlockAdminDisplay() {
return array(
- array('block.admin_display', array(array('block.admin_display'), array('block.admin_display_theme:test_b', 'block.admin_display_theme:test_c'))),
- array('block.admin_display_theme', array(array('block.admin_display'), array('block.admin_display_theme:test_b', 'block.admin_display_theme:test_c'))),
+ array('block.admin_display',
+ array(
+ array('block.admin_display'),
+ array('block.admin_display_theme:test_b', 'block.admin_display_theme:test_c'),
+ ),
+ ),
+ array('block.admin_display_theme',
+ array(
+ array('block.admin_display'),
+ array('block.admin_display_theme:test_b', 'block.admin_display_theme:test_c'),
+ ),
+ ),
);
}
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..9478863 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
@@ -26,17 +26,22 @@ class BlockTest extends UnitTestCase {
/**
* 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;
+ /**
+ * Tests the block display plugin.
+ */
public static function getInfo() {
return array(
'name' => ' Views: Display Block',