diff --git a/src/stubs/view-forms.stub b/src/stubs/view-forms.stub index 6e03d78..865535e 100644 --- a/src/stubs/view-forms.stub +++ b/src/stubs/view-forms.stub @@ -30,4 +30,4 @@ {{ link_to_route('masters.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }} -@endif \ No newline at end of file +@endif diff --git a/src/stubs/view-index.stub b/src/stubs/view-index.stub index 703296b..6148dcd 100644 --- a/src/stubs/view-index.stub +++ b/src/stubs/view-index.stub @@ -37,4 +37,4 @@ @includeWhen(Request::has('action'), 'masters.forms') -@endsection \ No newline at end of file +@endsection diff --git a/tests/Generators/ViewsGeneratorTest.php b/tests/Generators/ViewsGeneratorTest.php new file mode 100644 index 0000000..d3565b6 --- /dev/null +++ b/tests/Generators/ViewsGeneratorTest.php @@ -0,0 +1,103 @@ +artisan('make:crud', ['name' => $this->modelName, '--no-interaction' => true]); + + $indexViewPath = resource_path("views/{$this->tableName}/index.blade.php"); + $this->assertFileExists($indexViewPath); + $indexViewContent = "@extends('layouts.app') + +@section('title', trans('master.list')) + +@section('content') +{{ link_to_route('masters.index', trans('master.create'), ['action' => 'create'], ['class' => 'btn btn-success pull-right']) }} +
| {{ trans('app.table_no') }} | +{{ trans('master.name') }} | +{{ trans('master.description') }} | +{{ trans('app.action') }} | +
|---|---|---|---|
| {{ 1 + \$key }} | +{{ \$master->name }} | +{{ \$master->description }} | ++ {!! link_to_route('masters.index', trans('app.edit'), ['action' => 'edit', 'id' => \$master->id], ['id' => 'edit-master-' . \$master->id]) !!} | + {!! link_to_route('masters.index', trans('app.delete'), ['action' => 'delete', 'id' => \$master->id], ['id' => 'del-master-' . \$master->id]) !!} + | +
{{ \$editableMaster->name }}
+ {!! \$errors->first('master_id', ':message') !!} +