diff --git a/core/modules/tour/tests/src/Functional/TourTestBase.php b/core/modules/tour/tests/src/Functional/TourTestBase.php
index 0ad9d9b..37ede37 100644
--- a/core/modules/tour/tests/src/Functional/TourTestBase.php
+++ b/core/modules/tour/tests/src/Functional/TourTestBase.php
@@ -10,8 +10,8 @@
abstract class TourTestBase extends BrowserTestBase {
/**
- * Assert function to determine if tips rendered to the page
- * have a corresponding page element.
+ * Assert function to determine if tips rendered to the page have a
+ * corresponding page element.
*
* @param array $tips
* A list of tips which provide either a "data-id" or "data-class".
@@ -20,16 +20,16 @@
* // Basic example.
* $this->assertTourTips();
*
- * // Advanced example. The following would be used for multipage or
- * // targeting a specific subset of tips.
- * $tips = array();
- * $tips[] = array('data-id' => 'foo');
- * $tips[] = array('data-id' => 'bar');
- * $tips[] = array('data-class' => 'baz');
+ * // Advanced example. The following would be used for multipage or targeting
+ * // a specific subset of tips.
+ * $tips = [];
+ * $tips[] = ['data-id' => 'foo'];
+ * $tips[] = ['data-id' => 'bar'];
+ * $tips[] = ['data-class' => 'baz'];
* $this->assertTourTips($tips);
* @endcode
*/
- public function assertTourTips($tips = array()) {
+ public function assertTourTips($tips = []) {
// Get the rendered tips and their data-id and data-class attributes.
if (empty($tips)) {
// Tips are rendered as
elements inside .
@@ -53,11 +53,11 @@ public function assertTourTips($tips = array()) {
foreach ($tips as $tip) {
if (!empty($tip['data-id'])) {
$elements = \PHPUnit_Util_XML::cssSelect('#' . $tip['data-id'], TRUE, $this->getTextContent(), TRUE);
- $this->assertTrue(!empty($elements) && count($elements) === 1, format_string('Found corresponding page element for tour tip with id #%data-id', array('%data-id' => $tip['data-id'])));
+ $this->assertCount(1, $elements);
}
elseif (!empty($tip['data-class'])) {
$elements = \PHPUnit_Util_XML::cssSelect('.' . $tip['data-class'], TRUE, $this->getTextContent(), TRUE);
- $this->assertFalse(empty($elements), format_string('Found corresponding page element for tour tip with class .%data-class', array('%data-class' => $tip['data-class'])));
+ $this->assertNotEmpty($elements);
}
else {
// It's a modal.
@@ -65,7 +65,7 @@ public function assertTourTips($tips = array()) {
}
$total++;
}
- $this->pass(format_string('Total %total Tips tested of which %modals modal(s).', array('%total' => $total, '%modals' => $modals)));
+ $this->assertTrue(TRUE, "Total $total Tips tested of which $modals modal(s).");
}
}
diff --git a/core/modules/tour/tests/src/Functional/TourTestBasic.php b/core/modules/tour/tests/src/Functional/TourTestBasic.php
index ec92987..2ed93a7 100644
--- a/core/modules/tour/tests/src/Functional/TourTestBasic.php
+++ b/core/modules/tour/tests/src/Functional/TourTestBasic.php
@@ -14,12 +14,12 @@
* An array of tip attributes, keyed by path.
*
* @code
- * protected $tips = array(
- * '/foo/bar' => array(
- * array('data-id' => 'foo'),
- * array('data-class' => 'bar'),
- * ),
- * );
+ * protected $tips = [
+ * '/foo/bar' => [
+ * ['data-id' => 'foo'],
+ * ['data-class' => 'bar'],
+ * ],
+ * ];
* @endcode
*/
protected $tips = array();
@@ -37,14 +37,14 @@
* @var array
* A list of permissions.
*/
- protected $permissions = array('access tour');
+ protected $permissions = ['access tour'];
protected function setUp() {
parent::setUp();
- // Make sure we are using distinct default and administrative themes for
- // the duration of these tests.
- $this->container->get('theme_handler')->install(array('bartik', 'seven'));
+ // Make sure we are using distinct default and administrative themes for the
+ // duration of these tests.
+ $this->container->get('theme_handler')->install(['bartik', 'seven']);
$this->config('system.theme')
->set('default', 'bartik')
->set('admin', 'seven')
diff --git a/core/tests/Drupal/FunctionalTests/PageCacheTagsTestBase.php b/core/tests/Drupal/FunctionalTests/PageCacheTagsTestBase.php
index 4e1282f..f783594 100644
--- a/core/tests/Drupal/FunctionalTests/PageCacheTagsTestBase.php
+++ b/core/tests/Drupal/FunctionalTests/PageCacheTagsTestBase.php
@@ -4,7 +4,6 @@
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
-use Drupal\Component\Utility\SafeMarkup;
/**
* Provides helper methods for page cache tags tests.
@@ -18,9 +17,9 @@ protected function setUp() {
parent::setUp();
// Enable page caching.
- $config = $this->config('system.performance');
- $config->set('cache.page.max_age', 3600);
- $config->save();
+ $this->config('system.performance')
+ ->set('cache.page.max_age', 3600)
+ ->save();
}
/**
@@ -30,25 +29,25 @@ protected function setUp() {
* The page for this URL will be loaded.
* @param string $hit_or_miss
* 'HIT' if a page cache hit is expected, 'MISS' otherwise.
- *
- * @param array|FALSE $tags
- * When expecting a page cache hit, you may optionally specify an array of
- * expected cache tags. While FALSE, the cache tags will not be verified.
+ * @param array|false $tags
+ * (optional) When expecting a page cache hit, you may optionally specify an
+ * array of expected cache tags. While FALSE, the cache tags will not be
+ * verified. Defaults to FALSE.
*/
protected function verifyPageCache(Url $url, $hit_or_miss, $tags = FALSE) {
$this->drupalGet($url);
- $message = SafeMarkup::format('Page cache @hit_or_miss for %path.', array('@hit_or_miss' => $hit_or_miss, '%path' => $url->toString()));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), $hit_or_miss, $message);
+ $message = "Page cache $hit_or_miss for {$url->toString()}.";
+ self::assertEquals($this->drupalGetHeader('X-Drupal-Cache'), $hit_or_miss, $message);
if ($hit_or_miss === 'HIT' && is_array($tags)) {
$absolute_url = $url->setAbsolute()->toString();
- $cid_parts = array($absolute_url, 'html');
+ $cid_parts = [$absolute_url, 'html'];
$cid = implode(':', $cid_parts);
- $cache_entry = \Drupal::cache('render')->get($cid);
+ $cache_entry = $this->container->get('cache.render')->get($cid);
sort($cache_entry->tags);
$tags = array_unique($tags);
sort($tags);
- $this->assertIdentical($cache_entry->tags, $tags);
+ self::assertSame($cache_entry->tags, $tags);
}
}