diff core/tests/Drupal/Tests/BrowserTestBase.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 7a779792577d
children c2387f117808
line wrap: on
line diff
--- a/core/tests/Drupal/Tests/BrowserTestBase.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php	Mon Apr 23 09:46:53 2018 +0100
@@ -345,12 +345,12 @@
    *   When provided default Mink driver class can't be instantiated.
    */
   protected function getDefaultDriverInstance() {
-    // Get default driver params from environment if availables.
-    if ($arg_json = getenv('MINK_DRIVER_ARGS')) {
+    // Get default driver params from environment if available.
+    if ($arg_json = $this->getMinkDriverArgs()) {
       $this->minkDefaultDriverArgs = json_decode($arg_json, TRUE);
     }
 
-    // Get and check default driver class from environment if availables.
+    // Get and check default driver class from environment if available.
     if ($minkDriverClass = getenv('MINK_DRIVER_CLASS')) {
       if (class_exists($minkDriverClass)) {
         $this->minkDefaultDriverClass = $minkDriverClass;
@@ -396,6 +396,18 @@
   }
 
   /**
+   * Get the Mink driver args from an environment variable, if it is set. Can
+   * be overridden in a derived class so it is possible to use a different
+   * value for a subset of tests, e.g. the JavaScript tests.
+   *
+   *  @return string|false
+   *   The JSON-encoded argument string. False if it is not set.
+   */
+  protected function getMinkDriverArgs() {
+    return getenv('MINK_DRIVER_ARGS');
+  }
+
+  /**
    * Provides a Guzzle middleware handler to log every response received.
    *
    * @return callable
@@ -485,6 +497,11 @@
     if ($disable_gc) {
       gc_enable();
     }
+
+    // Ensure that the test is not marked as risky because of no assertions. In
+    // PHPUnit 6 tests that only make assertions using $this->assertSession()
+    // can be marked as risky.
+    $this->addToAssertionCount(1);
   }
 
   /**