Browse Source

Fix invalid ModelPolicyTest class name

tags/0.1.3^0 0.1.3
Nafies Luthfi 8 years ago
parent
commit
fe872af774
  1. 2
      src/stubs/lang.stub
  2. 2
      src/stubs/test-policy.stub
  3. 8
      tests/Generators/LangGeneratorTest.php
  4. 4
      tests/Generators/ModelPolicyTestGeneratorTest.php

2
src/stubs/lang.stub

@ -13,6 +13,7 @@ return [
// Actions
'create' => 'Create new Master',
'created' => 'Create new Master succeded.',
'show' => 'Master Detail',
'edit' => 'Edit Master',
'update' => 'Update Master',
'updated' => 'Update Master succeded.',
@ -20,6 +21,7 @@ return [
'delete_confirm' => 'Are you sure to delete this Master?',
'deleted' => 'Delete Master succeded.',
'undeleted' => 'Master not deleted.',
'undeleteable' => 'Master data cannot be deleted.',
// Attributes
'name' => 'Master Name',

2
src/stubs/test-policy.stub

@ -6,7 +6,7 @@ use fullMstr;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\BrowserKitTest as TestCase;
class MasterTest extends TestCase
class MasterPolicyTest extends TestCase
{
use DatabaseMigrations;

8
tests/Generators/LangGeneratorTest.php

@ -11,8 +11,8 @@ class LangGeneratorTest extends TestCase
{
$this->artisan('make:crud', ['name' => $this->model_name, '--no-interaction' => true]);
$locale = config('app.locale');
$langPath = resource_path('lang/'.$locale.'/'.$this->lang_name.'.php');
$locale = config('app.locale');
$langPath = resource_path('lang/'.$locale.'/'.$this->lang_name.'.php');
$displayModelName = ucwords(str_replace('_', ' ', snake_case($this->model_name)));
$this->assertFileExists($langPath);
$langFileContent = "<?php
@ -30,6 +30,7 @@ return [
// Actions
'create' => 'Create new {$displayModelName}',
'created' => 'Create new {$displayModelName} succeded.',
'show' => '{$displayModelName} Detail',
'edit' => 'Edit {$displayModelName}',
'update' => 'Update {$displayModelName}',
'updated' => 'Update {$displayModelName} succeded.',
@ -37,6 +38,7 @@ return [
'delete_confirm' => 'Are you sure to delete this {$displayModelName}?',
'deleted' => 'Delete {$displayModelName} succeded.',
'undeleted' => '{$displayModelName} not deleted.',
'undeleteable' => '{$displayModelName} data cannot be deleted.',
// Attributes
'name' => '{$displayModelName} Name',
@ -51,7 +53,7 @@ return [
{
$this->artisan('make:crud', ['name' => $this->model_name, '--no-interaction' => true]);
$locale = config('app.locale');
$locale = config('app.locale');
$langPath = resource_path('lang/'.$locale.'/app.php');
$this->assertFileExists($langPath);

4
tests/Generators/ModelPolicyTestGeneratorTest.php

@ -24,7 +24,7 @@ use {$this->full_model_name};
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\BrowserKitTest as TestCase;
class {$this->model_name}Test extends TestCase
class {$this->model_name}PolicyTest extends TestCase
{
use DatabaseMigrations;
@ -84,7 +84,7 @@ use {$this->full_model_name};
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase as TestCase;
class {$this->model_name}Test extends TestCase
class {$this->model_name}PolicyTest extends TestCase
{
use DatabaseMigrations;

Loading…
Cancel
Save