Skip to content

Commit

Permalink
bug #111 add appveyor configuration (Jan Christoph Beyer)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 1.x-dev branch.

Discussion
----------

add appveyor configuration

#110

This is an inital appveyor config using php 7.4. Feedback is welcome.

Commits
-------

82253f2 * fix os related tests
e066d67 * add appveyor configuration
  • Loading branch information
ogizanagi committed Nov 11, 2020
2 parents 089b783 + 82253f2 commit 49cece6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
22 changes: 22 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
build: false
platform: x86
clone_folder: c:\projects\elao\php-enums

install:
- ps: Set-Service wuauserv -StartupType Manual
- cinst -y php composer
- refreshenv
- cd c:\tools\php74
- copy php.ini-production php.ini /Y
- echo extension_dir=ext >> php.ini
- echo extension=php_openssl.dll >> php.ini
- echo extension=php_intl.dll >> php.ini
- echo extension=php_mbstring.dll >> php.ini
- echo extension=php_pdo_sqlite.dll >> php.ini
- echo memory_limit=-1 >> php.ini
- cd %APPVEYOR_BUILD_FOLDER%
- composer install --no-progress --no-interaction

test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- vendor\bin\simple-phpunit.bat
13 changes: 6 additions & 7 deletions src/Bridge/Symfony/Translation/Extractor/EnumExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Elao\Enum\ReadableEnum;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\Glob;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Translation\Extractor\ExtractorInterface;
use Symfony\Component\Translation\MessageCatalogue;
Expand Down Expand Up @@ -82,14 +83,12 @@ public function extract($resource, MessageCatalogue $catalog)
// Normalize namespace.
$namespace = rtrim($namespace, '\\') . '\\';

/** @var SplFileInfo $file */
foreach ($finder->files()->name($this->fileNamePattern)->in($dir) as $file) {
foreach ($this->ignore as $ignore) {
if (fnmatch($ignore, $file->getPathname())) {
continue 2;
}
}
foreach ($this->ignore as $ignore) {
$finder->notPath(Glob::toRegex(str_replace(rtrim($dir, '\\/') . '/', '', $ignore)));
}

/** @var SplFileInfo $file */
foreach ($finder->in($dir)->files()->name($this->fileNamePattern) as $file) {
// Get file pathinfo and clear dirname.
$path = pathinfo($file->getRelativePathname());
if ($path['dirname'] === '.') {
Expand Down
2 changes: 1 addition & 1 deletion src/JsDumper/JsDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,6 @@ public function normalizePath(string $path): string
return $path;
}

return rtrim($this->baseDir, DIRECTORY_SEPARATOR) . '/' . $path;
return rtrim($this->baseDir, '\\/') . '/' . $path;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function invalidDataProvider()
],
[
[],
'Enum "Elao\Enum\Tests\Fixtures\Enum\Permissions" does not accept value array (' . PHP_EOL . ')',
'Enum "Elao\Enum\Tests\Fixtures\Enum\Permissions" does not accept value array (' . "\n" . ')',
],
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testGenerateTranslations()

$this->assertEquals(
[
'trans_readable_enum' => ['sources' => [__DIR__ . '/Enum/ReadableEnum.php:readable_enum']],
'trans_readable_enum' => ['sources' => [str_replace(\DIRECTORY_SEPARATOR, '/', __DIR__) . '/Enum/ReadableEnum.php:readable_enum']],
],
$catalog->getMetadata('', 'messages_test')
);
Expand Down

0 comments on commit 49cece6

Please sign in to comment.