|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * Fast Forward Development Tools for PHP projects. |
| 7 | + * |
| 8 | + * This file is part of fast-forward/dev-tools project. |
| 9 | + * |
| 10 | + * @author Felipe Sayão Lobato Abreu <github@mentordosnerds.com> |
| 11 | + * @license https://opensource.org/licenses/MIT MIT License |
| 12 | + * |
| 13 | + * @see https://github.com/php-fast-forward/ |
| 14 | + * @see https://github.com/php-fast-forward/dev-tools |
| 15 | + * @see https://github.com/php-fast-forward/dev-tools/issues |
| 16 | + * @see https://php-fast-forward.github.io/dev-tools/ |
| 17 | + * @see https://datatracker.ietf.org/doc/html/rfc2119 |
| 18 | + */ |
| 19 | + |
| 20 | +namespace FastForward\DevTools\Tests\GitHubActions; |
| 21 | + |
| 22 | +use PHPUnit\Framework\Attributes\CoversNothing; |
| 23 | +use PHPUnit\Framework\Attributes\Test; |
| 24 | +use PHPUnit\Framework\TestCase; |
| 25 | +use Symfony\Component\Yaml\Yaml; |
| 26 | + |
| 27 | +#[CoversNothing] |
| 28 | +final class ChangelogWorkflowTest extends TestCase |
| 29 | +{ |
| 30 | + /** |
| 31 | + * @return void |
| 32 | + */ |
| 33 | + #[Test] |
| 34 | + public function prepareReleasePullRequestWillKeepComposerPluginsEnabledForWikiPreviewRefresh(): void |
| 35 | + { |
| 36 | + $workflow = Yaml::parseFile(__DIR__ . '/../../.github/workflows/changelog.yml'); |
| 37 | + $steps = $workflow['jobs']['prepare_release_pull_request']['steps'] ?? null; |
| 38 | + |
| 39 | + self::assertIsArray($steps); |
| 40 | + |
| 41 | + $setupComposerStep = null; |
| 42 | + |
| 43 | + foreach ($steps as $step) { |
| 44 | + if (! \is_array($step)) { |
| 45 | + continue; |
| 46 | + } |
| 47 | + |
| 48 | + if (($step['name'] ?? null) !== 'Setup PHP and install dependencies') { |
| 49 | + continue; |
| 50 | + } |
| 51 | + |
| 52 | + if (($step['if'] ?? null) !== '${{ steps.create_pr.outputs.pull-request-number != \'\' }}') { |
| 53 | + continue; |
| 54 | + } |
| 55 | + |
| 56 | + $setupComposerStep = $step; |
| 57 | + |
| 58 | + break; |
| 59 | + } |
| 60 | + |
| 61 | + self::assertIsArray($setupComposerStep); |
| 62 | + self::assertSame( |
| 63 | + '--prefer-dist --no-progress --no-interaction --no-scripts', |
| 64 | + $setupComposerStep['with']['install-options'] ?? null, |
| 65 | + ); |
| 66 | + self::assertStringNotContainsString( |
| 67 | + '--no-plugins', |
| 68 | + (string) ($setupComposerStep['with']['install-options'] ?? ''), |
| 69 | + ); |
| 70 | + } |
| 71 | +} |
0 commit comments