This repository has been archived by the owner on Aug 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from luisprmat/main
Optimize load of [locale].json exluding not required translations
- Loading branch information
Showing
24 changed files
with
637 additions
and
76 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
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Luisprmat\LaravelLangInstaller\Tests\Feature; | ||
|
||
use Illuminate\Support\Facades\File; | ||
use Luisprmat\LaravelLangInstaller\Tests\TestCase; | ||
|
||
class DiscoverPackagesTest extends TestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->app->setBasePath(__DIR__ . '/../fixtures'); | ||
|
||
File::ensureDirectoryExists(config_path()); | ||
File::copy(__DIR__ . '/../stubs/config/app.php', config_path('app.php')); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
File::deleteDirectory(config_path()); | ||
File::deleteDirectory(resource_path()); | ||
File::delete(base_path('composer.json')); | ||
} | ||
|
||
/** @test */ | ||
function it_doesnt_execute_if_composer_json_doesnt_exist() | ||
{ | ||
$this->artisan('lang:add') | ||
->expectsOutput('composer.json not found!') | ||
->assertExitCode(0); | ||
} | ||
|
||
/** @test */ | ||
function it_discovers_several_supported_packages_installed_from_composer_json() | ||
{ | ||
File::put(base_path('composer.json'), $this->buildComposerWithDependencies( | ||
['"laravel/cashier": "^13.5"', '"package/other": "^2.0"'], | ||
['"laravel/breeze": "^1.4"', '"laravel/no-supported": "^1.0"'] | ||
)); | ||
|
||
$command = $this->artisan('lang:add'); | ||
$command->expectsOutput('Translations for [breeze, cashier] packages merged!'); | ||
} | ||
|
||
/** @test */ | ||
function it_discovers_one_supported_package_installed_from_composer_json_require_dev() | ||
{ | ||
File::put(base_path('composer.json'), $this->buildComposerWithDependencies( | ||
['"package/other": "^2.0"'], | ||
['"laravel/breeze": "^1.4"', '"laravel/no-supported": "^1.0"'] | ||
)); | ||
|
||
$command = $this->artisan('lang:add'); | ||
$command->expectsOutput('Translations for [breeze] package merged!'); | ||
} | ||
|
||
/** @test */ | ||
function it_discovers_one_supported_package_installed_from_composer_json_require() | ||
{ | ||
File::put(base_path('composer.json'), $this->buildComposerWithDependencies( | ||
['"laravel/cashier": "^13.5"'] | ||
)); | ||
|
||
$command = $this->artisan('lang:add'); | ||
$command->expectsOutput('Translations for [cashier] package merged!'); | ||
} | ||
} |
Oops, something went wrong.