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('master.list') }}

@foreach(\$masters as \$key => \$master) @endforeach
{{ 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]) !!}
@includeWhen(Request::has('action'), 'masters.forms')
@endsection "; $this->assertEquals($indexViewContent, file_get_contents($indexViewPath)); } /** @test */ public function it_creates_correct_forms_view_content() { $this->artisan('make:crud', ['name' => $this->modelName, '--no-interaction' => true]); $formViewPath = resource_path("views/{$this->tableName}/forms.blade.php"); $this->assertFileExists($formViewPath); $formViewContent = "@if (Request::get('action') == 'create') {!! Form::open(['route' => 'masters.store']) !!} {!! FormField::text('name') !!} {!! FormField::textarea('description') !!} {!! Form::submit(trans('master.create'), ['class' => 'btn btn-success']) !!} {!! Form::hidden('cat', 'master') !!} {{ link_to_route('masters.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }} {!! Form::close() !!} @endif @if (Request::get('action') == 'edit' && \$editableMaster) {!! Form::model(\$editableMaster, ['route' => ['masters.update', \$editableMaster->id],'method' => 'patch']) !!} {!! FormField::text('name') !!} {!! FormField::textarea('description') !!} {!! Form::submit(trans('master.update'), ['class' => 'btn btn-success']) !!} {{ link_to_route('masters.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }} {!! Form::close() !!} @endif @if (Request::get('action') == 'delete' && \$editableMaster)

{{ trans('master.delete') }}

{{ \$editableMaster->name }}

{!! \$errors->first('master_id', ':message') !!}

{{ trans('app.delete_confirm') }}
{!! FormField::delete(['route'=>['masters.destroy',\$editableMaster->id]], trans('app.delete_confirm_button'), ['class'=>'btn btn-danger'], ['master_id' => \$editableMaster->id]) !!} {{ link_to_route('masters.index', trans('app.cancel'), [], ['class' => 'btn btn-default']) }}
@endif "; $this->assertEquals($formViewContent, file_get_contents($formViewPath)); } }