Skip to content

Commit 024b731

Browse files
committed
Fix test cases broken by updating to PHPUnit 9.x and Symfony 5+
- PHPUnit 9 removed the assertArraySubset function, which now exists as a separate pacakge. Slightly bizzare move, but at least there's an easy fix. - Fix test cases broken by the introduction of DumpCompletionCommand in Symfony 5's default command list, which adds 'completion' to the list of command results: https://github.com/symfony/console/blob/6.1/Command/DumpCompletionCommand.php - Removed long deprecated option `syntaxCheck` from the phpunit.xml file, which now causes an error. - Ignored new result file created by running test cases under PHPUnit 9
1 parent 42df12f commit 024b731

File tree

7 files changed

+12
-4
lines changed

7 files changed

+12
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ vendor
33
/build/
44
phpunit.xml
55
/composer.lock
6+
/.phpunit.result.cache

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"symfony/console": "~6.0"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "^9.5"
16+
"phpunit/phpunit": "^9.5",
17+
"dms/phpunit-arraysubset-asserts": "^0.4.0"
1718
},
1819
"autoload": {
1920
"psr-4": {

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
1211
bootstrap="tests/bootstrap.php"
1312
>
1413
<testsuites>

tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Stecman\Component\Symfony\Console\BashCompletion\Tests\Common;
44

5+
use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
56
use PHPUnit\Framework\TestCase;
67
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
78
use Stecman\Component\Symfony\Console\BashCompletion\CompletionHandler;
@@ -12,6 +13,8 @@
1213
*/
1314
abstract class CompletionHandlerTestCase extends TestCase
1415
{
16+
use ArraySubsetAsserts;
17+
1518
/**
1619
* @var Application
1720
*/

tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionCommandTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class CompletionCommandTest extends TestCase
1616
*/
1717
public function testConflictingGlobalOptions()
1818
{
19+
$this->expectNotToPerformAssertions();
20+
1921
$app = new Application('Base application');
2022

2123
// Conflicting option shortcut

tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function testCompleteCommandNames()
2121
{
2222
$handler = $this->createHandler('app ');
2323
$this->assertEquals(
24-
array('help', 'list', 'completion-aware', 'wave', 'walk:north'),
24+
array('help', 'list', 'completion', 'completion-aware', 'wave', 'walk:north'),
2525
$this->getTerms($handler->runCompletion())
2626
);
2727
}
@@ -176,7 +176,7 @@ public function testHelpCommandCompletion()
176176
{
177177
$handler = $this->createHandler('app help ');
178178
$this->assertEquals(
179-
array('help', 'list', 'completion-aware', 'wave', 'walk:north'),
179+
array('help', 'list', 'completion', 'completion-aware', 'wave', 'walk:north'),
180180
$this->getTerms($handler->runCompletion())
181181
);
182182
}

tests/Stecman/Component/Symfony/Console/BashCompletion/HookFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public function generateHookDataProvider()
5656

5757
public function testForMissingSemiColons()
5858
{
59+
$this->expectNotToPerformAssertions();
60+
5961
$class = new \ReflectionClass('Stecman\Component\Symfony\Console\BashCompletion\HookFactory');
6062
$properties = $class->getStaticProperties();
6163
$hooks = $properties['hooks'];

0 commit comments

Comments
 (0)