forked from leomarquine/php-etl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5 Add-CI + fix test to be able to support difference between PHP 7.2 …
…and 7.3 (leomarquine#33) * 5-add-ci * Test * Fix test
- Loading branch information
Showing
7 changed files
with
197 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
version: '2.1' | ||
executors: | ||
php7-2: | ||
docker: | ||
- image: php:7.2-alpine | ||
working_directory: ~/repo | ||
php7-3: | ||
docker: | ||
- image: php:7.3-alpine | ||
working_directory: ~/repo | ||
php7-4: | ||
docker: | ||
- image: php:7.4-alpine | ||
working_directory: ~/repo | ||
|
||
jobs: | ||
# The complete list : all in the minimum PHP version supported. | ||
composer7-2: | ||
executor: php7-2 | ||
steps: | ||
- run: | ||
name: Install alpine requirements for checkout | ||
command: apk add git openssh-client curl | ||
- checkout | ||
- restore_cache: | ||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }} | ||
- run: | ||
name: composer | ||
command: | | ||
if [[ ! -f vendor/autoload.php ]]; then | ||
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \ | ||
chmod +x /usr/bin/composer; \ | ||
composer install --no-progress --no-interaction; \ | ||
fi | ||
- save_cache: | ||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }} | ||
paths: | ||
- ./vendor | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- vendor | ||
|
||
phpcs7-2: | ||
executor: php7-2 | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: phpcs | ||
command: vendor/bin/phpcs | ||
|
||
phpcsfixer7-2: | ||
executor: php7-2 | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: phpcsfixer | ||
command: vendor/bin/php-cs-fixer fix --dry-run --allow-risky=yes | ||
|
||
phpstan7-2: | ||
executor: php7-2 | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: phpstan | ||
command: vendor/bin/phpstan analyse | ||
|
||
phpunit7-2: | ||
executor: php7-2 | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: phpunit | ||
command: vendor/bin/phpunit --testdox | ||
|
||
# Now we repeat the basics for each PHP version. Composer + PHPUNIT | ||
composer7-3: | ||
executor: php7-3 | ||
steps: | ||
- run: | ||
name: Install alpine requirements for checkout | ||
command: apk add git openssh-client curl | ||
- checkout | ||
- restore_cache: | ||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }} | ||
- run: | ||
name: composer | ||
command: | | ||
if [[ ! -f vendor/autoload.php ]]; then | ||
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \ | ||
chmod +x /usr/bin/composer; \ | ||
composer install --no-progress --no-interaction; \ | ||
fi | ||
- save_cache: | ||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }} | ||
paths: | ||
- ./vendor | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- vendor | ||
|
||
phpunit7-3: | ||
executor: php7-3 | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: phpunit | ||
command: vendor/bin/phpunit --testdox | ||
|
||
composer7-4: | ||
executor: php7-4 | ||
steps: | ||
- run: | ||
name: Install alpine requirements for checkout | ||
command: apk add git openssh-client curl | ||
- checkout | ||
- restore_cache: | ||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }} | ||
- run: | ||
name: composer | ||
command: | | ||
if [[ ! -f vendor/autoload.php ]]; then | ||
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \ | ||
chmod +x /usr/bin/composer; \ | ||
composer install --no-progress --no-interaction; \ | ||
fi | ||
- save_cache: | ||
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }} | ||
paths: | ||
- ./vendor | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- vendor | ||
|
||
phpunit7-4: | ||
executor: php7-4 | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
at: . | ||
- run: | ||
name: phpunit | ||
command: vendor/bin/phpunit --testdox | ||
|
||
workflows: | ||
version: '2.1' | ||
Code quality: | ||
jobs: | ||
- composer7-2 | ||
- composer7-3 | ||
- composer7-4 | ||
- phpcs7-2: | ||
requires: | ||
- composer7-2 | ||
- phpcsfixer7-2: | ||
requires: | ||
- composer7-2 | ||
- phpstan7-2: | ||
requires: | ||
- composer7-2 | ||
- phpunit7-2: | ||
requires: | ||
- composer7-2 | ||
- phpunit7-3: | ||
requires: | ||
- composer7-3 | ||
- phpunit7-4: | ||
requires: | ||
- composer7-4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
/** | ||
* @author Wizacha DevTeam <[email protected]> | ||
* @copyright Copyright (c) Wizacha | ||
* @copyright Copyright (c) Leonardo Marquine | ||
* @license MIT | ||
*/ | ||
|
||
|
@@ -17,7 +16,7 @@ trait FilePathTrait | |
{ | ||
/** | ||
* Check if path dirname exist, | ||
* recursivly create dir path if not | ||
* recursively create dir path if not | ||
* | ||
* @throws IoException | ||
*/ | ||
|
@@ -31,10 +30,7 @@ protected function checkOrCreateDir(string $fileUri): bool | |
|
||
$isCreated = @\mkdir($dirName, 0755, true); | ||
if (false === $isCreated) { | ||
throw new IoException( | ||
"Cannot create path: $dirName", | ||
1 | ||
); | ||
throw new IoException("Cannot create path: $dirName", 1); | ||
} | ||
|
||
return $isCreated; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,10 +66,18 @@ public function uppercase() | |
/** @test */ | ||
public function titlecase() | ||
{ | ||
$expected = [ | ||
new Row(['id' => '1', 'name' => 'Jane Doe', 'email' => '[email protected]']), | ||
new Row(['id' => '2', 'name' => 'John Doe', 'email' => '[email protected]']), | ||
]; | ||
// @see https://www.php.net/manual/en/migration73.new-features.php | ||
if (phpversion() < 7.3) { | ||
$expected = [ | ||
new Row(['id' => '1', 'name' => 'Jane Doe', 'email' => '[email protected]']), | ||
new Row(['id' => '2', 'name' => 'John Doe', 'email' => '[email protected]']), | ||
]; | ||
} else { | ||
$expected = [ | ||
new Row(['id' => '1', 'name' => 'Jane Doe', 'email' => '[email protected]']), | ||
new Row(['id' => '2', 'name' => 'John Doe', 'email' => '[email protected]']), | ||
]; | ||
} | ||
|
||
$transformer = new ConvertCase(); | ||
|
||
|