From b89300b586f2f79ea6d5494a4f5826eb6d0a2c40 Mon Sep 17 00:00:00 2001 From: Karsten Deubert Date: Sun, 28 Nov 2021 11:12:16 +0100 Subject: [PATCH] * upd: phpunit 9 compatibility --- phpunit.xml.dist | 18 +++++++++--------- tests/N98/Magento/ApplicationTest.php | 22 ++++++++++++---------- tests/N98/Util/FilesystemTest.php | 16 ++++++++-------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dac416727..123d133f8 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,11 @@ + ./tests - - + + ./src - - src/bootstrap.php - - - + + + src/bootstrap.php + + diff --git a/tests/N98/Magento/ApplicationTest.php b/tests/N98/Magento/ApplicationTest.php index fe450cbb8..d90e3fdeb 100644 --- a/tests/N98/Magento/ApplicationTest.php +++ b/tests/N98/Magento/ApplicationTest.php @@ -195,16 +195,18 @@ public function testComposer() $config = $application->getConfig(); - // Check for loaded project data - $this->assertArraySubset( - [ - 'foo' => [ - 'bar' => [ - 'magerun' => 'rockz!' - ] + $expected = [ + 'foo' => [ + 'bar' => [ + 'magerun' => 'rockz!' ] - ], - $config - ); + ] + ]; + + // replaced deprecated assertArraySubset with a less elegant (but simpler) approach + foreach ($expected as $expectedKey => $expectedValue) { + $this->assertArrayHasKey($expectedKey, $config); + $this->assertEquals($expectedValue, $config[$expectedKey]); + } } } diff --git a/tests/N98/Util/FilesystemTest.php b/tests/N98/Util/FilesystemTest.php index 1a51c9b6a..4646b208e 100644 --- a/tests/N98/Util/FilesystemTest.php +++ b/tests/N98/Util/FilesystemTest.php @@ -60,8 +60,8 @@ public function testRecursiveCopy() rmdir($dest . "/folder2"); rmdir($dest); - $this->assertFileNotExists($dest . "/folder1/file1.txt"); - $this->assertFileNotExists($dest); + $this->assertFileDoesNotExist($dest . "/folder1/file1.txt"); + $this->assertFileDoesNotExist($dest); is_dir($tmp . '/a') || mkdir($tmp . '/a'); touch($tmp . '/file1.txt'); @@ -89,7 +89,7 @@ public function testRecursiveCopyWithBlacklist() $this->fileSystem->recursiveCopy($basePath, $dest, ['ignore.me']); $this->assertFileExists($dest . "/folder1/file1.txt"); $this->assertFileExists($dest . "/folder2/file2.txt"); - $this->assertFileNotExists($dest . "/folder1/ignore.me"); + $this->assertFileDoesNotExist($dest . "/folder1/ignore.me"); //cleanup unlink($file1); @@ -126,7 +126,7 @@ public function testRecursiveDirectoryRemoveUnLinksSymLinks() $this->fileSystem->recursiveRemoveDirectory($basePath); $this->assertFileExists($symLinkedFile); - $this->assertFileNotExists($basePath); + $this->assertFileDoesNotExist($basePath); } public function testRecursiveRemove() @@ -144,7 +144,7 @@ public function testRecursiveRemove() touch($file2); $this->fileSystem->recursiveRemoveDirectory($basePath); - $this->assertFileNotExists($basePath); + $this->assertFileDoesNotExist($basePath); } public function testRecursiveRemoveWithTrailingSlash() @@ -162,7 +162,7 @@ public function testRecursiveRemoveWithTrailingSlash() touch($file2); $this->fileSystem->recursiveRemoveDirectory($basePath . "/"); - $this->assertFileNotExists($basePath); + $this->assertFileDoesNotExist($basePath); } public function testFalseIsReturnedIfDirectoryNotExist() @@ -194,8 +194,8 @@ public function testParentIsNotRemovedIfEmptyIsTrue() $this->fileSystem->recursiveRemoveDirectory($basePath, true); $this->assertFileExists($basePath); - $this->assertFileNotExists($folder1); - $this->assertFileNotExists($folder2); + $this->assertFileDoesNotExist($folder1); + $this->assertFileDoesNotExist($folder2); } /**