Skip to content

Commit

Permalink
* upd: phpunit 9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
deubert-it authored and cmuench committed Nov 29, 2021
1 parent cd4ea2c commit b89300b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
18 changes: 9 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="true"
bootstrap="tests/bootstrap.php"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
Expand All @@ -24,12 +24,12 @@
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
<exclude>
<file>src/bootstrap.php</file>
</exclude>
</whitelist>
</filter>
</include>
<exclude>
<file>src/bootstrap.php</file>
</exclude>
</coverage>
</phpunit>
22 changes: 12 additions & 10 deletions tests/N98/Magento/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}
16 changes: 8 additions & 8 deletions tests/N98/Util/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -126,7 +126,7 @@ public function testRecursiveDirectoryRemoveUnLinksSymLinks()
$this->fileSystem->recursiveRemoveDirectory($basePath);

$this->assertFileExists($symLinkedFile);
$this->assertFileNotExists($basePath);
$this->assertFileDoesNotExist($basePath);
}

public function testRecursiveRemove()
Expand All @@ -144,7 +144,7 @@ public function testRecursiveRemove()
touch($file2);

$this->fileSystem->recursiveRemoveDirectory($basePath);
$this->assertFileNotExists($basePath);
$this->assertFileDoesNotExist($basePath);
}

public function testRecursiveRemoveWithTrailingSlash()
Expand All @@ -162,7 +162,7 @@ public function testRecursiveRemoveWithTrailingSlash()
touch($file2);

$this->fileSystem->recursiveRemoveDirectory($basePath . "/");
$this->assertFileNotExists($basePath);
$this->assertFileDoesNotExist($basePath);
}

public function testFalseIsReturnedIfDirectoryNotExist()
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit b89300b

Please sign in to comment.