Skip to content

Commit

Permalink
Previous commit is still a syntax error on PHP 7.1, so it must be fix…
Browse files Browse the repository at this point in the history
…ed if we want to keep running tests on this version at all.
  • Loading branch information
greg-1-anderson committed Dec 13, 2024
1 parent b02e196 commit 7f71789
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/HelpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ function simplifyWhitespace($data)

function testHelp()
{
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
$this->markTestSkipped("Help tests don't work on very old versions of PHP; we expect help itself is still working, but support for these old versions is limited.");
}

$symfonyConsoleVersion = ltrim(InstalledVersions::getPrettyVersion('symfony/console'), 'v');
if (version_compare($symfonyConsoleVersion, '5.3.0', '>=')) {
$expectedAnsiMessage = 'Force (or disable --no-ansi) ANSI output';
Expand All @@ -124,8 +120,7 @@ function testHelp()
$expectedFieldMessage = "Select just one field, and force format to 'string'.";
}

$expectedXML = [
<<<EOT
$expectedXMLBeginning = <<<EOT
<?xml version="1.0" encoding="UTF-8"?>
<command id="example:table" name="example:table">
<usages>
Expand Down Expand Up @@ -170,8 +165,9 @@ function testHelp()
<option name="--help" shortcut="-h" accept_value="0" is_value_required="0" is_multiple="0">
<description>$htmlEncodedHelpMessage</description>\n
</option>
EOT,
<<<EOT
EOT;

$expectedXMLEnd = <<<EOT
<option name="--verbose" shortcut="-v" shortcuts="-v|-vv|-vvv" accept_value="0" is_value_required="0" is_multiple="0">
<description>Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug</description>
</option>
Expand All @@ -196,7 +192,9 @@ function testHelp()
<topic>docs-tables</topic>
</topics>
</command>
EOT];
EOT;

$expectedXML = [ $expectedXMLBeginning, $expectedXMLEnd ];

$this->assertRunCommandViaApplicationContains('my-help --format=xml example:table', $expectedXML);

Expand All @@ -205,8 +203,7 @@ function testHelp()
$encodedHelpMessage = json_encode(strip_tags($expectedHelpMessage));
$encodedFieldMessage = json_encode($expectedFieldMessage);

$expectedJSON = [
<<<EOT
$expectedJSONBeginning = <<<EOT
{
"id": "example:table",
"name": "example:table",
Expand Down Expand Up @@ -272,8 +269,9 @@ function testHelp()
"is_multiple": "0",
"description": $encodedHelpMessage
},
EOT,
<<<EOT
EOT;

$expectedJSONEnd = <<<EOT
"verbose": {
"name": "--verbose",
"shortcut": "-v",
Expand Down Expand Up @@ -324,7 +322,9 @@ function testHelp()
"docs-tables"
]
}
EOT];
EOT;
$expectedJSON = [ $expectedJSONBeginning, $expectedJSONEnd ];

$this->assertRunCommandViaApplicationContains('my-help --format=json example:table', $expectedJSON);
}
}

0 comments on commit 7f71789

Please sign in to comment.