diff --git a/.github/workflows/vortex-test-installer.yml b/.github/workflows/vortex-test-installer.yml index c8d2d40e96..67dedeeaf1 100644 --- a/.github/workflows/vortex-test-installer.yml +++ b/.github/workflows/vortex-test-installer.yml @@ -126,3 +126,82 @@ jobs: name: vortex-installer path: .vortex/installer/build/installer.phar if-no-files-found: error + + vortex-test-installer-windows: + runs-on: windows-latest + + timeout-minutes: 60 + + permissions: + contents: read # Checkout the repository; no GITHUB_TOKEN writes are performed. + + env: + GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN || github.token }} + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.TEST_GITHUB_TOKEN || github.token }}"}}' + + steps: + # The installer downloads the template as an archive, which keeps LF line + # endings and symlinks, so the checkout must match it byte for byte. + - name: Keep line endings on checkout + run: git config --global core.autocrlf false + + - name: Keep symlinks on checkout + run: git config --global core.symlinks true + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + - name: Setup PHP + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2 + with: + php-version: '8.4' + coverage: none + # The archiver tests build their zip fixtures with 'ZipArchive'. + extensions: zip + + - name: Set default branch name + run: git config --global init.defaultBranch main + + - name: Install dependencies + run: composer install + working-directory: .vortex/installer + + - name: Create test logs directory + run: New-Item -ItemType Directory -Force -Path .logs + working-directory: .vortex/installer + + # The event log is streamed, so it names the running test even when the + # step is stopped by its timeout. + - name: Run tests + timeout-minutes: 30 + run: composer test -- --log-events-text .logs/phpunit-events.txt + working-directory: .vortex/installer + + - name: Upload test logs + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 + with: + name: ${{ github.job }}-test-logs + path: .vortex/installer/.logs + include-hidden-files: true + if-no-files-found: ignore + + # The suite leaves a PHAR behind, and Box fails on Windows when it + # replaces an existing one. + - name: Remove the PHAR built by the tests + run: if (Test-Path build/installer.phar) { Remove-Item -Force build/installer.phar } + working-directory: .vortex/installer + + - name: Build PHAR + run: composer build + working-directory: .vortex/installer + + - name: Check PHAR version + run: php build/installer.phar --version + working-directory: .vortex/installer + + - name: Install with PHAR + run: php build/installer.phar --no-interaction --no-cleanup --destination=test + working-directory: .vortex/installer diff --git a/.github/workflows/vortex-test-windows.yml b/.github/workflows/vortex-test-windows.yml new file mode 100644 index 0000000000..0235219512 --- /dev/null +++ b/.github/workflows/vortex-test-windows.yml @@ -0,0 +1,152 @@ +# This action is used for Vortex maintenance. It will not be used in the scaffolded project. +name: Vortex - Test on Windows + +on: + push: + branches: + - main + - release/** + - project/** + - '*.x' + pull_request: + branches: + - main + - feature/** + - bugfix/** + - release/** + - project/** + - '*.x' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + # Installs the template with native Windows PHP, then builds and runs the + # stack with Docker Engine inside a WSL2 distribution. + vortex-test-windows-stack: + runs-on: windows-latest + + timeout-minutes: 90 + + permissions: + contents: read # Checkout the repository; no GITHUB_TOKEN writes are performed. + + env: + GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN || github.token }} + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.TEST_GITHUB_TOKEN || github.token }}"}}' + PACKAGE_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN || github.token }} + VORTEX_CONTAINER_REGISTRY_USER: ${{ secrets.VORTEX_CONTAINER_REGISTRY_USER }} + VORTEX_CONTAINER_REGISTRY_PASS: ${{ secrets.VORTEX_CONTAINER_REGISTRY_PASS }} + AHOY_CONFIRM_RESPONSE: y + AHOY_CONFIRM_WAIT_SKIP: 1 + # Variables passed from Windows into WSL; '/p' converts the path. + WSLENV: PACKAGE_TOKEN:VORTEX_CONTAINER_REGISTRY_USER:VORTEX_CONTAINER_REGISTRY_PASS:AHOY_CONFIRM_RESPONSE:AHOY_CONFIRM_WAIT_SKIP:RUNNER_TEMP/p + + steps: + # The installer downloads the template as an archive, which keeps LF line + # endings and symlinks, so the checkout must match it byte for byte. + - name: Keep line endings on checkout + run: git config --global core.autocrlf false + + - name: Keep symlinks on checkout + run: git config --global core.symlinks true + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + - name: Setup PHP + uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2 + with: + php-version: '8.4' + coverage: none + + - name: Set default branch name + run: git config --global init.defaultBranch main + + - name: Install installer dependencies + run: composer install + working-directory: .vortex/installer + + - name: Install Vortex from the checkout on Windows + run: php .vortex/installer/installer.php --no-interaction --uri="$env:GITHUB_WORKSPACE" --destination="$env:RUNNER_TEMP\star_wars" + + - name: Setup WSL2 + uses: Vampire/setup-wsl@4c48163d9f981914dd8caa0fc335fe19cca5bff4 # v7.2.0 + with: + distribution: Ubuntu-24.04 + wsl-version: '2' + # Ahoy bootstraps the tooling package on the host with PHP and Composer. + additional-packages: curl ca-certificates git unzip docker.io docker-compose-v2 docker-buildx php-cli php-curl php-mbstring php-xml php-zip composer + + - name: Start Docker in WSL2 + shell: wsl-bash {0} + run: | + service docker start + timeout 60 sh -c 'until docker info >/dev/null 2>&1; do sleep 1; done' + docker version + docker compose version + + - name: Install Ahoy in WSL2 + shell: wsl-bash {0} + run: | + version=2.4.0 + curl -fsSL -o /usr/local/bin/ahoy "https://github.com/ahoy-cli/ahoy/releases/download/v${version}/ahoy-bin-linux-amd64" + chmod +x /usr/local/bin/ahoy + ahoy --version + + - name: Login to container registry + if: env.VORTEX_CONTAINER_REGISTRY_USER != '' + shell: wsl-bash {0} + run: echo "${VORTEX_CONTAINER_REGISTRY_PASS}" | docker login --username "${VORTEX_CONTAINER_REGISTRY_USER}" --password-stdin + + # Docker runs inside the distribution, so the project lives on its own + # filesystem and bind mounts behave as on a Windows workstation. + - name: Copy the project into WSL2 + shell: wsl-bash {0} + run: cp -a "${RUNNER_TEMP}/star_wars" /root/star_wars + + - name: Check the project has no CRLF line endings + shell: wsl-bash {0} + run: | + if grep -rlI $'\r' --exclude-dir=.git /root/star_wars; then + echo "Files above contain CRLF line endings." + exit 1 + fi + + # Stand-ins for the network and SSH agent container that Pygmy provides. + - name: Start local routing stubs + shell: wsl-bash {0} + run: | + docker network create amazeeio-network + docker run --detach --name amazeeio-ssh-agent pygmystack/ssh-agent + + - name: Build the stack + shell: wsl-bash {0} + run: | + cd /root/star_wars + ahoy build + + - name: Check the site responds + shell: wsl-bash {0} + run: | + cd /root/star_wars + docker compose exec -T cli curl -fsSL --output /dev/null http://nginx:8080 + + - name: Check Ahoy commands + shell: wsl-bash {0} + run: | + cd /root/star_wars + ahoy info + ahoy drush status + ahoy lint + ahoy test-unit + + - name: Show container logs + if: failure() + shell: wsl-bash {0} + run: | + cd /root/star_wars + docker compose logs --tail 200 diff --git a/.vortex/installer/composer.json b/.vortex/installer/composer.json index 3e7239edf9..7f552df975 100644 --- a/.vortex/installer/composer.json +++ b/.vortex/installer/composer.json @@ -19,7 +19,7 @@ "require": { "php": ">=8.3", "alexskrypnyk/file": "^1.4.1", - "alexskrypnyk/prompty": "^1.2.0", + "alexskrypnyk/prompty": "^1.3.2", "alexskrypnyk/str2name": "^1.7.0", "composer/composer": "^2.11.1", "czproject/git-php": "^4.6", @@ -32,7 +32,7 @@ "symfony/yaml": "^7.4.23" }, "require-dev": { - "alexskrypnyk/phpunit-helpers": "^1.2", + "alexskrypnyk/phpunit-helpers": "^1.2.1", "alexskrypnyk/snapshot": "^1.6.0", "bamarni/composer-bin-plugin": "^1.9.1", "dealerdirect/phpcodesniffer-composer-installer": "^1.2.1", @@ -45,13 +45,6 @@ "rector/rector": "^2.8.4", "symfony/finder": "^7.4.23" }, - "repositories": [ - { - "name": "prompty", - "type": "vcs", - "url": "https://github.com/AlexSkrypnyk/prompty" - } - ], "autoload": { "psr-4": { "DrevOps\\VortexInstaller\\": "src/" diff --git a/.vortex/installer/composer.lock b/.vortex/installer/composer.lock index 2078d248c1..ed3830ea60 100644 --- a/.vortex/installer/composer.lock +++ b/.vortex/installer/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4772787b65dc552bb66b63ac9c74050a", + "content-hash": "579d917241ddb7ac1246a2660223d68f", "packages": [ { "name": "alexskrypnyk/file", @@ -74,32 +74,32 @@ }, { "name": "alexskrypnyk/prompty", - "version": "1.2.0", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/AlexSkrypnyk/prompty.git", - "reference": "5cbd7b816ccbae0d96c1be38ddf435e28ed3aa6e" + "reference": "eded348cf5b42b08bbf2df03f469f4903dca449c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AlexSkrypnyk/prompty/zipball/5cbd7b816ccbae0d96c1be38ddf435e28ed3aa6e", - "reference": "5cbd7b816ccbae0d96c1be38ddf435e28ed3aa6e", + "url": "https://api.github.com/repos/AlexSkrypnyk/prompty/zipball/eded348cf5b42b08bbf2df03f469f4903dca449c", + "reference": "eded348cf5b42b08bbf2df03f469f4903dca449c", "shasum": "" }, "require": { "php": ">=8.3" }, "require-dev": { - "alexskrypnyk/phpunit-helpers": "^1.2.0", + "alexskrypnyk/phpunit-helpers": "^1.2.1", "bamarni/composer-bin-plugin": "^1.9.1", "dealerdirect/phpcodesniffer-composer-installer": "^1.2.1", "drevops/phpcs-standard": "^1.1.0", "drupal/coder": "^9.0.1", - "ergebnis/composer-normalize": "^2.52.0", + "ergebnis/composer-normalize": "^2.57.0", "opis/closure": "^4.5.0", - "phpstan/phpstan": "^2.2.8", - "phpunit/phpunit": "^12.5.43", - "rector/rector": "^2.6.2" + "phpstan/phpstan": "^2.3.5", + "phpunit/phpunit": "^12.5.44", + "rector/rector": "^2.8.4" }, "type": "library", "autoload": { @@ -108,39 +108,14 @@ "PromptyTestTrait.php" ] }, - "autoload-dev": { - "classmap": [ - "tests/phpunit" - ] - }, - "scripts": { - "lint": [ - "phpcs", - "phpstan", - "rector --dry-run", - "php .util/check-embed.php" - ], - "lint-fix": [ - "rector", - "phpcbf" - ], - "reset": [ - "rm -Rf vendor vendor-bin composer.lock" - ], - "test": [ - "phpunit --no-coverage" - ], - "test-coverage": [ - "phpunit" - ] - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Alex Skrypnyk", - "email": "prompty@alexskrypnyk.com", + "email": "alex@drevops.com", "homepage": "https://alexskrypnyk.com", "role": "Maintainer" } @@ -153,15 +128,12 @@ }, "funding": [ { - "type": "github", - "url": "https://github.com/alexskrypnyk" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/alexskrypnyk" + "url": "https://github.com/alexskrypnyk", + "type": "github" } ], - "time": "2026-11-11T11:26:01+00:00" + "time": "2026-11-14T13:55:41+00:00", + "published-time": "2026-11-14T13:56:43+00:00" }, { "name": "alexskrypnyk/str2name", @@ -3502,16 +3474,16 @@ "packages-dev": [ { "name": "alexskrypnyk/phpunit-helpers", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/AlexSkrypnyk/phpunit-helpers.git", - "reference": "ddb4f51c6265359b58a4b803668a4a1d3586a0e3" + "reference": "f100edfd38a98636b6c863d9ee9d2f4b0eb4841c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AlexSkrypnyk/phpunit-helpers/zipball/ddb4f51c6265359b58a4b803668a4a1d3586a0e3", - "reference": "ddb4f51c6265359b58a4b803668a4a1d3586a0e3", + "url": "https://api.github.com/repos/AlexSkrypnyk/phpunit-helpers/zipball/f100edfd38a98636b6c863d9ee9d2f4b0eb4841c", + "reference": "f100edfd38a98636b6c863d9ee9d2f4b0eb4841c", "shasum": "" }, "require": { @@ -3525,11 +3497,11 @@ "dealerdirect/phpcodesniffer-composer-installer": "^1.2.1", "drevops/phpcs-standard": "^0.7", "drupal/coder": "^9.0.1", - "ergebnis/composer-normalize": "^2.53.0", - "laravel/serializable-closure": "^2.0.16", + "ergebnis/composer-normalize": "^2.57.0", + "laravel/serializable-closure": "^2.2.0", "phpbench/phpbench": "^1.7", - "phpstan/phpstan": "^2.2.14", - "rector/rector": "^2.6.7", + "phpstan/phpstan": "^2.3.5", + "rector/rector": "^2.8.4", "squizlabs/php_codesniffer": "^4.0.4", "symfony/console": "^6.4 || ^7.2 || ^8.0" }, @@ -3561,14 +3533,10 @@ { "url": "https://github.com/alexskrypnyk", "type": "github" - }, - { - "url": "https://www.patreon.com/alexskrypnyk", - "type": "patreon" } ], - "time": "2026-09-21T02:30:10+00:00", - "published-time": "2026-09-21T02:31:42+00:00" + "time": "2026-11-13T10:04:52+00:00", + "published-time": "2026-11-13T10:05:49+00:00" }, { "name": "alexskrypnyk/snapshot", diff --git a/.vortex/installer/src/Downloader/Archiver.php b/.vortex/installer/src/Downloader/Archiver.php index ea5667d229..4f89d1c1a3 100644 --- a/.vortex/installer/src/Downloader/Archiver.php +++ b/.vortex/installer/src/Downloader/Archiver.php @@ -195,7 +195,9 @@ protected function stripDirectoryLevel(string $source, string $destination): voi $top_dir = reset($entries); $source_path = $source . '/' . $top_dir; - File::copy($source_path, $destination); + // $source is a temporary directory, and Windows reads symlink targets as + // absolute paths into it, so the targets are kept relative. + File::copy($source_path, $destination, symlink_mode: File::SYMLINK_MODE_RELATIVE); } } diff --git a/.vortex/installer/src/Prompts/Handlers/Internal.php b/.vortex/installer/src/Prompts/Handlers/Internal.php index a9666617da..67d01cad8d 100644 --- a/.vortex/installer/src/Prompts/Handlers/Internal.php +++ b/.vortex/installer/src/Prompts/Handlers/Internal.php @@ -64,7 +64,8 @@ public function process(): void { '/web/sites/default/default.services.yml', '/.docker/config/solr/config-set/', ]; - $relative_path = str_replace($t, '', $file->getPathname()); + // Windows returns mixed separators, and the ignore list uses '/'. + $relative_path = str_replace(File::toForwardSlashes($t), '', File::toForwardSlashes($file->getPathname())); $should_ignore = FALSE; foreach ($ignore_empty_line_processing as $item_path) { if (str_starts_with($relative_path, $item_path)) { diff --git a/.vortex/installer/src/Prompts/Handlers/Profile.php b/.vortex/installer/src/Prompts/Handlers/Profile.php index 4300a2a915..87a78b5d96 100644 --- a/.vortex/installer/src/Prompts/Handlers/Profile.php +++ b/.vortex/installer/src/Prompts/Handlers/Profile.php @@ -150,8 +150,9 @@ public function process(): void { Env::writeValueDotenv('DRUPAL_PROFILE', $v, $t . '/.env'); - // Assume that profiles provided as a path are contrib profiles. - $is_contrib_profile = str_contains($v, DIRECTORY_SEPARATOR); + // Assume that profiles provided as a path are contrib profiles. The path is + // read inside the containers, so it uses '/' on every host. + $is_contrib_profile = str_contains($v, '/'); if (in_array($v, [self::STANDARD, self::MINIMAL, self::DEMO_UMAMI]) || $is_contrib_profile) { File::remove(sprintf('%s/%s/profiles/your_site_profile', $t, $w)); diff --git a/.vortex/installer/src/Prompts/Handlers/Webroot.php b/.vortex/installer/src/Prompts/Handlers/Webroot.php index 8ae11b07a5..1a28cea118 100644 --- a/.vortex/installer/src/Prompts/Handlers/Webroot.php +++ b/.vortex/installer/src/Prompts/Handlers/Webroot.php @@ -103,7 +103,7 @@ public function validate(): ?callable { * {@inheritdoc} */ public function transform(): ?callable { - return fn(string $v): string => rtrim($v, DIRECTORY_SEPARATOR); + return fn(string $v): string => rtrim($v, '/'); } /** diff --git a/.vortex/installer/src/Runner/AbstractRunner.php b/.vortex/installer/src/Runner/AbstractRunner.php index d432b69213..91dc6471c2 100644 --- a/.vortex/installer/src/Runner/AbstractRunner.php +++ b/.vortex/installer/src/Runner/AbstractRunner.php @@ -167,7 +167,8 @@ protected function setExitCode(int $exit_code): void { * {@inheritdoc} */ public function getOutput(bool $as_array = FALSE, ?int $lines = NULL): string|array { - $output_lines = explode(PHP_EOL, $this->output); + // Processes write LF on every platform, including Windows. + $output_lines = preg_split('/\r?\n/', $this->output) ?: []; if ($lines !== NULL) { $output_lines = array_slice($output_lines, 0, $lines); @@ -177,7 +178,7 @@ public function getOutput(bool $as_array = FALSE, ?int $lines = NULL): string|ar return $output_lines; } - return implode(PHP_EOL, $output_lines); + return implode("\n", $output_lines); } /** diff --git a/.vortex/installer/src/Utils/File.php b/.vortex/installer/src/Utils/File.php index ca84481c3c..d1777fb89e 100644 --- a/.vortex/installer/src/Utils/File.php +++ b/.vortex/installer/src/Utils/File.php @@ -25,8 +25,10 @@ public static function ignoredPaths(array $paths = []): array { * Check if path is internal. */ public static function isInternal(string $path): bool { - if (str_starts_with($path, '.' . DIRECTORY_SEPARATOR)) { - $path = DIRECTORY_SEPARATOR . substr($path, 2); + $path = static::toForwardSlashes($path); + + if (str_starts_with($path, './')) { + $path = substr($path, 1); } return in_array($path, self::internalPaths()); @@ -184,9 +186,13 @@ public static function removeTokenAsync(string $token, bool $with_content = TRUE */ public static function toRelative(string $path, ?string $base = NULL): string { $base ??= (string) getcwd(); - $absolute = self::absolute($path, $base); + $absolute = static::toForwardSlashes(static::absolute($path, $base)); + + // realpath() rebuilds the path with the platform separator, so the base + // is resolved the same way before it is stripped. + $base = static::toForwardSlashes(static::realpath($base)); - return str_replace($base . DIRECTORY_SEPARATOR, '', $absolute); + return str_replace($base . '/', '', $absolute); } } diff --git a/.vortex/installer/src/Utils/FileManager.php b/.vortex/installer/src/Utils/FileManager.php index 68bfc3c248..a2913fff63 100644 --- a/.vortex/installer/src/Utils/FileManager.php +++ b/.vortex/installer/src/Utils/FileManager.php @@ -7,6 +7,9 @@ use DrevOps\VortexInstaller\Downloader\Artifact; use DrevOps\VortexInstaller\Downloader\Downloader; use DrevOps\VortexInstaller\Downloader\RepositoryDownloader; +use DrevOps\VortexInstaller\Runner\ProcessRunner; +use DrevOps\VortexInstaller\Runner\RunnerInterface; +use Symfony\Component\Console\Output\NullOutput; /** * File operations for the installation process. @@ -163,14 +166,21 @@ public function prepareDestination(): array { if (!File::exists($destination . '/.git')) { $messages[] = sprintf('Initializing a new Git repository in directory "%s".', $destination); - // The destination arrives from a CLI option, the environment or a config - // file, so it is escaped rather than interpolated into the shell string. // 'git init' writes the initial branch advice to stderr when - // 'init.defaultBranch' is unset, and passthru() draws it inside the TUI. - $command = sprintf('git -c advice.defaultBranchName=false --work-tree=%s --git-dir=%s init > /dev/null', escapeshellarg($destination), escapeshellarg($destination . '/.git')); - passthru($command, $exit_code); - - if ($exit_code !== 0) { + // 'init.defaultBranch' is unset, so the output is captured rather than + // drawn inside the TUI. + $runner = new ProcessRunner(); + $runner->getLogger()->disable(); + $args = [ + '-c', + 'advice.defaultBranchName=false', + '--work-tree=' . $destination, + '--git-dir=' . $destination . '/.git', + 'init', + ]; + $runner->run('git', args: $args, output: new NullOutput()); + + if ($runner->getExitCode() !== RunnerInterface::EXIT_SUCCESS) { throw new \RuntimeException(sprintf('Unable to initialize Git repository in directory "%s".', $destination)); } } @@ -223,7 +233,9 @@ public function copyFiles(): void { $this->recordChanges($src, $report); if (File::isDir($src) && !File::dirIsEmpty($src)) { - File::copy($src, $destination); + // $src is removed after the install, and Windows reads symlink targets + // as absolute paths into it, so the targets are kept relative. + File::copy($src, $destination, symlink_mode: File::SYMLINK_MODE_RELATIVE); $this->recordFailedCopies($src, $report); } @@ -287,7 +299,8 @@ protected function removeExcludedPaths(array $paths, array $expected): void { $this->report?->add($path, InstallReport::STATUS_REMOVED); $this->report?->addChange($path, $content, NULL); - for ($dir = dirname($path); $dir !== '.'; $dir = dirname($dir)) { + // A rooted path never reaches '.', and on Windows dirname('/') is '\'. + for ($dir = dirname($path); $dir !== '.' && $dir !== dirname($dir); $dir = dirname($dir)) { $dirs[$dir] = substr_count($dir, '/'); } } @@ -394,7 +407,9 @@ protected function recordFailedCopies(string $src, InstallReport $report): void } // A side that cannot be read cannot be compared, so its status stands. - $staged_hash = File::isReadable($target) ? hash_file(self::HASH_ALGO, $src . '/' . $path) : FALSE; + // On Windows, hash_file() fails on a staged path behind a directory + // symlink that is_readable() accepts, so its warning is suppressed. + $staged_hash = File::isReadable($target) ? @hash_file(self::HASH_ALGO, $src . '/' . $path) : FALSE; if ($staged_hash === FALSE) { continue; @@ -486,7 +501,10 @@ protected function relativePaths(string $directory): array { $root = File::dir($directory); $files = File::scandir($root, File::ignoredPaths()); - return array_map(fn(string $file): string => ltrim(str_replace($root, '', $file), DIRECTORY_SEPARATOR), $files); + // Windows returns mixed separators, and every path key uses '/'. + $root = File::toForwardSlashes($root); + + return array_map(fn(string $file): string => ltrim(str_replace($root, '', File::toForwardSlashes($file)), '/'), $files); } /** diff --git a/.vortex/installer/src/Utils/InstallReport.php b/.vortex/installer/src/Utils/InstallReport.php index 6444f507aa..fcd04ff8f8 100644 --- a/.vortex/installer/src/Utils/InstallReport.php +++ b/.vortex/installer/src/Utils/InstallReport.php @@ -34,6 +34,11 @@ class InstallReport { */ const DIFF_EXTENSION = '.diff'; + /** + * Line ending of the written files, kept LF on every platform. + */ + const EOL = "\n"; + const STATUS_ADDED = 'added'; const STATUS_UPDATED = 'updated'; @@ -207,7 +212,7 @@ protected function writeDiffs(string $dir): array { $to_label = $change['to'] === NULL ? '/dev/null' : 'b/' . $path; $diff = Diff::unified($change['from'], (string) $change['to'], 'a/' . $path, $to_label); - File::dump($dir . '/' . $path . self::DIFF_EXTENSION, $diff . PHP_EOL); + File::dump($dir . '/' . $path . self::DIFF_EXTENSION, $diff . self::EOL); $links[$path] = sprintf('[diff](%s)', $this->encodeLink(basename($dir) . '/' . $path . self::DIFF_EXTENSION)); } @@ -234,35 +239,35 @@ protected function render(?string $from, string $to, int $timestamp, array $link // The report sits in DIR, so project paths are reached from its parent. $root = str_repeat('../', substr_count(self::DIR, '/') + 1); - $content = '# Vortex installation report' . PHP_EOL . PHP_EOL; + $content = '# Vortex installation report' . self::EOL . self::EOL; if ($from !== NULL && $from !== '') { - $content .= sprintf('- **From:** %s', $from) . PHP_EOL; + $content .= sprintf('- **From:** %s', $from) . self::EOL; } - $content .= sprintf('- **To:** %s', $to) . PHP_EOL; - $content .= sprintf('- **Date:** %s', date('Y-m-d H:i:s', $timestamp)) . PHP_EOL . PHP_EOL; + $content .= sprintf('- **To:** %s', $to) . self::EOL; + $content .= sprintf('- **Date:** %s', date('Y-m-d H:i:s', $timestamp)) . self::EOL . self::EOL; - $content .= '## Statuses' . PHP_EOL . PHP_EOL; - $content .= '| Status | Meaning |' . PHP_EOL . '|---|---|' . PHP_EOL; + $content .= '## Statuses' . self::EOL . self::EOL; + $content .= '| Status | Meaning |' . self::EOL . '|---|---|' . self::EOL; foreach (self::STATUSES as $status => $description) { - $content .= sprintf('| `%s` | %s |', $status, $description) . PHP_EOL; + $content .= sprintf('| `%s` | %s |', $status, $description) . self::EOL; } - $content .= PHP_EOL . '## Summary' . PHP_EOL . PHP_EOL; - $content .= '| Status | Files |' . PHP_EOL . '|---|---|' . PHP_EOL; + $content .= self::EOL . '## Summary' . self::EOL . self::EOL; + $content .= '| Status | Files |' . self::EOL . '|---|---|' . self::EOL; foreach ($this->summary() as $status => $count) { - $content .= sprintf('| `%s` | %d |', $status, $count) . PHP_EOL; + $content .= sprintf('| `%s` | %d |', $status, $count) . self::EOL; } - $content .= PHP_EOL . '## Files' . PHP_EOL . PHP_EOL; - $content .= 'Each diff shows the project copy before the installation as `a/` and the copy it left as `b/`.' . PHP_EOL . PHP_EOL; - $content .= '| Status | File | Change |' . PHP_EOL . '|---|---|---|' . PHP_EOL; + $content .= self::EOL . '## Files' . self::EOL . self::EOL; + $content .= 'Each diff shows the project copy before the installation as `a/` and the copy it left as `b/`.' . self::EOL . self::EOL; + $content .= '| Status | File | Change |' . self::EOL . '|---|---|---|' . self::EOL; foreach ($this->getEntries() as $path => $status) { // A removed path has no file left to link to. $file = File::exists($this->destination . '/' . $path) ? sprintf('[%s](%s)', $path, $this->encodeLink($root . $path)) : sprintf('`%s`', $path); - $content .= sprintf('| `%s` | %s | %s |', $status, $file, $links[$path] ?? '') . PHP_EOL; + $content .= sprintf('| `%s` | %s | %s |', $status, $file, $links[$path] ?? '') . self::EOL; } return $content; diff --git a/.vortex/installer/src/Utils/Tui.php b/.vortex/installer/src/Utils/Tui.php index e068891b75..7b7beff42b 100644 --- a/.vortex/installer/src/Utils/Tui.php +++ b/.vortex/installer/src/Utils/Tui.php @@ -169,7 +169,7 @@ public static function table(array $header, array $rows): void { } public static function center(string $text, int $width = 80, ?string $border = NULL): string { - $lines = explode(PHP_EOL, $text); + $lines = preg_split('/\r?\n/', $text) ?: []; $centered_lines = []; $max_length = 0; @@ -193,7 +193,7 @@ public static function center(string $text, int $width = 80, ?string $border = N $centered_lines[] = $border; } - return implode(PHP_EOL, $centered_lines); + return implode("\n", $centered_lines); } public static function terminalWidth(int $max = 100): int { diff --git a/.vortex/installer/src/Utils/UpdateRegistry.php b/.vortex/installer/src/Utils/UpdateRegistry.php index 89cccbd460..dd443aea26 100644 --- a/.vortex/installer/src/Utils/UpdateRegistry.php +++ b/.vortex/installer/src/Utils/UpdateRegistry.php @@ -33,6 +33,11 @@ class UpdateRegistry { */ const MAX_DIFF_BYTES = Diff::MAX_BYTES; + /** + * Line ending of the written file, kept LF on every platform. + */ + const EOL = "\n"; + /** * Replaced content, keyed by template-relative path. * @@ -88,7 +93,7 @@ public function write(string $from, string $to, string $time): ?string { ksort($this->entries); - $content = sprintf('## %s to %s, %s', $from, $to, $time) . PHP_EOL . PHP_EOL; + $content = sprintf('## %s to %s, %s', $from, $to, $time) . self::EOL . self::EOL; foreach ($this->entries as $path => $contents) { $content .= $this->renderEntry($path, $contents); @@ -102,7 +107,7 @@ public function write(string $from, string $to, string $time): ?string { throw new \RuntimeException(sprintf('Unable to read the update registry "%s".', $file)); } - $existing = File::exists($file) ? File::read($file) : self::HEADING . PHP_EOL; + $existing = File::exists($file) ? File::read($file) : self::HEADING . self::EOL; File::dump($file, $existing . $content); @@ -121,32 +126,32 @@ public function write(string $from, string $to, string $time): ?string { * The rendered entry. */ protected function renderEntry(string $path, array $contents): string { - $content = sprintf('### %s', $path) . PHP_EOL . PHP_EOL; + $content = sprintf('### %s', $path) . self::EOL . self::EOL; $skip = Diff::skipReason(...array_values(array_filter($contents, is_string(...)))); if ($skip === Diff::SKIP_BINARY) { - return $content . 'Binary file. Recover the project copy from version control.' . PHP_EOL . PHP_EOL; + return $content . 'Binary file. Recover the project copy from version control.' . self::EOL . self::EOL; } if ($skip === Diff::SKIP_TOO_LARGE) { - return $content . 'File is too large to diff. Recover the project copy from version control.' . PHP_EOL . PHP_EOL; + return $content . 'File is too large to diff. Recover the project copy from version control.' . self::EOL . self::EOL; } if ($contents['previous'] === NULL) { - $content .= 'The version the project runs did not ship this file. Project content that the update replaced:' . PHP_EOL . PHP_EOL; + $content .= 'The version the project runs did not ship this file. Project content that the update replaced:' . self::EOL . self::EOL; return $content . $this->renderDiff($contents['project'], $contents['next'], 'project', 'update'); } - $content .= 'Project change that the update replaced:' . PHP_EOL . PHP_EOL; + $content .= 'Project change that the update replaced:' . self::EOL . self::EOL; $content .= $this->renderDiff($contents['previous'], $contents['project'], 'installed', 'project'); if ($contents['previous'] === $contents['next']) { - return $content . 'The update ships this file unchanged.' . PHP_EOL . PHP_EOL; + return $content . 'The update ships this file unchanged.' . self::EOL . self::EOL; } - $content .= 'Change that the update brings:' . PHP_EOL . PHP_EOL; + $content .= 'Change that the update brings:' . self::EOL . self::EOL; return $content . $this->renderDiff($contents['previous'], $contents['next'], 'installed', 'update'); } @@ -175,7 +180,7 @@ protected function renderDiff(string $from, string $to, string $from_label, stri preg_match_all('/`{3,}/', $diff, $matches); $fence = str_repeat('`', $matches[0] === [] ? 3 : max(3, max(array_map(strlen(...), $matches[0])) + 1)); - return $fence . 'diff' . PHP_EOL . $diff . PHP_EOL . $fence . PHP_EOL . PHP_EOL; + return $fence . 'diff' . self::EOL . $diff . self::EOL . $fence . self::EOL . self::EOL; } } diff --git a/.vortex/installer/tests/Functional/PharTest.php b/.vortex/installer/tests/Functional/PharTest.php index 7e9dac432b..52248910ab 100644 --- a/.vortex/installer/tests/Functional/PharTest.php +++ b/.vortex/installer/tests/Functional/PharTest.php @@ -86,14 +86,14 @@ protected static function buildPhar(string $destination): void { fwrite(STDERR, 'Building installer PHAR file...'); if (!File::exists('vendor')) { $exit_code = 0; - passthru('composer install --no-dev --optimize-autoloader >/dev/null 2>&1 ', $exit_code); + exec('composer install --no-dev --optimize-autoloader 2>&1', $output, $exit_code); if ($exit_code !== 0) { throw new \RuntimeException('Failed to install dependencies for PHAR build.'); } } $exit_code = 0; - passthru('composer build >/dev/null 2>&1', $exit_code); + exec('composer build 2>&1', $output, $exit_code); if ($exit_code !== 0) { throw new \RuntimeException('Failed to build PHAR file.'); diff --git a/.vortex/installer/tests/Functional/Prompts/Handlers/ThemeHandlerProcessTest.php b/.vortex/installer/tests/Functional/Prompts/Handlers/ThemeHandlerProcessTest.php index 1668c26957..273ad56afc 100644 --- a/.vortex/installer/tests/Functional/Prompts/Handlers/ThemeHandlerProcessTest.php +++ b/.vortex/installer/tests/Functional/Prompts/Handlers/ThemeHandlerProcessTest.php @@ -67,18 +67,18 @@ public static function dataProviderHandlerProcess(): \Iterator { // Vortex theme scaffold with their own). File::remove($theme_dir); File::mkdir($theme_dir); - File::dump($theme_dir . '/star_wars.info.yml', 'name: Star Wars Custom' . PHP_EOL . 'type: theme' . PHP_EOL . 'core_version_requirement: ^11' . PHP_EOL); - File::dump($theme_dir . '/package.json', '{"name": "star_wars_custom"}' . PHP_EOL); - File::dump($theme_dir . '/styles.css', '.star-wars { color: blue; }' . PHP_EOL); + File::dump($theme_dir . '/star_wars.info.yml', "name: Star Wars Custom\ntype: theme\ncore_version_requirement: ^11\n"); + File::dump($theme_dir . '/package.json', "{\"name\": \"star_wars_custom\"}\n"); + File::dump($theme_dir . '/styles.css', ".star-wars { color: blue; }\n"); }), static::cw(function (AbstractHandlerProcessTestCase $test): void { // The project's own theme files must be preserved unchanged β€” // Vortex must not overwrite them with its template theme files. $theme_dir = static::$sut . '/web/themes/custom/star_wars'; $test->assertDirectoryExists($theme_dir); - $test->assertStringEqualsFile($theme_dir . '/star_wars.info.yml', 'name: Star Wars Custom' . PHP_EOL . 'type: theme' . PHP_EOL . 'core_version_requirement: ^11' . PHP_EOL); - $test->assertStringEqualsFile($theme_dir . '/package.json', '{"name": "star_wars_custom"}' . PHP_EOL); - $test->assertStringEqualsFile($theme_dir . '/styles.css', '.star-wars { color: blue; }' . PHP_EOL); + $test->assertStringEqualsFile($theme_dir . '/star_wars.info.yml', "name: Star Wars Custom\ntype: theme\ncore_version_requirement: ^11\n"); + $test->assertStringEqualsFile($theme_dir . '/package.json', "{\"name\": \"star_wars_custom\"}\n"); + $test->assertStringEqualsFile($theme_dir . '/styles.css', ".star-wars { color: blue; }\n"); $test->assertFilesDoNotExist($theme_dir, ['star_wars.theme'], 'Vortex template theme files should not be present'); }), diff --git a/.vortex/installer/tests/Unit/Downloader/RepositoryDownloaderTest.php b/.vortex/installer/tests/Unit/Downloader/RepositoryDownloaderTest.php index 04bad72bb3..bb5b97a9be 100644 --- a/.vortex/installer/tests/Unit/Downloader/RepositoryDownloaderTest.php +++ b/.vortex/installer/tests/Unit/Downloader/RepositoryDownloaderTest.php @@ -680,7 +680,7 @@ protected static function gitRunner(string $repo_dir): ProcessRunner { } protected function removeGitRepo(string $repo_dir): void { - File::remove($repo_dir); + static::removeGitRepository($repo_dir); } protected function createMockArchiverWithExtract(): MockObject { diff --git a/.vortex/installer/tests/Unit/Runner/ProcessRunnerTest.php b/.vortex/installer/tests/Unit/Runner/ProcessRunnerTest.php index 7bddde35ef..7add0f1d9c 100644 --- a/.vortex/installer/tests/Unit/Runner/ProcessRunnerTest.php +++ b/.vortex/installer/tests/Unit/Runner/ProcessRunnerTest.php @@ -276,6 +276,10 @@ public function testRunWithEnvironmentVariables(): void { } public function testRunWithWorkingDirectory(): void { + if (PHP_OS_FAMILY === 'Windows') { + $this->markTestSkipped('The MSYS "pwd" on Windows prints POSIX-style paths.'); + } + $runner = new ProcessRunner(); $test_dir = self::$tmp . '/test_subdir'; File::mkdir($test_dir); @@ -292,6 +296,10 @@ public function testRunWithWorkingDirectory(): void { } public function testResolveCommandWithRelativePath(): void { + if (PHP_OS_FAMILY === 'Windows') { + $this->markTestSkipped('Windows decides whether a file is executable by its extension.'); + } + $runner = new TestableProcessRunner(); $test_dir = self::$tmp . '/test_scripts'; File::mkdir($test_dir); diff --git a/.vortex/installer/tests/Unit/UnitTestCase.php b/.vortex/installer/tests/Unit/UnitTestCase.php index f4c93550e2..050299ed5a 100644 --- a/.vortex/installer/tests/Unit/UnitTestCase.php +++ b/.vortex/installer/tests/Unit/UnitTestCase.php @@ -111,6 +111,20 @@ protected static function envUnsetProjectVars(): void { static::envUnset('TZ'); } + /** + * Remove a directory that holds Git's read-only object files. + * + * Windows refuses to unlink a read-only file, so the tree is made writable + * first. + */ + protected static function removeGitRepository(string $path): void { + if (File::exists($path)) { + File::chmod($path, 0777, TRUE); + } + + File::remove($path); + } + /** * {@inheritdoc} */ diff --git a/.vortex/installer/tests/Unit/Utils/EnvTest.php b/.vortex/installer/tests/Unit/Utils/EnvTest.php index 7e85e32a03..ed2f0cd518 100644 --- a/.vortex/installer/tests/Unit/Utils/EnvTest.php +++ b/.vortex/installer/tests/Unit/Utils/EnvTest.php @@ -210,6 +210,10 @@ public function testParseDotenvFileNotReadable(): void { } public function testParseDotenvFileReadFailure(): void { + if (PHP_OS_FAMILY === 'Windows') { + $this->markTestSkipped('Windows does not restrict reads by file mode.'); + } + $filename = $this->createFixtureEnvFile('VAR=value'); File::chmod($filename, 0000); @@ -278,6 +282,10 @@ public function testWriteValueDotenvFileNotReadable(): void { } public function testWriteValueDotenvFileReadFailure(): void { + if (PHP_OS_FAMILY === 'Windows') { + $this->markTestSkipped('Windows does not restrict reads by file mode.'); + } + $filename = $this->createFixtureEnvFile('VAR=value'); File::chmod($filename, 0000); diff --git a/.vortex/installer/tests/Unit/Utils/FileManagerTest.php b/.vortex/installer/tests/Unit/Utils/FileManagerTest.php index d3fd522d42..f705c55b30 100644 --- a/.vortex/installer/tests/Unit/Utils/FileManagerTest.php +++ b/.vortex/installer/tests/Unit/Utils/FileManagerTest.php @@ -523,6 +523,22 @@ public function testCopyFilesReportsFilesTheCopyCouldNotWrite(): void { $this->assertFileContainsString((string) $fm->getReportFile(), '| `failed` | [phpstan.neon](../phpstan.neon) | |', 'A file the copy did not write is not reported as updated, and has no diff.'); } + public function testRecordFailedCopiesKeepsStatusWhenStagedFileIsUnreadable(): void { + $src = File::mkdir(self::$sut . '/src_staged_unreadable'); + $destination = self::$sut . '/dst_staged_unreadable'; + File::dump(File::mkdir($destination) . '/composer.json', '{}'); + + $fm = new FileManager($this->createConfig($destination, $src)); + $report = new InstallReport($destination); + $report->add('composer.json', InstallReport::STATUS_ADDED); + + // The staged copy is missing, as a path behind a directory symlink in the + // staged tree is on Windows. + $this->callProtectedMethod($fm, 'recordFailedCopies', [$src, $report]); + + $this->assertSame(['composer.json' => InstallReport::STATUS_ADDED], $report->getEntries(), 'A staged copy that cannot be read leaves the status unchanged.'); + } + public function testCopyFilesReportsEnvLocalTheCopyCouldNotWrite(): void { $src = self::$sut . '/src_report_env_failed'; $destination = self::$sut . '/dst_report_env_failed'; diff --git a/.vortex/installer/tests/Unit/Utils/FileTest.php b/.vortex/installer/tests/Unit/Utils/FileTest.php index af8d2fc1a5..fe4ee16dad 100644 --- a/.vortex/installer/tests/Unit/Utils/FileTest.php +++ b/.vortex/installer/tests/Unit/Utils/FileTest.php @@ -39,6 +39,10 @@ public function testToRelative(string $path, ?string $base, string $expected): v public static function dataProviderToRelative(): \Iterator { $cwd = getcwd(); + if ($cwd === FALSE) { + throw new \RuntimeException('Failed to determine current working directory.'); + } + yield 'absolute path with base' => [ '/var/www/project/file.txt', '/var/www', @@ -77,7 +81,7 @@ public static function dataProviderToRelative(): \Iterator { yield 'current directory with null base' => [ $cwd, NULL, - $cwd, + File::toForwardSlashes($cwd), ]; yield 'relative path with null base' => [ 'test/file.txt', diff --git a/.vortex/installer/tests/Unit/Utils/GitTest.php b/.vortex/installer/tests/Unit/Utils/GitTest.php index 7a8b6181cb..d789d8fb43 100644 --- a/.vortex/installer/tests/Unit/Utils/GitTest.php +++ b/.vortex/installer/tests/Unit/Utils/GitTest.php @@ -99,7 +99,7 @@ public function testGetTrackedFilesNonGitDirectory(): void { Git::getTrackedFiles($temp_dir); } finally { - File::remove($temp_dir); + static::removeGitRepository($temp_dir); } } @@ -121,8 +121,8 @@ public function testGetTrackedFilesWithFiles(): void { try { $tracked = Git::getTrackedFiles($temp_dir); $this->assertCount(2, $tracked); - $this->assertContains($temp_dir . DIRECTORY_SEPARATOR . 'test.txt', $tracked); - $this->assertContains($temp_dir . DIRECTORY_SEPARATOR . 'another.txt', $tracked); + $this->assertContains($temp_dir . '/test.txt', $tracked); + $this->assertContains($temp_dir . '/another.txt', $tracked); } finally { $this->cleanupTempGitRepo($temp_dir); @@ -182,7 +182,7 @@ protected function createTempGitRepo(bool $with_remote = FALSE, bool $with_commi protected function cleanupTempGitRepo(string $temp_dir): void { if (File::isDir($temp_dir)) { - File::remove($temp_dir); + static::removeGitRepository($temp_dir); } } diff --git a/.vortex/installer/tests/Unit/Utils/InstallReportTest.php b/.vortex/installer/tests/Unit/Utils/InstallReportTest.php index ae4825a310..3375a87920 100644 --- a/.vortex/installer/tests/Unit/Utils/InstallReportTest.php +++ b/.vortex/installer/tests/Unit/Utils/InstallReportTest.php @@ -146,27 +146,27 @@ public function testWriteRendersReport(): void { $content = File::read($file); - $this->assertStringStartsWith('# Vortex installation report' . PHP_EOL, $content); - $this->assertStringContainsString('- **From:** 1.40.0' . PHP_EOL, $content); - $this->assertStringContainsString('- **To:** 1.41.0' . PHP_EOL, $content); - $this->assertStringContainsString('- **Date:** ' . date('Y-m-d H:i:s', self::TIMESTAMP) . PHP_EOL, $content); + $this->assertStringStartsWith('# Vortex installation report' . "\n", $content); + $this->assertStringContainsString('- **From:** 1.40.0' . "\n", $content); + $this->assertStringContainsString('- **To:** 1.41.0' . "\n", $content); + $this->assertStringContainsString('- **Date:** ' . date('Y-m-d H:i:s', self::TIMESTAMP) . "\n", $content); foreach (InstallReport::STATUSES as $status => $description) { $this->assertStringContainsString(sprintf('| `%s` | %s |', $status, $description), $content, 'Every status is described.'); } - $this->assertStringContainsString('| `unchanged` | 1 |' . PHP_EOL . '| `overwritten` | 1 |' . PHP_EOL . '| `removed` | 1 |' . PHP_EOL, $content); + $this->assertStringContainsString('| `unchanged` | 1 |' . "\n" . '| `overwritten` | 1 |' . "\n" . '| `removed` | 1 |' . "\n", $content); $expected_rows = [ '| `unchanged` | [composer.json](../composer.json) | |', sprintf('| `removed` | `jest.config.js` | [diff](%s/jest.config.js.diff) |', $name), sprintf('| `overwritten` | [phpstan.neon](../phpstan.neon) | [diff](%s/phpstan.neon.diff) |', $name), ]; - $this->assertStringContainsString(implode(PHP_EOL, $expected_rows) . PHP_EOL, $content, 'Rows are sorted by path and link to the file and its diff.'); + $this->assertStringContainsString(implode("\n", $expected_rows) . "\n", $content, 'Rows are sorted by path and link to the file and its diff.'); $diff_dir = self::$sut . '/.logs/' . $name; - $this->assertStringEqualsFile($diff_dir . '/phpstan.neon.diff', implode(PHP_EOL, ['--- a/phpstan.neon', '+++ b/phpstan.neon', '@@ -1 +1 @@', '-level: 8', '+level: 9']) . PHP_EOL); - $this->assertStringEqualsFile($diff_dir . '/jest.config.js.diff', implode(PHP_EOL, ['--- a/jest.config.js', '+++ /dev/null', '@@ -1 +1,0 @@', '-module.exports = {};']) . PHP_EOL); + $this->assertStringEqualsFile($diff_dir . '/phpstan.neon.diff', implode("\n", ['--- a/phpstan.neon', '+++ b/phpstan.neon', '@@ -1 +1 @@', '-level: 8', '+level: 9']) . "\n"); + $this->assertStringEqualsFile($diff_dir . '/jest.config.js.diff', implode("\n", ['--- a/jest.config.js', '+++ /dev/null', '@@ -1 +1,0 @@', '-module.exports = {};']) . "\n"); $this->assertFileDoesNotExist($diff_dir . '/composer.json.diff', 'An unchanged file has no diff.'); } diff --git a/.vortex/installer/tests/Unit/Utils/JsonManipulatorTest.php b/.vortex/installer/tests/Unit/Utils/JsonManipulatorTest.php index dc25c87daf..958bab2c37 100644 --- a/.vortex/installer/tests/Unit/Utils/JsonManipulatorTest.php +++ b/.vortex/installer/tests/Unit/Utils/JsonManipulatorTest.php @@ -64,6 +64,10 @@ public function testFromFileWithNonexistentFile(): void { } public function testFromFileWithNonReadableFile(): void { + if (PHP_OS_FAMILY === 'Windows') { + $this->markTestSkipped('Windows does not restrict reads by file mode.'); + } + $temp_file = $this->createTempJsonFile(self::SAMPLE_JSON); File::chmod($temp_file, 0000); diff --git a/.vortex/installer/tests/Unit/Utils/StringsTest.php b/.vortex/installer/tests/Unit/Utils/StringsTest.php index 53cb820945..f9119e3eaa 100644 --- a/.vortex/installer/tests/Unit/Utils/StringsTest.php +++ b/.vortex/installer/tests/Unit/Utils/StringsTest.php @@ -774,14 +774,14 @@ public static function dataProviderWrapLines(): \Iterator { "πŸ”Ή Hello δΈ–η•Œ ✨\nπŸ”Ή Goodbye 🌍 ✨", ]; yield 'complex_multiline_with_php_eol' => [ - " [ - "line one\nline two\nline three", + 'line one' . PHP_EOL . 'line two' . PHP_EOL . 'line three', '> ', ' <', '', diff --git a/.vortex/installer/tests/Unit/Utils/UpdateRegistryTest.php b/.vortex/installer/tests/Unit/Utils/UpdateRegistryTest.php index 8cbe95fa10..5bf9eaaceb 100644 --- a/.vortex/installer/tests/Unit/Utils/UpdateRegistryTest.php +++ b/.vortex/installer/tests/Unit/Utils/UpdateRegistryTest.php @@ -101,8 +101,8 @@ public function testWriteWidensFenceAroundContentWithFences(): void { $file = (string) $registry->write('1.40.0', '1.41.0', '2026-09-07 09:31:22'); $this->assertFileContainsString($file, '````diff', 'The fence outgrows the longest backtick run in the diff.'); - $this->assertFileContainsString($file, PHP_EOL . '````' . PHP_EOL, 'The closing fence matches the opening one.'); - $this->assertStringNotContainsString('```' . PHP_EOL . '```diff', File::read($file), 'No entry opens with a fence the diff can close.'); + $this->assertFileContainsString($file, "\n" . '````' . "\n", 'The closing fence matches the opening one.'); + $this->assertStringNotContainsString('```' . "\n" . '```diff', File::read($file), 'No entry opens with a fence the diff can close.'); } public function testWriteSortsEntriesByPath(): void { diff --git a/.vortex/tests/composer.json b/.vortex/tests/composer.json index 159bdc8773..c7632cbd4b 100644 --- a/.vortex/tests/composer.json +++ b/.vortex/tests/composer.json @@ -22,7 +22,7 @@ }, "require-dev": { "alexskrypnyk/file": "^1.4.1", - "alexskrypnyk/phpunit-helpers": "^1.2", + "alexskrypnyk/phpunit-helpers": "^1.2.1", "alexskrypnyk/shellvar": "^1.8.0", "czproject/git-php": "^4.6", "dealerdirect/phpcodesniffer-composer-installer": "^1.2.1", diff --git a/.vortex/tests/composer.lock b/.vortex/tests/composer.lock index 8013e8f1ba..95a09172d5 100644 --- a/.vortex/tests/composer.lock +++ b/.vortex/tests/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c67180048455021585a4dab0cda87e4a", + "content-hash": "f694636fdadbc4a68a6f0bd18b6010ca", "packages": [ { "name": "cweagans/composer-configurable-plugin", @@ -263,16 +263,16 @@ }, { "name": "alexskrypnyk/phpunit-helpers", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/AlexSkrypnyk/phpunit-helpers.git", - "reference": "ddb4f51c6265359b58a4b803668a4a1d3586a0e3" + "reference": "f100edfd38a98636b6c863d9ee9d2f4b0eb4841c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AlexSkrypnyk/phpunit-helpers/zipball/ddb4f51c6265359b58a4b803668a4a1d3586a0e3", - "reference": "ddb4f51c6265359b58a4b803668a4a1d3586a0e3", + "url": "https://api.github.com/repos/AlexSkrypnyk/phpunit-helpers/zipball/f100edfd38a98636b6c863d9ee9d2f4b0eb4841c", + "reference": "f100edfd38a98636b6c863d9ee9d2f4b0eb4841c", "shasum": "" }, "require": { @@ -286,11 +286,11 @@ "dealerdirect/phpcodesniffer-composer-installer": "^1.2.1", "drevops/phpcs-standard": "^0.7", "drupal/coder": "^9.0.1", - "ergebnis/composer-normalize": "^2.53.0", - "laravel/serializable-closure": "^2.0.16", + "ergebnis/composer-normalize": "^2.57.0", + "laravel/serializable-closure": "^2.2.0", "phpbench/phpbench": "^1.7", - "phpstan/phpstan": "^2.2.14", - "rector/rector": "^2.6.7", + "phpstan/phpstan": "^2.3.5", + "rector/rector": "^2.8.4", "squizlabs/php_codesniffer": "^4.0.4", "symfony/console": "^6.4 || ^7.2 || ^8.0" }, @@ -322,14 +322,10 @@ { "url": "https://github.com/alexskrypnyk", "type": "github" - }, - { - "url": "https://www.patreon.com/alexskrypnyk", - "type": "patreon" } ], - "time": "2026-09-21T02:30:10+00:00", - "published-time": "2026-09-21T02:31:42+00:00" + "time": "2026-11-13T10:04:52+00:00", + "published-time": "2026-11-13T10:05:49+00:00" }, { "name": "alexskrypnyk/shellvar",