Skip to content

Commit 8da0139

Browse files
authored
Merge pull request #87 from rmariuzzo/feature/laravel-5-4-support
Add test for Laravel 5.4 + minor updates.
2 parents 47e82f4 + 8cf1a2a commit 8da0139

File tree

8 files changed

+114
-6
lines changed

8 files changed

+114
-6
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
> 🌐 Laravel Localization in JavaScript.
44
5+
![Laravel 5.4](https://img.shields.io/badge/Laravel-5.4-f4645f.svg)
56
![Laravel 5.3](https://img.shields.io/badge/Laravel-5.3-f4645f.svg)
67
![Laravel 5.2](https://img.shields.io/badge/Laravel-5.2-f4645f.svg)
78
![Laravel 5.1](https://img.shields.io/badge/Laravel-5.1-f4645f.svg)
@@ -16,10 +17,10 @@ This package convert all your localization messages from your Laravel app to Jav
1617

1718
### Features
1819

19-
- Support Laravel 4.2.x, Laravel 5.0.x, Laravel 5.1.x, Laravel 5.2.x and Laravel 5.3.x.
20-
- Includes [Lang.js](https://github.com/rmariuzzo/lang.js) (a thin library highly inspired on Laravel's [`Translator`](https://laravel.com/api/5.3/Illuminate/Translation/Translator.html) class).
20+
- Support Laravel 4.2, 5.0, 5.1, 5.2, 5.3 and 5.4.
21+
- Includes [Lang.js](https://github.com/rmariuzzo/lang.js) (a thin library highly inspired on Laravel's [`Translator`](https://laravel.com/api/5.4/Illuminate/Translation/Translator.html) class).
2122
- Allow to specify desired lang files to be converted to JS.
22-
- Lang.js API is based on Laravel's [`Translator`](https://laravel.com/api/5.3/Illuminate/Translation/Translator.html) class. No need to learn a whole API.
23+
- Lang.js API is based on Laravel's [`Translator`](https://laravel.com/api/5.4/Illuminate/Translation/Translator.html) class. No need to learn a whole API.
2324

2425
## Installation
2526

@@ -35,7 +36,7 @@ Mariuzzo\LaravelJsLocalization\LaravelJsLocalizationServiceProvider::class
3536

3637
## Usage
3738

38-
The `Laravel-JS-Localization` package provides a command that generate the JavaScript version of all your messages found at: `app/lang` (Laravel 4) or `resources/lang` (Laravel 5) directory. The resulting JavaScript file will contains all your messages plus [Lang.js](https://github.com/rmariuzzo/lang.js) (a thin library highly inspired on Laravel's [`Translator`](https://laravel.com/api/5.3/Illuminate/Translation/Translator.html) class).
39+
The `Laravel-JS-Localization` package provides a command that generate the JavaScript version of all your messages found at: `app/lang` (Laravel 4) or `resources/lang` (Laravel 5) directory. The resulting JavaScript file will contains all your messages plus [Lang.js](https://github.com/rmariuzzo/lang.js) (a thin library highly inspired on Laravel's [`Translator`](https://laravel.com/api/5.4/Illuminate/Translation/Translator.html) class).
3940

4041
### Generating JS messages
4142

composer.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@
5959
"composer install --prefer-dist --no-interaction --working-dir tests/5.0",
6060
"composer install --prefer-dist --no-interaction --working-dir tests/5.1",
6161
"composer install --prefer-dist --no-interaction --working-dir tests/5.2",
62-
"if [[ `php -v` =~ \"PHP 5.6\" ]]; then composer install --prefer-dist --no-interaction --working-dir tests/5.3; fi"
62+
"./tests/5.3/install",
63+
"./tests/5.4/install"
6364
],
6465
"test": [
6566
"./vendor/bin/phpunit --configuration tests/4.2",
6667
"./vendor/bin/phpunit --configuration tests/5.0",
6768
"./vendor/bin/phpunit --configuration tests/5.1",
6869
"./vendor/bin/phpunit --configuration tests/5.2",
69-
"if [[ `php -v` =~ \"PHP 5.6\" ]]; then ./vendor/bin/phpunit --configuration tests/5.3; fi"
70+
"./tests/5.3/run",
71+
"./tests/5.4/run"
7072
]
7173
}
7274
}

tests/5.3/install

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Get current script directory.
4+
CWD=`dirname $0`
5+
6+
# Get PHP version.
7+
PHP_VERSION=`php -v`
8+
9+
# Install dependencies if PHP version is 5.6, 7.0 or HHVM.
10+
if [[ $PHP_VERSION =~ "PHP 5.6" || $PHP_VERSION =~ "PHP 7.0" || $PHP_VERSION =~ "HHVM" ]] ; then
11+
echo "Current working directory is: $CWD"
12+
echo "PHP version is: $PHP_VERSION"
13+
composer install --prefer-dist --no-interaction --working-dir "$CWD"
14+
else
15+
echo "No installing dependencies for PHP version: $PHP_VERSION"
16+
fi

tests/5.3/run

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Get current script directory.
4+
CWD=`dirname $0`
5+
6+
# Get PHP version.
7+
PHP_VERSION=`php -v`
8+
9+
# Run if PHP version is 5.6, 7.0 or HHVM.
10+
if [[ $PHP_VERSION =~ "PHP 5.6" || $PHP_VERSION =~ "PHP 7.0" || $PHP_VERSION =~ "HHVM" ]] ; then
11+
echo "Current working directory is: $CWD"
12+
echo "PHP version is: $PHP_VERSION"
13+
"$CWD"/../../vendor/bin/phpunit --configuration "$CWD"
14+
else
15+
echo "No running tests for PHP version: $PHP_VERSION"
16+
fi

tests/5.4/composer.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"autoload": {
3+
"psr-4": {
4+
"Mariuzzo\\LaravelJsLocalization\\": "../../src/Mariuzzo/LaravelJsLocalization/"
5+
}
6+
},
7+
"require": {
8+
"php": ">=5.5.9",
9+
"illuminate/console": "5.4.*",
10+
"illuminate/filesystem": "5.4.*",
11+
"tedivm/jshrink": "1.0.*"
12+
},
13+
"require-dev": {
14+
"orchestra/testbench": "3.4.*",
15+
"phpunit/phpunit": "~5.7"
16+
},
17+
"minimum-stability": "dev"
18+
}

tests/5.4/install

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Get current script directory.
4+
CWD=`dirname $0`
5+
6+
# Get PHP version.
7+
PHP_VERSION=`php -v`
8+
9+
# Install dependencies if PHP version is 5.6, 7.0 or HHVM.
10+
if [[ $PHP_VERSION =~ "PHP 5.6" || $PHP_VERSION =~ "PHP 7.0" || $PHP_VERSION =~ "HHVM" ]] ; then
11+
echo "Current working directory is: $CWD"
12+
echo "PHP version is: $PHP_VERSION"
13+
composer install --prefer-dist --no-interaction --working-dir "$CWD"
14+
else
15+
echo "No installing dependencies for PHP version: $PHP_VERSION"
16+
fi

tests/5.4/phpunit.xml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
bootstrap="vendor/autoload.php"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false"
12+
syntaxCheck="false">
13+
<testsuites>
14+
<testsuite name="Package">
15+
<directory suffix="Test.php">../specs/</directory>
16+
</testsuite>
17+
</testsuites>
18+
<filter>
19+
<whitelist>
20+
<directory suffix=".php">./src/</directory>
21+
</whitelist>
22+
</filter>
23+
</phpunit>

tests/5.4/run

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
# Get current script directory.
4+
CWD=`dirname $0`
5+
echo "Current working directory is: $CWD"
6+
7+
# Get PHP version.
8+
PHP_VERSION=`php -v`
9+
echo "PHP version is: $PHP_VERSION"
10+
11+
# Run if PHP version is 5.6, 7.0 or HHVM.
12+
if [[ $PHP_VERSION =~ "PHP 5.6" || $PHP_VERSION =~ "PHP 7.0" || $PHP_VERSION =~ "HHVM" ]] ; then
13+
"$CWD"/vendor/bin/phpunit --configuration "$CWD"
14+
else
15+
echo "No running tests for PHP version: $PHP_VERSION"
16+
fi

0 commit comments

Comments
 (0)