Skip to content

Commit

Permalink
Merge pull request #117 from ARCANEDEV/update-laravel_5.6_support
Browse files Browse the repository at this point in the history
Updating the package to support Laravel 5.6
  • Loading branch information
arcanedev-maroc authored Feb 11, 2018
2 parents 3a56829 + a1f5d9e commit 066f7d7
Show file tree
Hide file tree
Showing 17 changed files with 219 additions and 233 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: php
sudo: false

php:
- 7.0
- 7.1.3
- 7.1
- 7.2
- nightly
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 @@ -26,17 +26,20 @@ PHP extensions:
| ![Localization v0.x][localization_0_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] |
| ![Localization v1.x][localization_1_x] | ![Laravel v5.4][laravel_5_4] |
| ![Localization v2.x][localization_2_x] | ![Laravel v5.5][laravel_5_5] |
| ![Localization v3.x][localization_3_x] | ![Laravel v5.6][laravel_5_6] |

[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"

[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.*"

## Composer

Expand Down
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
"type": "library",
"license": "MIT",
"require": {
"php": ">=7.0",
"arcanedev/support": "~4.2.0"
"php": ">=7.1.3",
"arcanedev/support": "~4.3.0"
},
"require-dev": {
"phpunit/phpcov": "~4.0",
"phpunit/phpunit": "~6.0",
"phpunit/phpcov": "~5.0",
"phpunit/phpunit": "~7.0",
"mockery/mockery": "^0.9.4",
"orchestra/testbench": "~3.5.0",
"orchestra/database": "~3.5.0"
"orchestra/testbench": "~3.6.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</filter>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
</php>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
Expand Down
44 changes: 22 additions & 22 deletions tests/Entities/LocaleCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->locales);
static::assertInstanceOf($expected, $this->locales);
}

$this->assertTrue($this->locales->isEmpty());
$this->assertCount(0, $this->locales);
$this->assertSame(0, $this->locales->count());
static::assertTrue($this->locales->isEmpty());
static::assertCount(0, $this->locales);
static::assertSame(0, $this->locales->count());
}

/** @test */
Expand All @@ -67,9 +67,9 @@ public function it_can_get_all_locales()
$data = config('localization.locales', []);
$this->locales->loadFromArray($data);

$this->assertFalse($this->locales->isEmpty());
$this->assertCount(289, $this->locales);
$this->assertSame(289, $this->locales->count());
static::assertFalse($this->locales->isEmpty());
static::assertCount(289, $this->locales);
static::assertSame(289, $this->locales->count());
}

/** @test */
Expand All @@ -87,13 +87,13 @@ public function it_can_get_supported_locales()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $supported);
static::assertInstanceOf($expected, $supported);
}

$count = count($this->supportedLocales);
$this->assertFalse($supported->isEmpty());
$this->assertCount($count, $supported);
$this->assertSame($count, $supported->count());
static::assertFalse($supported->isEmpty());
static::assertCount($count, $supported);
static::assertSame($count, $supported->count());
}

/** @test */
Expand All @@ -104,8 +104,8 @@ public function it_can_transform_locales_to_native_names()
->setSupportedKeys(config('localization.supported-locales', []));

foreach ($this->locales->toNative() as $key => $native) {
$this->assertTrue($this->locales->has($key), "Locale [$key] not found");
$this->assertSame($this->locales->get($key)->native(), $native);
static::assertTrue($this->locales->has($key), "Locale [$key] not found");
static::assertSame($this->locales->get($key)->native(), $native);
}

$expected = [
Expand All @@ -114,7 +114,7 @@ public function it_can_transform_locales_to_native_names()
'fr' => 'Français',
];

$this->assertEquals($expected, $this->locales->getSupported()->toNative()->toArray());
static::assertEquals($expected, $this->locales->getSupported()->toNative()->toArray());
}

/** @test */
Expand All @@ -125,15 +125,15 @@ public function it_can_load_locales_from_config()
$supported = $this->locales->getSupported();

// Assert all locales
$this->assertFalse($this->locales->isEmpty());
$this->assertCount(289, $this->locales);
$this->assertSame(289, $this->locales->count());
static::assertFalse($this->locales->isEmpty());
static::assertCount(289, $this->locales);
static::assertSame(289, $this->locales->count());

// Assert supported locales
$this->assertFalse($supported->isEmpty());
static::assertFalse($supported->isEmpty());
$count = count($this->supportedLocales);
$this->assertCount($count, $supported);
$this->assertSame($count, $supported->count());
static::assertCount($count, $supported);
static::assertSame($count, $supported->count());
}

/** @test */
Expand All @@ -143,7 +143,7 @@ public function it_can_get_first_locale()

$locale = $this->locales->first();

$this->assertInstanceOf(Locale::class, $locale);
$this->assertSame('aa', $locale->key());
static::assertInstanceOf(Locale::class, $locale);
static::assertSame('aa', $locale->key());
}
}
26 changes: 13 additions & 13 deletions tests/Entities/LocaleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ public function it_can_be_instantiated()
{
$this->locale = $this->makeLocale('en');

$this->assertInstanceOf(Locale::class, $this->locale);
static::assertInstanceOf(Locale::class, $this->locale);

$this->assertSame('en', $this->locale->key());
$this->assertSame('English', $this->locale->name());
$this->assertSame('Latin', $this->locale->script());
$this->assertSame('ltr', $this->locale->direction());
$this->assertSame('English', $this->locale->native());
$this->assertSame('en_GB', $this->locale->regional());
static::assertSame('en', $this->locale->key());
static::assertSame('English', $this->locale->name());
static::assertSame('Latin', $this->locale->script());
static::assertSame('ltr', $this->locale->direction());
static::assertSame('English', $this->locale->native());
static::assertSame('en_GB', $this->locale->regional());

$this->assertTrue($this->locale->isDefault());
static::assertTrue($this->locale->isDefault());
}

/** @test */
Expand All @@ -61,7 +61,7 @@ public function it_must_lower_direction_case()
$data['dir'] = 'LTR';
$this->locale = new Locale($key, $data);

$this->assertSame(strtolower($data['dir']), $this->locale->direction());
static::assertSame(strtolower($data['dir']), $this->locale->direction());
}

/** @test */
Expand All @@ -72,24 +72,24 @@ public function it_can_get_direction_if_empty()
$data['dir'] = '';
$this->locale = new Locale($key, $data);

$this->assertSame('ltr', $this->locale->direction());
static::assertSame('ltr', $this->locale->direction());
}

/** @test */
public function it_can_convert_entity_to_array()
{
$this->locale = $this->makeLocale('en');

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

/** @test */
public function it_can_convert_entity_to_json()
{
$this->locale = $this->makeLocale('en');

$this->assertJson($this->locale->toJson());
$this->assertJson(json_encode($this->locale, JSON_PRETTY_PRINT));
static::assertJson($this->locale->toJson());
static::assertJson(json_encode($this->locale, JSON_PRETTY_PRINT));
}

/* -----------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions tests/LocalizationServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->provider);
static::assertInstanceOf($expected, $this->provider);
}
}

Expand All @@ -64,13 +64,13 @@ public function it_can_provides()
\Arcanedev\Localization\Contracts\Localization::class,
];

$this->assertSame($expected, $this->provider->provides());
static::assertSame($expected, $this->provider->provides());
}

/** @test */
public function it_can_register_localization_facade()
{
$this->assertEquals(
static::assertEquals(
$this->app->getLocale(),
\Arcanedev\Localization\Facades\Localization::getDefaultLocale()
);
Expand Down
Loading

0 comments on commit 066f7d7

Please sign in to comment.