8000 fix: hotfix behat tests · Setono/SyliusAnalyticsPlugin@b55a8f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit b55a8f1

Browse files
committed
fix: hotfix behat tests
symfony/symfony#41672 is blocking to update the behat test suite. This is why I decided to add this patch. It should not have any specific impact but for the dev environment. I will try to work on a fix on symfony side, but it should fix the problem for us.
1 parent a807e9f commit b55a8f1

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

bin/remove-dev-info-of-deps.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file patches an issue of Symfony by tricking the composer configuration: we just remove the information
5+
* saying that a dev dependency is a dev dependency. This has basically no impact on anything but avoid Symfony
6+
* to remove services we need to run the behat test suite.
7+
*
8+
* Context: https://github.com/symfony/symfony/issues/41672
9+
*/
10+
11+
$installedFile = 'vendor/composer/installed.php';
12+
if (!file_exists($installedFile)) {
13+
exit; // Nothing to do, the composer version used is probably old.
14+
}
15+
16+
$installed = require $installedFile;
17+
18+
// Only when dev dependencies are installed
19+
if ($installed['root']['dev']) {
20+
$installedFileContent = file_get_contents($installedFile);
21+
$installedFileContent = str_replace(' \'dev_requirement\' => true,', ' \'dev_requirement\' => false,', $installedFileContent);
22+
file_put_contents($installedFile, $installedFileContent);
23+
}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
"test": [
8585
"@phpunit",
8686
"@phpspec"
87-
]
87+
],
88+
"post-install-cmd": "php bin/remove-dev-info-of-deps.php",
89+
"post-update-cmd": "php bin/remove-dev-info-of-deps.php"
8890
}
8991
}

0 commit comments

Comments
 (0)
0