Skip to content

Commit

Permalink
MDL-65204 phpunit: make testcases match their expected signature
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 authored and junpataleta committed Apr 3, 2019
1 parent be81130 commit 26218b7
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/phpunit/classes/advanced_testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ final public function __construct($name = null, array $data = array(), $dataName
* Runs the bare test sequence.
* @return void
*/
final public function runBare() {
final public function runBare(): void {
global $DB;

if (phpunit_util::$lastdbwrites != $DB->perf_get_writes()) {
Expand Down
4 changes: 2 additions & 2 deletions lib/phpunit/classes/autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class phpunit_autoloader implements \PHPUnit\Runner\TestSuiteLoader {
public function load($suiteClassName, $suiteClassFile = '') {
public function load(string $suiteClassName, string $suiteClassFile = ''): ReflectionClass {
global $CFG;

// Let's guess what user entered on the commandline...
Expand Down Expand Up @@ -197,7 +197,7 @@ protected function guess_class_from_path($file) {
return new ReflectionClass($classname);
}

public function reload(ReflectionClass $aClass) {
public function reload(ReflectionClass $aClass): ReflectionClass {
return $aClass;
}
}
2 changes: 1 addition & 1 deletion lib/phpunit/classes/basic_testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final public function __construct($name = null, array $data = array(), $dataName
* Runs the bare test sequence and log any changes in global state or database.
* @return void
*/
final public function runBare() {
final public function runBare(): void {
global $DB;

try {
Expand Down
2 changes: 1 addition & 1 deletion lib/phpunit/classes/database_driver_testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static function tearDownAfterClass() {
* Runs the bare test sequence.
* @return void
*/
public function runBare() {
public function runBare(): void {
try {
parent::runBare();

Expand Down
2 changes: 1 addition & 1 deletion lib/phpunit/classes/hint_resultprinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct() {
parent::__construct(null, false, self::COLOR_DEFAULT, false);
}

protected function printDefectTrace(PHPUnit\Framework\TestFailure $defect) {
protected function printDefectTrace(PHPUnit\Framework\TestFailure $defect): void {
global $CFG;

parent::printDefectTrace($defect);
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/completionlib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function setup_data() {
* @param boolean $canonicalize
* @param boolean $ignoreCase
*/
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE) {
public static function assertEquals($expected, $actual, string $message = '', float $delta = 0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void {
// Nasty cheating hack: prevent random failures on timemodified field.
if (is_object($expected) and is_object($actual)) {
if (property_exists($expected, 'timemodified') and property_exists($actual, 'timemodified')) {
Expand Down

0 comments on commit 26218b7

Please sign in to comment.