MDL-81308 core: Use a helper for consecutive invocation counts

This commit is contained in:
Andrew Nicols
2024-10-23 14:14:33 +08:00
committed by Jun Pataleta
parent 8dcad87631
commit c745b3fb80
14 changed files with 41 additions and 28 deletions
+13
View File
@@ -1,4 +1,5 @@
<?php
use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -594,5 +595,17 @@ abstract class base_testcase extends PHPUnit\Framework\TestCase {
return str_replace(' ', ' ', $result);
}
/**
* Helper to get the count of invocation.
*
* This is required because the method to use changed names in PHPUnit 10.0 in a breaking change.
*
* @param \PHPUnit\Framework\MockObject\Rule\InvocationOrder $counter
* @return int
*/
protected static function getInvocationCount(InvocationOrder $counter): int {
return $counter->getInvocationCount();
}
// phpcs:enable
}