Browse Source

Add support for php >=5.6.4 and laravel 5.3

tags/0.1.7
Nafies Luthfi 8 years ago
parent
commit
7563d5ff82
  1. 4
      composer.json
  2. 2
      src/stubs/route-web.stub
  3. 4
      src/stubs/view-index.stub
  4. 4
      tests/Generators/RouteWebGeneratorTest.php
  5. 6
      tests/Generators/ViewsGeneratorTest.php

4
composer.json

@ -19,8 +19,8 @@
} }
}, },
"require": { "require": {
"php": ">=7.0",
"illuminate/support": "5.4.* || 5.5.*",
"php": ">=5.6.4",
"illuminate/support": "5.3.* || 5.4.* || 5.5.*",
"laravel/browser-kit-testing": "^2.0" "laravel/browser-kit-testing": "^2.0"
}, },
"require-dev": { "require-dev": {

2
src/stubs/route-web.stub

@ -1,2 +1,2 @@
Route::apiResource('masters', 'MastersController');
Route::resource('masters', 'MastersController');

4
src/stubs/view-index.stub

@ -57,7 +57,9 @@
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
@includeWhen(Request::has('action'), 'masters.forms')
@if(Request::has('action'))
@include('masters.forms')
@endif
</div> </div>
</div> </div>
@endsection @endsection

4
tests/Generators/RouteWebGeneratorTest.php

@ -15,7 +15,7 @@ class RouteWebGeneratorTest extends TestCase
$this->assertFileExists($routeWebPath); $this->assertFileExists($routeWebPath);
$routeWebFileContent = "<?php $routeWebFileContent = "<?php
Route::apiResource('{$this->table_name}', '{$this->plural_model_name}Controller');
Route::resource('{$this->table_name}', '{$this->plural_model_name}Controller');
"; ";
$this->assertEquals($routeWebFileContent, file_get_contents($routeWebPath)); $this->assertEquals($routeWebFileContent, file_get_contents($routeWebPath));
} }
@ -29,7 +29,7 @@ Route::apiResource('{$this->table_name}', '{$this->plural_model_name}Controller'
$this->assertFileExists($routeWebPath); $this->assertFileExists($routeWebPath);
$routeWebFileContent = "<?php $routeWebFileContent = "<?php
Route::apiResource('{$this->table_name}', 'Projects\\{$this->plural_model_name}Controller');
Route::resource('{$this->table_name}', 'Projects\\{$this->plural_model_name}Controller');
"; ";
$this->assertEquals($routeWebFileContent, file_get_contents($routeWebPath)); $this->assertEquals($routeWebFileContent, file_get_contents($routeWebPath));
} }

6
tests/Generators/ViewsGeneratorTest.php

@ -73,7 +73,9 @@ class ViewsGeneratorTest extends TestCase
</div> </div>
</div> </div>
<div class=\"col-md-4\"> <div class=\"col-md-4\">
@includeWhen(Request::has('action'), '{$this->table_name}.forms')
@if(Request::has('action'))
@include('{$this->table_name}.forms')
@endif
</div> </div>
</div> </div>
@endsection @endsection
@ -162,7 +164,7 @@ class ViewsGeneratorTest extends TestCase
public function generateDefaultLayoutView($defaultLayoutView) public function generateDefaultLayoutView($defaultLayoutView)
{ {
$dataViewPathArray = explode('.', $defaultLayoutView); $dataViewPathArray = explode('.', $defaultLayoutView);
$fileName = array_pop($dataViewPathArray);
$fileName = array_pop($dataViewPathArray);
$defaultLayoutPath = resource_path('views/'.implode('/', $dataViewPathArray)); $defaultLayoutPath = resource_path('views/'.implode('/', $dataViewPathArray));
$files = app('Illuminate\Filesystem\Filesystem'); $files = app('Illuminate\Filesystem\Filesystem');

Loading…
Cancel
Save