From df5a4046c0ab1663e1f3ae6ff71e9f27c96a30af Mon Sep 17 00:00:00 2001 From: Aleksandr Novikov Date: Sun, 3 May 2020 16:32:09 +0300 Subject: [PATCH] #4049 Add tests for assertFileEqualsCanonicalizing --- tests/_files/bar.txt | 1 + tests/_files/foo.txt | 1 + tests/unit/Framework/AssertTest.php | 11 +++++++++++ 3 files changed, 13 insertions(+) create mode 100644 tests/_files/bar.txt create mode 100644 tests/_files/foo.txt diff --git a/tests/_files/bar.txt b/tests/_files/bar.txt new file mode 100644 index 00000000000..5acdde49d10 --- /dev/null +++ b/tests/_files/bar.txt @@ -0,0 +1 @@ +Test for compare file diff --git a/tests/_files/foo.txt b/tests/_files/foo.txt new file mode 100644 index 00000000000..0fdeb064721 --- /dev/null +++ b/tests/_files/foo.txt @@ -0,0 +1 @@ +Test file for compare diff --git a/tests/unit/Framework/AssertTest.php b/tests/unit/Framework/AssertTest.php index e44984edbd4..81fd17f31c9 100644 --- a/tests/unit/Framework/AssertTest.php +++ b/tests/unit/Framework/AssertTest.php @@ -1570,6 +1570,17 @@ public function testAssertStringNotMatchesFormatFile(): void $this->assertStringNotMatchesFormatFile(TEST_FILES_PATH . 'expectedFileFormat.txt', "FOO\n"); } + public function testAssertFileEqualsCanonicalizing(): void + { + $this->assertFileEqualsCanonicalizing(TEST_FILES_PATH . 'foo.txt', TEST_FILES_PATH . 'foo.txt'); + + $this->assertFileEqualsCanonicalizing(TEST_FILES_PATH . 'foo.txt', TEST_FILES_PATH . 'bar.txt'); + + $this->expectException(AssertionFailedError::class); + + $this->assertFileEqualsCanonicalizing(TEST_FILES_PATH . 'foo.txt', TEST_FILES_PATH . 'foo.xml'); + } + public function testStringsCanBeComparedForEqualityIgnoringCase(): void { $this->assertEqualsIgnoringCase('a', 'A');