stronk7

Untitled

Jan 28th, 2021
538
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. commit 8f5758c583b923c6ad5a053a9e11513c16f33b45 (HEAD -> MOODLE_39_STABLE)
  2. Author: Eloy Lafuente (stronk7) <stronk7@moodle.org>
  3. Date:   Thu Jan 28 12:12:48 2021 +0100
  4.  
  5.     MDL-66979 behat: Goutte driver doesn't implement setTimeouts()
  6.    
  7.     Also, change:
  8.    
  9.     get_real_timeout(30000)
  10.    
  11.     to:
  12.    
  13.     get_real_timeout(30) * 1000
  14.    
  15.     because the original functions are defined to use seconds, and
  16.     having the 1000 around will help us detecting cases in the case
  17.     of a hypothetical review of uses.
  18.  
  19. diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php
  20. index d2f0bea4c75..36f6a7eb353 100644
  21. --- a/lib/tests/behat/behat_hooks.php
  22. +++ b/lib/tests/behat/behat_hooks.php
  23. @@ -303,11 +303,13 @@ EOF;
  24.      protected function start_session(): void {
  25.          $this->getSession()->start();
  26.  
  27. -        $this->getSession()->getDriver()->setTimeouts([
  28. -            // The standard script timeout is 30000 ms.
  29. -            // Use `get_real_timeout` to multiply this by the behat increased timeout factor.
  30. -            'script' => self::get_real_timeout(30000),
  31. -        ]);
  32. +        if ($this->running_javascript()) { // Goutte driver doesn't implement this.
  33. +            $this->getSession()->getDriver()->setTimeouts([
  34. +                // The standard script timeout is 30000 ms. (aka, 30 seconds).
  35. +                // Use `get_real_timeout` to multiply this by the behat increased timeout factor.
  36. +                'script' => self::get_real_timeout(30) * 1000,
  37. +            ]);
  38. +        }
  39.      }
  40.  
  41.      /**
RAW Paste Data