Skip to content

Commit f4d2cf3

Browse files
committed
658: introduce single point to update example-pie-extension version/sha
1 parent a8538a3 commit f4d2cf3

5 files changed

Lines changed: 22 additions & 7 deletions

File tree

test/behaviour/CliContext.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Behat\Step\When;
1212
use Composer\Semver\VersionParser;
1313
use Composer\Util\Platform;
14+
use Php\PieIntegrationTest\ExamplePieExtensionFixture;
1415
use RuntimeException;
1516
use Safe\Exceptions\PcreException;
1617
use Symfony\Component\Process\Process;
@@ -674,9 +675,9 @@ public function theExtensionsShouldHaveBeenUpdatedToTheLock(): void
674675
Assert::contains($pieInstallOutput, 'Removed extension derickr/quickhash:');
675676
self::assertPackageNotInstalledInPieShowOutput($pieShowOutput, 'derickr/quickhash');
676677

677-
// `example_pie_extension` 2.0.9 should have been installed (was not previously installed)
678-
Assert::contains($pieInstallOutput, 'Extension asgrim/example-pie-extension:2.0.9 is enabled and loaded');
679-
self::assertPackageVersionInstalledInPieShowOutput($pieShowOutput, 'asgrim/example-pie-extension', '2.0.9');
678+
// `example_pie_extension` should have been installed (was not previously installed)
679+
Assert::contains($pieInstallOutput, 'Extension asgrim/example-pie-extension:' . ExamplePieExtensionFixture::LATEST_VERSION . ' is enabled and loaded');
680+
self::assertPackageVersionInstalledInPieShowOutput($pieShowOutput, 'asgrim/example-pie-extension', ExamplePieExtensionFixture::LATEST_VERSION);
680681

681682
$this->restorePieJsonAndLock();
682683
}

test/integration/Command/DownloadCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Composer\Util\Platform;
88
use Php\Pie\Command\DownloadCommand;
99
use Php\Pie\Container;
10+
use Php\PieIntegrationTest\ExamplePieExtensionFixture;
1011
use PHPUnit\Framework\Attributes\CoversClass;
1112
use PHPUnit\Framework\Attributes\DataProvider;
1213
use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily;
@@ -22,7 +23,7 @@
2223
#[CoversClass(DownloadCommand::class)]
2324
class DownloadCommandTest extends IsolatedWorkingDirectoryTestCase
2425
{
25-
private const TEST_PACKAGE_LATEST = '2.0.10';
26+
private const TEST_PACKAGE_LATEST = ExamplePieExtensionFixture::LATEST_VERSION;
2627
private const TEST_PACKAGE = 'asgrim/example-pie-extension';
2728

2829
private CommandTester $commandTester;

test/integration/ComposerIntegration/ComposerIntegrationHandlerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Php\Pie\Platform\TargetPhp\PhpBinaryPath;
2525
use Php\Pie\Platform\TargetPlatform;
2626
use Php\PieIntegrationTest\Command\IsolatedWorkingDirectoryTestCase;
27+
use Php\PieIntegrationTest\ExamplePieExtensionFixture;
2728
use PHPUnit\Framework\Attributes\CoversClass;
2829
use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily;
2930
use Symfony\Component\Console\Output\BufferedOutput;
@@ -44,7 +45,7 @@ final class ComposerIntegrationHandlerTest extends IsolatedWorkingDirectoryTestC
4445
{
4546
private const PACKAGE_NAME = 'asgrim/example-pie-extension';
4647
private const EXTENSION_NAME = 'example_pie_extension';
47-
private const VERSION_CURRENT = '2.0.10';
48+
private const VERSION_CURRENT = ExamplePieExtensionFixture::LATEST_VERSION;
4849
private const VERSION_OTHER = '2.0.2';
4950

5051
private TargetPlatform $targetPlatform;
@@ -216,7 +217,7 @@ private function extensionBinaryPath(): string
216217
/** @param non-empty-string $version */
217218
private function makeComposerPackage(string $version): CompletePackage
218219
{
219-
$sha = 'f4aa08c72cffd395e8ddbcb55622f33165da8660';
220+
$sha = ExamplePieExtensionFixture::LATEST_VERSION_REFERENCE;
220221
$extensionBinaryPath = $this->extensionBinaryPath();
221222

222223
$package = new CompletePackage(self::PACKAGE_NAME, $version . '.0', $version);

test/integration/DependencyResolver/ResolveDependencyWithComposerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Php\Pie\DependencyResolver\ResolveDependencyWithComposer;
1515
use Php\Pie\Platform\TargetPhp\PhpBinaryPath;
1616
use Php\Pie\Platform\TargetPlatform;
17+
use Php\PieIntegrationTest\ExamplePieExtensionFixture;
1718
use PHPUnit\Framework\Attributes\CoversClass;
1819
use PHPUnit\Framework\Attributes\DataProvider;
1920
use PHPUnit\Framework\TestCase;
@@ -26,7 +27,7 @@
2627
#[CoversClass(ResolveDependencyWithComposer::class)]
2728
final class ResolveDependencyWithComposerTest extends TestCase
2829
{
29-
private const TEST_PACKAGE_LATEST = '2.0.10';
30+
private const TEST_PACKAGE_LATEST = ExamplePieExtensionFixture::LATEST_VERSION;
3031
private const DOWNLOAD_URL_ANY = 'https://api.github.com/repos/asgrim/example-pie-extension/zipball/%s';
3132
private const DOWNLOAD_URL_1_0_1_ALPHA_3 = 'https://api.github.com/repos/asgrim/example-pie-extension/zipball/115f8f8e01ee098a18ec2f47af4852be51ebece7';
3233
private const DOWNLOAD_URL_1_0_1 = 'https://api.github.com/repos/asgrim/example-pie-extension/zipball/769f906413d6d1e12152f6d34134cbcd347ca253';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Php\PieIntegrationTest;
6+
7+
final class ExamplePieExtensionFixture
8+
{
9+
public const LATEST_VERSION = '2.0.10';
10+
public const LATEST_VERSION_REFERENCE = 'f4aa08c72cffd395e8ddbcb55622f33165da8660';
11+
}

0 commit comments

Comments
 (0)