From c2211946f7dd4e59faf6d759e9a78bf140699c3e Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Tue, 17 Sep 2019 16:03:28 +0200 Subject: tests: Replace PHPUnit's loose assertEquals(null) with assertNull() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit assertEquals( null, … ) still succeeds when the actual value is 0, false, an empty string, even an empty array. All these should be reported as a failure, I would argue. Note this patch previously also touched assertSame( null ). I reverted these. The only benefit would have been consistency within this codebase, but there is no strict reason to prefer one over the other. assertNull() and assertSame( null ) are functionally identical. Change-Id: I92102e833a8bc6af90b9516826abf111e2b79aac --- tests/phpunit/unit/includes/diff/DiffOpTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/phpunit/unit/includes/diff/DiffOpTest.php') diff --git a/tests/phpunit/unit/includes/diff/DiffOpTest.php b/tests/phpunit/unit/includes/diff/DiffOpTest.php index 17487acbca22..6566e142be42 100644 --- a/tests/phpunit/unit/includes/diff/DiffOpTest.php +++ b/tests/phpunit/unit/includes/diff/DiffOpTest.php @@ -42,7 +42,7 @@ class DiffOpTest extends \MediaWikiUnitTestCase { $this->assertEquals( 'foo', $obj->getClosing( 0 ) ); $this->assertEquals( 'bar', $obj->getClosing( 1 ) ); $this->assertEquals( 'baz', $obj->getClosing( 2 ) ); - $this->assertEquals( null, $obj->getClosing( 3 ) ); + $this->assertNull( $obj->getClosing( 3 ) ); } /** -- cgit v1.2.3