5 changed files with 96 additions and 2 deletions
-
22src/CrudMake.php
-
27src/stubs/lang.stub
-
1tests/CrudMakeCommandTest.php
-
46tests/Generators/LangGeneratorTest.php
-
2tests/TestCase.php
@ -0,0 +1,27 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
// Labels |
||||
|
'item' => 'Master', |
||||
|
'list' => 'Master List', |
||||
|
'search' => 'Search Master', |
||||
|
'not_found' => 'Master not found.', |
||||
|
'empty' => 'Master is empty.', |
||||
|
'back_to_show' => 'Back to Master Detail', |
||||
|
'back_to_index' => 'Back to Master List', |
||||
|
|
||||
|
// Actions |
||||
|
'create' => 'Create new Master', |
||||
|
'created' => 'Create new Master succeded.', |
||||
|
'edit' => 'Edit Master', |
||||
|
'update' => 'Update Master', |
||||
|
'updated' => 'Update Master succeded.', |
||||
|
'delete' => 'Delete Master', |
||||
|
'delete_confirm' => 'Are you sure to delete this Master?', |
||||
|
'deleted' => 'Delete Master succeded.', |
||||
|
'undeleted' => 'Master not deleted.', |
||||
|
|
||||
|
// Attributes |
||||
|
'name' => 'Master Name', |
||||
|
'description' => 'Master Description', |
||||
|
]; |
||||
@ -0,0 +1,46 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace Tests\Generators; |
||||
|
|
||||
|
use Tests\TestCase; |
||||
|
|
||||
|
class LangGeneratorTest extends TestCase |
||||
|
{ |
||||
|
/** @test */ |
||||
|
public function it_creates_correct_model_lang_content() |
||||
|
{ |
||||
|
$this->artisan('make:crud', ['name' => $this->modelName, '--no-interaction' => true]); |
||||
|
|
||||
|
$langPath = resource_path('lang/en/'.$this->singleModelName.'.php'); |
||||
|
$this->assertFileExists($langPath); |
||||
|
$langFileContent = "<?php
|
||||
|
|
||||
|
return [ |
||||
|
// Labels
|
||||
|
'item' => 'Item', |
||||
|
'list' => 'Item List', |
||||
|
'search' => 'Search Item', |
||||
|
'not_found' => 'Item not found.', |
||||
|
'empty' => 'Item is empty.', |
||||
|
'back_to_show' => 'Back to Item Detail', |
||||
|
'back_to_index' => 'Back to Item List', |
||||
|
|
||||
|
// Actions
|
||||
|
'create' => 'Create new Item', |
||||
|
'created' => 'Create new Item succeded.', |
||||
|
'edit' => 'Edit Item', |
||||
|
'update' => 'Update Item', |
||||
|
'updated' => 'Update Item succeded.', |
||||
|
'delete' => 'Delete Item', |
||||
|
'delete_confirm' => 'Are you sure to delete this Item?', |
||||
|
'deleted' => 'Delete Item succeded.', |
||||
|
'undeleted' => 'Item not deleted.', |
||||
|
|
||||
|
// Attributes
|
||||
|
'title' => 'Item Title', |
||||
|
'body' => 'Item Content', |
||||
|
]; |
||||
|
";
|
||||
|
$this->assertEquals($langFileContent, file_get_contents($langPath)); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue