Mercurial > hg > isophonics-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
343 * | 343 * |
344 * @throws \InvalidArgumentException | 344 * @throws \InvalidArgumentException |
345 * When provided default Mink driver class can't be instantiated. | 345 * When provided default Mink driver class can't be instantiated. |
346 */ | 346 */ |
347 protected function getDefaultDriverInstance() { | 347 protected function getDefaultDriverInstance() { |
348 // Get default driver params from environment if availables. | 348 // Get default driver params from environment if available. |
349 if ($arg_json = getenv('MINK_DRIVER_ARGS')) { | 349 if ($arg_json = $this->getMinkDriverArgs()) { |
350 $this->minkDefaultDriverArgs = json_decode($arg_json, TRUE); | 350 $this->minkDefaultDriverArgs = json_decode($arg_json, TRUE); |
351 } | 351 } |
352 | 352 |
353 // Get and check default driver class from environment if availables. | 353 // Get and check default driver class from environment if available. |
354 if ($minkDriverClass = getenv('MINK_DRIVER_CLASS')) { | 354 if ($minkDriverClass = getenv('MINK_DRIVER_CLASS')) { |
355 if (class_exists($minkDriverClass)) { | 355 if (class_exists($minkDriverClass)) { |
356 $this->minkDefaultDriverClass = $minkDriverClass; | 356 $this->minkDefaultDriverClass = $minkDriverClass; |
357 } | 357 } |
358 else { | 358 else { |
391 $this->htmlOutputTestId = str_replace('sites/simpletest/', '', $this->siteDirectory); | 391 $this->htmlOutputTestId = str_replace('sites/simpletest/', '', $this->siteDirectory); |
392 if (is_file($this->htmlOutputCounterStorage)) { | 392 if (is_file($this->htmlOutputCounterStorage)) { |
393 $this->htmlOutputCounter = max(1, (int) file_get_contents($this->htmlOutputCounterStorage)) + 1; | 393 $this->htmlOutputCounter = max(1, (int) file_get_contents($this->htmlOutputCounterStorage)) + 1; |
394 } | 394 } |
395 } | 395 } |
396 } | |
397 | |
398 /** | |
399 * Get the Mink driver args from an environment variable, if it is set. Can | |
400 * be overridden in a derived class so it is possible to use a different | |
401 * value for a subset of tests, e.g. the JavaScript tests. | |
402 * | |
403 * @return string|false | |
404 * The JSON-encoded argument string. False if it is not set. | |
405 */ | |
406 protected function getMinkDriverArgs() { | |
407 return getenv('MINK_DRIVER_ARGS'); | |
396 } | 408 } |
397 | 409 |
398 /** | 410 /** |
399 * Provides a Guzzle middleware handler to log every response received. | 411 * Provides a Guzzle middleware handler to log every response received. |
400 * | 412 * |
483 // If garbage collection was disabled prior to rebuilding container, | 495 // If garbage collection was disabled prior to rebuilding container, |
484 // re-enable it. | 496 // re-enable it. |
485 if ($disable_gc) { | 497 if ($disable_gc) { |
486 gc_enable(); | 498 gc_enable(); |
487 } | 499 } |
500 | |
501 // Ensure that the test is not marked as risky because of no assertions. In | |
502 // PHPUnit 6 tests that only make assertions using $this->assertSession() | |
503 // can be marked as risky. | |
504 $this->addToAssertionCount(1); | |
488 } | 505 } |
489 | 506 |
490 /** | 507 /** |
491 * Ensures test files are deletable within file_unmanaged_delete_recursive(). | 508 * Ensures test files are deletable within file_unmanaged_delete_recursive(). |
492 * | 509 * |