Skip to content

Commit

Permalink
Merge pull request #141 from ARCANEDEV/update-laravel_5.8
Browse files Browse the repository at this point in the history
Adding laravel 5.8 support
  • Loading branch information
arcanedev-maroc authored Mar 4, 2019
2 parents de77949 + 606eb61 commit 185532f
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 58 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Localization/
### Features

* Easy setup & configuration.
* Laravel `5.0` to `5.7` are supported.
* Laravel `5.0` to `5.8` are supported.
* SEO-Friendly (Search engine optimization).
* New extended Router to manage your localized routes.
* Translated Eloquent Models.
Expand Down
2 changes: 1 addition & 1 deletion _docs/0-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feel free to check out the [Releases](https://github.com/ARCANEDEV/Localization/
### Features

* Easy setup & configuration.
* Laravel `5.0` to `5.7` are supported.
* Laravel `5.0` to `5.8` are supported.
* SEO-Friendly (Search engine optimization).
* New extended Router to manage your localized routes.
* Locales selector menu (Publishable & Customizable).
Expand Down
3 changes: 3 additions & 0 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PHP extensions:
| ![Localization v2.x][localization_2_x] | ![Laravel v5.5][laravel_5_5] |
| ![Localization v3.x][localization_3_x] | ![Laravel v5.6][laravel_5_6] |
| ![Localization v4.x][localization_4_x] | ![Laravel v5.7][laravel_5_7] |
| ![Localization v5.x][localization_5_x] | ![Laravel v5.8][laravel_5_8] |

[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"
Expand All @@ -37,12 +38,14 @@ PHP extensions:
[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"

[localization_0_x]: https://img.shields.io/badge/version-0.*-blue.svg?style=flat-square "Localization v0.*"
[localization_1_x]: https://img.shields.io/badge/version-1.*-blue.svg?style=flat-square "Localization v1.*"
[localization_2_x]: https://img.shields.io/badge/version-2.*-blue.svg?style=flat-square "Localization v2.*"
[localization_3_x]: https://img.shields.io/badge/version-3.*-blue.svg?style=flat-square "Localization v3.*"
[localization_4_x]: https://img.shields.io/badge/version-4.*-blue.svg?style=flat-square "Localization v4.*"
[localization_5_x]: https://img.shields.io/badge/version-5.*-blue.svg?style=flat-square "Localization v5.*"

## Composer

Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"require": {
"php": ">=7.1.3",
"ext-json": "*",
"arcanedev/support": "~4.4.0"
"arcanedev/support": "~4.5.0"
},
"require-dev": {
"orchestra/testbench": "~3.7.0",
"orchestra/testbench": "~3.8.0",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0",
"phpunit/phpcov": "~5.0"
"phpunit/phpcov": "~5.0|~6.0",
"phpunit/phpunit": "~7.0|~8.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions tests/Entities/LocaleCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ class LocaleCollectionTest extends TestCase
| -----------------------------------------------------------------
*/

public function setUp()
public function setUp(): void
{
parent::setUp();

$this->locales = new LocaleCollection;
}

public function tearDown()
public function tearDown(): void
{
unset($this->locales);

Expand Down
4 changes: 2 additions & 2 deletions tests/Entities/LocaleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LocaleTest extends TestCase
| -----------------------------------------------------------------
*/

public function tearDown()
public function tearDown(): void
{
unset($this->locale);

Expand Down Expand Up @@ -80,7 +80,7 @@ public function it_can_convert_entity_to_array()
{
$this->locale = $this->makeLocale('en');

static::assertInternalType('array', $this->locale->toArray());
static::assertIsArray($this->locale->toArray());
}

/** @test */
Expand Down
4 changes: 2 additions & 2 deletions tests/LocalizationServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class LocalizationServiceProviderTest extends TestCase
| -----------------------------------------------------------------
*/

public function setUp()
public function setUp(): void
{
parent::setUp();

$this->provider = $this->app->getProvider(LocalizationServiceProvider::class);
}

public function tearDown()
public function tearDown(): void
{
unset($this->provider);

Expand Down
38 changes: 16 additions & 22 deletions tests/LocalizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ public function it_can_be_instantiated()
static::assertInstanceOf(Localization::class, localization());
}

/**
* @test
*
* @expectedException \Arcanedev\Localization\Exceptions\UnsupportedLocaleException
* @expectedExceptionMessage Laravel default locale [jp] is not in the `supported-locales` array.
*/
/** @test */
public function it_must_throw_unsupported_locale_exception_on_default_locale()
{
$this->expectException(\Arcanedev\Localization\Exceptions\UnsupportedLocaleException::class);
$this->expectExceptionMessage('Laravel default locale [jp] is not in the `supported-locales` array.');

app('config')->set('app.locale', 'jp');

new Localization(
Expand Down Expand Up @@ -66,13 +64,11 @@ public function it_can_set_and_get_supported_locales()
}
}

/**
* @test
*
* @expectedException \Arcanedev\Localization\Exceptions\UndefinedSupportedLocalesException
*/
/** @test */
public function it_must_throw_undefined_supported_locales_exception_on_set_supported_locales_with_empty_array()
{
$this->expectException(\Arcanedev\Localization\Exceptions\UndefinedSupportedLocalesException::class);

localization()->setSupportedLocales([]);
}

Expand Down Expand Up @@ -333,14 +329,12 @@ public function it_can_get_url_from_route_name_translated()
);
}

/**
* @test
*
* @expectedException \Arcanedev\Localization\Exceptions\UnsupportedLocaleException
* @expectedExceptionMessage Locale 'jp' is not in the list of supported locales.
*/
/** @test */
public function it_must_throw_an_exception_on_unsupported_locale()
{
$this->expectException(\Arcanedev\Localization\Exceptions\UnsupportedLocaleException::class);
$this->expectExceptionMessage("Locale 'jp' is not in the list of supported locales.");

localization()->getUrlFromRouteName('jp', 'localization::routes.about');
}

Expand Down Expand Up @@ -456,11 +450,11 @@ public function it_can_render_locales_navigation_bar()
{
$navbar = localization()->localesNavbar();

static::assertContains('<ul class="navbar-locales">', $navbar);
static::assertContains('<li class="active">', $navbar);
static::assertContains(e('English'), $navbar);
static::assertContains(e('Español'), $navbar);
static::assertContains(e('Français'), $navbar);
static::assertStringContainsString('<ul class="navbar-locales">', $navbar);
static::assertStringContainsString('<li class="active">', $navbar);
static::assertStringContainsString(e('English'), $navbar);
static::assertStringContainsString(e('Español'), $navbar);
static::assertStringContainsString(e('Français'), $navbar);
}

/** @test */
Expand Down
4 changes: 2 additions & 2 deletions tests/Routing/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class RouterTest extends TestCase
| -----------------------------------------------------------------
*/

public function setUp()
public function setUp(): void
{
parent::setUp();

$this->router = app('router');
}

public function tearDown()
public function tearDown(): void
{
unset($this->router);

Expand Down
12 changes: 5 additions & 7 deletions tests/TranslatableModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TranslatableModelTest extends TestCase
| -----------------------------------------------------------------
*/

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -256,14 +256,12 @@ public function it_can_forget_all_translations()
static::assertSame('', $this->model->getTranslation('slug', 'en'));
}

/**
* @test
*
* @expectedException \Arcanedev\Localization\Exceptions\UntranslatableAttributeException
* @expectedExceptionMessage The attribute `untranslated` is untranslatable because it's not available in the translatable array: `name, slug`
*/
/** @test */
public function it_will_throw_an_exception_when_trying_to_translate_an_untranslatable_attribute()
{
$this->expectException(\Arcanedev\Localization\Exceptions\UntranslatableAttributeException::class);
$this->expectExceptionMessage("The attribute `untranslated` is untranslatable because it's not available in the translatable array: `name, slug`");

$this->model->setTranslation('untranslated', 'en', 'value');
}

Expand Down
22 changes: 9 additions & 13 deletions tests/Utilities/LocalesManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LocalesManagerTest extends TestCase
| -----------------------------------------------------------------
*/

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -34,7 +34,7 @@ public function setUp()
$this->localesManager->setCurrentLocale('en');
}

public function tearDown()
public function tearDown(): void
{
unset($this->localesManager);

Expand Down Expand Up @@ -174,24 +174,20 @@ public function it_can_set_and_get_default_locale()
}
}

/**
* @test
*
* @expectedException \Arcanedev\Localization\Exceptions\UnsupportedLocaleException
* @expectedExceptionMessage Laravel default locale [jp] is not in the `supported-locales` array.
*/
/** @test */
public function it_must_throw_unsupported_locale_exception_on_set_default_locale()
{
$this->expectException(\Arcanedev\Localization\Exceptions\UnsupportedLocaleException::class);
$this->expectExceptionMessage("Laravel default locale [jp] is not in the `supported-locales` array.");

$this->localesManager->setDefaultLocale('jp');
}

/**
* @test
*
* @expectedException \Arcanedev\Localization\Exceptions\UndefinedSupportedLocalesException
*/
/** @test */
public function it_must_throw_undefined_supported_locales_exception_on_set_with_empty_array()
{
$this->expectException(\Arcanedev\Localization\Exceptions\UndefinedSupportedLocalesException::class);

$this->localesManager->setSupportedLocales([]);
}
}
4 changes: 2 additions & 2 deletions tests/Utilities/NegotiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ class NegotiatorTest extends TestCase
| -----------------------------------------------------------------
*/

public function setUp()
public function setUp(): void
{
parent::setUp();

$this->negotiator = app(\Arcanedev\Localization\Contracts\Negotiator::class);
}

public function tearDown()
public function tearDown(): void
{
unset($this->negotiator);

Expand Down

0 comments on commit 185532f

Please sign in to comment.