Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
composer.phar
composer.lock

.idea/
.idea/

.phpunit.result.cache
9 changes: 9 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@
"illuminate/console": "^6.0",
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^8.3",
"orchestra/testbench": "^4.0"
},
"autoload": {
"psr-4": {
"ProcyonWeb\\TranslationGenerator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"ProcyonWeb\\TranslationGenerator\\Test\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
Expand Down
22 changes: 22 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Laravel Translation Generator Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
7 changes: 6 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
*/
public function register()
{
$this->mergeConfigFrom(
__DIR__.'/../config/translation.php',
'laravel_translation_generator'
);

if ($this->app->runningInConsole()) {
$this->commands([
GenerateCommand::class,
Expand All @@ -29,6 +34,6 @@ public function boot()
{
$this->publishes([
__DIR__.'/../config/translation.php' => config_path('translation.php'),
]);
], 'laravel_translation_generator-config');
}
}
14 changes: 14 additions & 0 deletions tests/ShowFilesCommandTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types=1);

namespace ProcyonWeb\TranslationGenerator\Test;

class ShowFilesCommandTest extends TestCase
{
public function test_console_command(): void
{
config(['translation.generator.patterns' => []]);

$this->artisan('translation:show-files')
->assertExitCode(0);
}
}
20 changes: 20 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types=1);

namespace ProcyonWeb\TranslationGenerator\Test;

use Illuminate\Foundation\Application;
use Orchestra\Testbench\TestCase as Orchestra;
use ProcyonWeb\TranslationGenerator\ServiceProvider;

class TestCase extends Orchestra
{
/**
* @param Application $app
*
* @return array
*/
protected function getPackageProviders(Application $app): array
{
return [ServiceProvider::class];
}
}