Skip to content

Commit

Permalink
Merge pull request #35 from ARCANEDEV/update-laravel_7.x_support
Browse files Browse the repository at this point in the history
Updating the package to support Laravel 7
  • Loading branch information
arcanedev-maroc committed Mar 21, 2020
2 parents 7e3048f + bf18b4e commit 8b1711a
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 54 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2019 | ARCANEDEV <arcanedev.maroc@gmail.com> - LaravelLang
Copyright (c) 2015-2020 | ARCANEDEV <arcanedev.maroc@gmail.com> - LaravelLang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -21,7 +21,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/LaravelLang/r
* Easy setup &amp; configuration.
* Missing translations Checker.
* Translations Publisher.
* Laravel `5.x | 6.x` are supported.
* Laravel `5.x` to `7.x` are supported.
* Well documented &amp; IDE Friendly.
* Well tested with maximum code quality.
* Made with :heart: &amp; :coffee:.
Expand Down Expand Up @@ -50,7 +50,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
- [All Contributors][link-contributors]

[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-lang.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-From%205.x%20|%206.x-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.x%20to%207.x-orange.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LaravelLang/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelLang.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/LaravelLang.svg?style=flat-square
Expand Down
2 changes: 1 addition & 1 deletion _docs/0-Home.md
Expand Up @@ -7,7 +7,7 @@ Translations manager and checker for Laravel based on [caouecs/Laravel-lang](htt
* Easy setup &amp; configuration.
* Missing translations Checker.
* Translations Publisher.
* Laravel `5.0 | 6.x` are supported.
* Laravel `5.x` to `7.x` are supported.
* Well documented &amp; IDE Friendly.
* Well tested with maximum code quality.
* Made with :heart: &amp; :coffee:.
Expand Down
45 changes: 24 additions & 21 deletions _docs/1-Installation-and-Setup.md
Expand Up @@ -10,32 +10,35 @@

| LaravelLang | Laravel |
|:---------------------------------------|:-------------------------------------------------------------------------------------------------------------------|
| ![LaravelLang v1.x][laravel_lang_1_x] | ![Laravel v5.0][laravel_5_0] ![Laravel v5.1][laravel_5_1] ![Laravel v5.2][laravel_5_2] ![Laravel v5.3][laravel_5_3] |
| ![LaravelLang v2.x][laravel_lang_2_x] | ![Laravel v5.4][laravel_5_4] |
| ![LaravelLang v3.x][laravel_lang_3_x] | ![Laravel v5.5][laravel_5_5] |
| ![LaravelLang v4.x][laravel_lang_4_x] | ![Laravel v5.6][laravel_5_6] |
| ![LaravelLang v5.x][laravel_lang_5_x] | ![Laravel v5.7][laravel_5_7] |
| ![LaravelLang v6.x][laravel_lang_6_x] | ![Laravel v5.8][laravel_5_8] |
| ![LaravelLang v8.x][laravel_lang_8_x] | ![Laravel v7.x][laravel_7_x] |
| ![LaravelLang v7.x][laravel_lang_7_x] | ![Laravel v6.x][laravel_6_x] |
| ![LaravelLang v6.x][laravel_lang_6_x] | ![Laravel v5.8][laravel_5_8] |
| ![LaravelLang v5.x][laravel_lang_5_x] | ![Laravel v5.7][laravel_5_7] |
| ![LaravelLang v4.x][laravel_lang_4_x] | ![Laravel v5.6][laravel_5_6] |
| ![LaravelLang v3.x][laravel_lang_3_x] | ![Laravel v5.5][laravel_5_5] |
| ![LaravelLang v2.x][laravel_lang_2_x] | ![Laravel v5.4][laravel_5_4] |
| ![LaravelLang v1.x][laravel_lang_1_x] | ![Laravel v5.0][laravel_5_0] ![Laravel v5.1][laravel_5_1] ![Laravel v5.2][laravel_5_2] ![Laravel v5.3][laravel_5_3] |

[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
[laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2"
[laravel_5_3]: https://img.shields.io/badge/v5.3-supported-brightgreen.svg?style=flat-square "Laravel v5.3"
[laravel_5_4]: https://img.shields.io/badge/v5.4-supported-brightgreen.svg?style=flat-square "Laravel v5.4"
[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8"
[laravel_7_x]: https://img.shields.io/badge/v7.x-supported-brightgreen.svg?style=flat-square "Laravel v7.x"
[laravel_6_x]: https://img.shields.io/badge/v6.x-supported-brightgreen.svg?style=flat-square "Laravel v6.x"
[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8"
[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"
[laravel_5_4]: https://img.shields.io/badge/v5.4-supported-brightgreen.svg?style=flat-square "Laravel v5.4"
[laravel_5_3]: https://img.shields.io/badge/v5.3-supported-brightgreen.svg?style=flat-square "Laravel v5.3"
[laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2"
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"

[laravel_lang_1_x]: https://img.shields.io/badge/version-1.x-blue.svg?style=flat-square "LaravelLang v1.x"
[laravel_lang_2_x]: https://img.shields.io/badge/version-2.x-blue.svg?style=flat-square "LaravelLang v2.x"
[laravel_lang_3_x]: https://img.shields.io/badge/version-3.x-blue.svg?style=flat-square "LaravelLang v3.x"
[laravel_lang_4_x]: https://img.shields.io/badge/version-4.x-blue.svg?style=flat-square "LaravelLang v4.x"
[laravel_lang_5_x]: https://img.shields.io/badge/version-5.x-blue.svg?style=flat-square "LaravelLang v5.x"
[laravel_lang_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "LaravelLang v6.x"
[laravel_lang_8_x]: https://img.shields.io/badge/version-8.x-blue.svg?style=flat-square "LaravelLang v8.x"
[laravel_lang_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "LaravelLang v7.x"
[laravel_lang_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "LaravelLang v6.x"
[laravel_lang_5_x]: https://img.shields.io/badge/version-5.x-blue.svg?style=flat-square "LaravelLang v5.x"
[laravel_lang_4_x]: https://img.shields.io/badge/version-4.x-blue.svg?style=flat-square "LaravelLang v4.x"
[laravel_lang_3_x]: https://img.shields.io/badge/version-3.x-blue.svg?style=flat-square "LaravelLang v3.x"
[laravel_lang_2_x]: https://img.shields.io/badge/version-2.x-blue.svg?style=flat-square "LaravelLang v2.x"
[laravel_lang_1_x]: https://img.shields.io/badge/version-1.x-blue.svg?style=flat-square "LaravelLang v1.x"

## Composer

Expand Down
11 changes: 5 additions & 6 deletions composer.json
Expand Up @@ -16,14 +16,13 @@
"type": "library",
"license": "MIT",
"require": {
"php": ">=7.2.0",
"arcanedev/support": "^5.1",
"caouecs/laravel-lang": "^4.0.9"
"php": "^7.2.5",
"arcanedev/support": "^7.1.2",
"caouecs/laravel-lang": "^6.0"
},
"require-dev": {
"orchestra/testbench": "^4.0",
"phpunit/phpcov": "^6.0",
"phpunit/phpunit": "^8.0",
"orchestra/testbench": "^5.0",
"phpunit/phpunit": "^8.5|^9.0",
"mockery/mockery": "^1.3.1"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/AbstractCommand.php
Expand Up @@ -5,7 +5,7 @@
namespace Arcanedev\LaravelLang\Commands;

use Arcanedev\LaravelLang\LaravelLang;
use Arcanedev\Support\Bases\Command as BaseCommand;
use Arcanedev\Support\Console\Command as BaseCommand;

/**
* Class Command
Expand Down
2 changes: 1 addition & 1 deletion src/LaravelLang.php
Expand Up @@ -17,5 +17,5 @@ class LaravelLang
| -----------------------------------------------------------------
*/

const VERSION = '7.1.0';
const VERSION = '8.0.0';
}
2 changes: 1 addition & 1 deletion src/TransManager.php
Expand Up @@ -137,7 +137,7 @@ private function loadLocaleFiles(string $path): array
foreach ($this->filesystem->allFiles($path) as $file) {
/** @var \Symfony\Component\Finder\SplFileInfo $file */
$key = str_replace(
['.php', DS], ['', '.'], $file->getRelativePathname()
['.php', DIRECTORY_SEPARATOR], ['', '.'], $file->getRelativePathname()
);

$files[$key] = [
Expand Down
2 changes: 1 addition & 1 deletion src/TransPublisher.php
Expand Up @@ -93,7 +93,7 @@ private function init(): void
*/
private function getDestinationPath(string $locale): string
{
return $this->langPath.DS.$locale;
return $this->langPath.DIRECTORY_SEPARATOR.$locale;
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/TestCase.php
Expand Up @@ -26,10 +26,10 @@ abstract class TestCase extends BaseTestCase
*/
protected $locales = [
'ar', 'az', 'be', 'bg', 'bn', 'bs', 'ca', 'cs', 'cy', 'da', 'de', 'de-CH', 'el', 'es', 'et', 'eu', 'fa', 'fi',
'fil', 'fr', 'gl', 'he', 'hi', 'hr', 'hu', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'lt', 'lv',
'me', 'mk', 'mn', 'mr', 'ms', 'nb', 'ne', 'nl', 'nn', 'pl', 'ps', 'pt', 'pt-BR', 'ro', 'ru', 'sc', 'si', 'sk',
'sl', 'sq', 'sr', 'sv', 'sw', 'tg', 'th', 'tk', 'tl', 'tr', 'ug', 'uk', 'ur', 'uz-cyrillic', 'uz-latin', 'vi',
'zh-CN', 'zh-HK', 'zh-TW',
'fil', 'fr', 'gl', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'kn', 'ko', 'lt',
'lv', 'me', 'mk', 'mn', 'mr', 'ms', 'nb', 'ne', 'nl', 'nn', 'pl', 'ps', 'pt', 'pt-BR', 'ro', 'ru', 'sc', 'si',
'sk', 'sl', 'sq', 'sr', 'sv', 'sw', 'tg', 'th', 'tk', 'tl', 'tr', 'ug', 'uk', 'ur', 'uz-cyrillic', 'uz-latin',
'vi', 'zh-CN', 'zh-HK', 'zh-TW',
];

/* -----------------------------------------------------------------
Expand Down Expand Up @@ -96,7 +96,7 @@ private function copyLanguagesFixtures($app)
$filesystem = $app['files'];

$filesystem->copyDirectory(
realpath(__DIR__.DS.'fixtures'.DS.'lang'),
realpath(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'lang'),
realpath(resource_path('lang'))
);
}
Expand All @@ -121,7 +121,7 @@ protected function filesystem()
protected function cleanLangDirectory(string $locale): bool
{
return $this->filesystem()
->cleanDirectory($this->app->langPath().DS.$locale);
->cleanDirectory($this->app->langPath().DIRECTORY_SEPARATOR.$locale);
}

/**
Expand All @@ -134,7 +134,7 @@ protected function cleanLangDirectory(string $locale): bool
protected function deleteLangDirectory(string $locale): bool
{
return $this->filesystem()
->deleteDirectory($this->app->langPath().DS.$locale);
->deleteDirectory($this->app->langPath().DIRECTORY_SEPARATOR.$locale);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions tests/TransCheckerTest.php
Expand Up @@ -4,6 +4,8 @@

namespace Arcanedev\LaravelLang\Tests;

use Arcanedev\LaravelLang\Contracts\TransChecker;

/**
* Class TransCheckerTest
*
Expand All @@ -29,7 +31,7 @@ public function setUp(): void
{
parent::setUp();

$this->checker = $this->app[\Arcanedev\LaravelLang\Contracts\TransChecker::class];
$this->checker = $this->app->make(TransChecker::class);
}

public function tearDown(): void
Expand All @@ -48,7 +50,7 @@ public function tearDown(): void
public function it_can_be_instantiated(): void
{
$expectations = [
\Arcanedev\LaravelLang\Contracts\TransChecker::class,
TransChecker::class,
\Arcanedev\LaravelLang\TransChecker::class,
];

Expand Down
15 changes: 11 additions & 4 deletions tests/TransManagerTest.php
@@ -1,4 +1,10 @@
<?php namespace Arcanedev\LaravelLang\Tests;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelLang\Tests;

use Arcanedev\LaravelLang\Contracts\TransManager;

/**
* Class TransManagerTest
Expand All @@ -25,7 +31,7 @@ public function setUp(): void
{
parent::setUp();

$this->manager = $this->app[\Arcanedev\LaravelLang\Contracts\TransManager::class];
$this->manager = $this->app->make(TransManager::class);
}

public function tearDown(): void
Expand All @@ -44,7 +50,7 @@ public function tearDown(): void
public function it_can_be_instantiated(): void
{
$expectations = [
\Arcanedev\LaravelLang\Contracts\TransManager::class,
TransManager::class,
\Arcanedev\LaravelLang\TransManager::class,
];

Expand All @@ -53,7 +59,8 @@ public function it_can_be_instantiated(): void
}

$paths = $this->manager->getPaths();
static::assertCount(2, $this->manager->getPaths());

static::assertCount(2, $paths);
static::assertArrayHasKey('app', $paths);
static::assertArrayHasKey('vendor', $paths);
}
Expand Down
6 changes: 4 additions & 2 deletions tests/TransPublisherTest.php
Expand Up @@ -4,6 +4,8 @@

namespace Arcanedev\LaravelLang\Tests;

use Arcanedev\LaravelLang\Contracts\TransPublisher;

/**
* Class TransPublisherTest
*
Expand All @@ -29,7 +31,7 @@ public function setUp(): void
{
parent::setUp();

$this->publisher = $this->app->make(\Arcanedev\LaravelLang\Contracts\TransPublisher::class);
$this->publisher = $this->app->make(TransPublisher::class);
}

public function tearDown(): void
Expand All @@ -48,7 +50,7 @@ public function tearDown(): void
public function it_can_be_instantiated(): void
{
$expectations = [
\Arcanedev\LaravelLang\Contracts\TransPublisher::class,
TransPublisher::class,
\Arcanedev\LaravelLang\TransPublisher::class,
];

Expand Down
2 changes: 1 addition & 1 deletion tests/TranslatorTest.php
Expand Up @@ -31,7 +31,7 @@ public function setUp(): void
{
parent::setUp();

$this->translator = $this->app['translator'];
$this->translator = $this->app->make('translator');
}

public function tearDown(): void
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/lang/en/passwords.php
Expand Up @@ -13,11 +13,10 @@
|
*/

'password' => 'Passwords must be at least eight characters and match the confirmation.',
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'sent' => 'We have emailed your password reset link!',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
'user' => "We can't find a user with that email address.",

];

0 comments on commit 8b1711a

Please sign in to comment.