Merge pull request #3696 from NoelDeMartin/MOBILE-4270

MOBILE-4270 behat: Remove performance transforms
main
Dani Palou 2023-05-31 08:05:05 +02:00 committed by GitHub
commit ea44d5cc63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -54,8 +54,10 @@ class behat_performance extends behat_base {
*
* @Then /^"([^"]+)" should have taken (less than|more than|exactly) (\d+(?:\.\d+)? (?:seconds|milliseconds))$/
*/
public function timing_should_have_taken(string $measure, Closure $comparison, float $expectedtime) {
public function timing_should_have_taken(string $measure, string $comparison, string $expectedtime) {
$measuretiming = $this->get_performance_measure($measure);
$comparison = $this->parse_comparison($comparison);
$expectedtime = $this->parse_time($expectedtime);
if (!call_user_func($comparison, $measuretiming->duration, $expectedtime)) {
throw new ExpectationException(
@ -70,11 +72,10 @@ class behat_performance extends behat_base {
/**
* Parse time.
*
* @Transform /^\d+(?:\.\d+)? (?:seconds|milliseconds)$/
* @param string $text Time string.
* @return float
*/
public function parse_time(string $text): float {
private function parse_time(string $text): float {
$spaceindex = strpos($text, ' ');
$value = floatval(substr($text, 0, $spaceindex));
@ -88,11 +89,10 @@ class behat_performance extends behat_base {
/**
* Parse a comparison function.
*
* @Transform /^less than|more than|exactly$/
* @param string $text Comparison string.
* @return Closure
*/
public function parse_comparison(string $text): Closure {
private function parse_comparison(string $text): Closure {
switch ($text) {
case 'less than':
return function ($a, $b) {