Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Guard against Flex presence #162

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion e2e/scenario0/vendor-bin/ns1/composer.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}
3 changes: 2 additions & 1 deletion e2e/scenario0/vendor-bin/ns2/composer.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}
3 changes: 2 additions & 1 deletion e2e/scenario1/vendor-bin/ns1/composer.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}
3 changes: 2 additions & 1 deletion e2e/scenario1/vendor-bin/ns2/composer.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}
3 changes: 2 additions & 1 deletion e2e/scenario11/vendor-bin/ns1/composer.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}
3 changes: 2 additions & 1 deletion e2e/scenario3/vendor-bin/ns1/composer.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}
3 changes: 2 additions & 1 deletion e2e/scenario8/vendor-bin/ns1/composer.json
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{}
{
}
23 changes: 18 additions & 5 deletions tests/EndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public function test_it_passes_the_e2e_test(string $scenarioPath): void

$actualPath = $scenarioPath.'/actual.txt';

if (file_exists($actualPath)) {
$originalContent = file_get_contents($scenarioPath.'/actual.txt');
} else {
$originalContent = 'File was not created.';
}
$originalContent = file_exists($actualPath)
? self::removeFlexMessages(
file_get_contents($scenarioPath . '/actual.txt')
)
: 'File was not created.';

$errorMessage = <<<TXT
Standard output:
Expand Down Expand Up @@ -187,4 +187,17 @@ private static function normalizeTrailingWhitespacesAndLineReturns(string $value
array_map('rtrim', explode(PHP_EOL, $value))
);
}

private static function removeFlexMessages(string $value): string
{
return preg_replace(
'/.+Symfony\\\\Flex.+\n/',
'',
str_replace(
"Symfony recipes are disabled: \"symfony/flex\" not found in the root composer.json\n\n",
'',
$value
)
);
}
}
Loading