Skip to content

Commit

Permalink
Try to add windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Feb 19, 2024
1 parent d267df9 commit 31daa98
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 4 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/test-os.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test OS

on:
push:
branches:
- main
pull_request:

jobs:
test-windows:
name: Windows
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
ini-file: development

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Run tests with PHPUnit
run: vendor/bin/phpunit

test-macos:
name: Mac OS
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
ini-file: development

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Run tests with PHPUnit
run: vendor/bin/phpunit
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }}
name: PHP ${{ matrix.runner }} + ${{ matrix.php-version }} + ${{ matrix.dependencies }}
runs-on: ubuntu-latest

env:
Expand All @@ -22,11 +22,12 @@ jobs:
- 8.2
- 8.3
dependencies: [highest]
runner: [ubuntu-latest]
symfony-require: ['']
include:
- php-version: 8.0
dependencies: lowest
- php-version: '8.2'
- php-version: 8.2
dependencies: highest
symfony-require: 7.0.*

Expand Down
10 changes: 8 additions & 2 deletions tests/File/FileHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function testGetFileName(
?string $expected,
): void {
static::assertSame($expected, FileHelper::getFileName($path, $baseDir, $ignoredDir));

$windowsPath = str_replace('/', '\\', $path);
static::assertSame($expected, FileHelper::getFileName($windowsPath, $baseDir, $ignoredDir));
}

/**
Expand Down Expand Up @@ -99,12 +102,15 @@ public static function getFileNameDataProvider(): iterable
* @dataProvider getDirectoriesDataProvider
*/
public function testGetDirectories(
string $absolutePath,
string $path,
?string $baseDir,
array $ignoredDir,
array $expected,
): void {
static::assertSame($expected, FileHelper::getDirectories($absolutePath, $baseDir, $ignoredDir, __DIR__));
static::assertSame($expected, FileHelper::getDirectories($path, $baseDir, $ignoredDir, __DIR__));

$windowsPath = str_replace('/', '\\', $path);
static::assertSame($expected, FileHelper::getDirectories($windowsPath, $baseDir, $ignoredDir, __DIR__));
}

/**
Expand Down

0 comments on commit 31daa98

Please sign in to comment.