Browse Source

Add config for the package

tags/0.1.1
Nafies Luthfi 8 years ago
parent
commit
9f2920b666
  1. 6
      src/ServiceProvider.php
  2. 39
      src/config.php
  3. 44
      tests/ConfigTest.php

6
src/ServiceProvider.php

@ -16,10 +16,14 @@ class ServiceProvider extends BaseServiceProvider
CrudMake::class,
]);
}
$this->mergeConfigFrom(__DIR__ . '/config.php', 'simple-crud');
}
public function boot()
{
//
$this->publishes([
__DIR__ . '/config.php' => config_path('simple-crud.php'),
], 'config');
}
}

39
src/config.php

@ -0,0 +1,39 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Base Layout View
|--------------------------------------------------------------------------
|
| Default Laravel view layout
|
*/
'default_layout_view' => 'layouts.app',
/*
|--------------------------------------------------------------------------
| Base Test Class Path
|--------------------------------------------------------------------------
|
| Base TestCase Path on Laravel application
|
*/
'base_test_path' => 'tests/BrowserKitTest.php',
/*
|--------------------------------------------------------------------------
| Base Test Class
|--------------------------------------------------------------------------
|
| Base Test Class that used on Laravel application
| according to 'base_test_path' config above
|
*/
'base_test_class' => 'Tests\BrowserKitTest',
];

44
tests/ConfigTest.php

@ -0,0 +1,44 @@
<?php
namespace Tests;
class ConfigTest extends TestCase
{
/** @test */
public function it_has_config_file()
{
$this->assertTrue(is_array(config('simple-crud')));
}
/** @test */
public function it_has_default_layout_view_config()
{
$this->assertEquals('layouts.app', config('simple-crud.default_layout_view'));
config(['simple-crud.default_layout_view' => 'layouts.master']);
$this->assertEquals('layouts.master', config('simple-crud.default_layout_view'));
}
/** @test */
public function it_has_base_test_path_config()
{
$this->assertEquals('tests/BrowserKitTest.php', config('simple-crud.base_test_path'));
}
/** @test */
public function it_has_base_test_class_config()
{
$this->assertEquals('Tests\BrowserKitTest', config('simple-crud.base_test_class'));
}
/** @test */
public function config_file_can_be_published()
{
$this->artisan('vendor:publish', ['--tag' => 'config', '--no-interaction' => true]);
$this->assertFileExists(config_path('simple-crud.php'));
$this->removeFileOrDir(config_path('simple-crud.php'));
}
}
Loading…
Cancel
Save