X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FBrowserTestBase.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FBrowserTestBase.php;h=3260f6ea016b228f979b06120d886ce15e8d7465;hp=240dc1bef3cf2a0a2f5936e418dfccb192e7eeb4;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/tests/Drupal/Tests/BrowserTestBase.php b/web/core/tests/Drupal/Tests/BrowserTestBase.php index 240dc1bef..3260f6ea0 100644 --- a/web/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/web/core/tests/Drupal/Tests/BrowserTestBase.php @@ -345,12 +345,12 @@ abstract class BrowserTestBase extends TestCase { * 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; @@ -395,6 +395,18 @@ abstract class BrowserTestBase extends TestCase { } } + /** + * 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. * @@ -485,6 +497,11 @@ abstract class BrowserTestBase extends TestCase { 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); } /**