|
5 | 5 | namespace Psalm\SymfonyPsalmPlugin\Test;
|
6 | 6 |
|
7 | 7 | use Codeception\Module as BaseModule;
|
8 |
| -use Composer\InstalledVersions; |
9 |
| -use Composer\Semver\VersionParser; |
10 | 8 | use InvalidArgumentException;
|
11 |
| -use PackageVersions\Versions; |
12 |
| -use PHPUnit\Framework\SkippedTestError; |
13 |
| -use RuntimeException; |
14 | 9 | use Twig\Cache\FilesystemCache;
|
15 | 10 | use Twig\Environment;
|
16 | 11 | use Twig\Extension\AbstractExtension;
|
@@ -61,33 +56,6 @@ public function haveTheTemplateCompiled(string $templateName, string $cacheDirec
|
61 | 56 | $twigEnvironment->load($templateName);
|
62 | 57 | }
|
63 | 58 |
|
64 |
| - /** |
65 |
| - * @Given I have the :package package satisfying the :versionConstraint |
66 |
| - */ |
67 |
| - public function haveADependencySatisfied(string $package, string $versionConstraint): void |
68 |
| - { |
69 |
| - $parser = new VersionParser(); |
70 |
| - /** @psalm-suppress UndefinedClass Composer\InstalledVersions is undefined when using Composer 1.x */ |
71 |
| - /** @psalm-suppress DeprecatedClass PackageVersions\Versions is used for Composer 1.x compatibility */ |
72 |
| - if (class_exists(InstalledVersions::class)) { |
73 |
| - /** @var bool $isSatisfied */ |
74 |
| - $isSatisfied = InstalledVersions::satisfies($parser, $package, $versionConstraint); |
75 |
| - } elseif (class_exists(Versions::class)) { |
76 |
| - $version = (string) Versions::getVersion($package); |
77 |
| - |
78 |
| - if (false === strpos($version, '@')) { |
79 |
| - throw new RuntimeException('$version must contain @'); |
80 |
| - } |
81 |
| - |
82 |
| - $isSatisfied = $parser->parseConstraints(explode('@', $version)[0]) |
83 |
| - ->matches($parser->parseConstraints($versionConstraint)); |
84 |
| - } |
85 |
| - |
86 |
| - if (!isset($isSatisfied) || !$isSatisfied) { |
87 |
| - throw new SkippedTestError("This scenario requires $package to match $versionConstraint"); |
88 |
| - } |
89 |
| - } |
90 |
| - |
91 | 59 | private static function getEnvironment(string $rootDirectory, string $cacheDirectory): Environment
|
92 | 60 | {
|
93 | 61 | if (!file_exists($rootDirectory.DIRECTORY_SEPARATOR.self::TWIG_TEMPLATES_DIR)) {
|
|
0 commit comments