|
|
@ -122,6 +122,8 @@ class CrudMake extends Command |
|
|
|
|
|
|
|
|
public function generateTests() |
|
|
public function generateTests() |
|
|
{ |
|
|
{ |
|
|
|
|
|
$this->createBrowserKitBaseTestClass(); |
|
|
|
|
|
|
|
|
$featureTestPath = $this->makeDirectory(base_path('tests/Feature')); |
|
|
$featureTestPath = $this->makeDirectory(base_path('tests/Feature')); |
|
|
$this->files->put("{$featureTestPath}/Manage{$this->pluralModelName}Test.php", $this->getFeatureTestContent()); |
|
|
$this->files->put("{$featureTestPath}/Manage{$this->pluralModelName}Test.php", $this->getFeatureTestContent()); |
|
|
$this->info('Manage'.$this->pluralModelName.'Test generated.'); |
|
|
$this->info('Manage'.$this->pluralModelName.'Test generated.'); |
|
|
@ -131,6 +133,20 @@ class CrudMake extends Command |
|
|
$this->info($this->modelName.'Test (model) generated.'); |
|
|
$this->info($this->modelName.'Test (model) generated.'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function createBrowserKitBaseTestClass() |
|
|
|
|
|
{ |
|
|
|
|
|
$testsPath = base_path('tests'); |
|
|
|
|
|
if (! $this->files->isDirectory($testsPath)) { |
|
|
|
|
|
$this->files->makeDirectory($testsPath, 0777, true, true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (! $this->files->exists($testsPath.'/BrowserKitTest.php')) { |
|
|
|
|
|
$this->files->put($testsPath.'/BrowserKitTest.php', $this->getBrowserKitBaseTestContent()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->info('BrowserKitTest generated.'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public function generateResourceRoute() |
|
|
public function generateResourceRoute() |
|
|
{ |
|
|
{ |
|
|
$webRoutePath = $this->makeRouteFile(base_path('routes'), 'web.php'); |
|
|
$webRoutePath = $this->makeRouteFile(base_path('routes'), 'web.php'); |
|
|
@ -174,6 +190,11 @@ class CrudMake extends Command |
|
|
return $this->replaceStubString($stub); |
|
|
return $this->replaceStubString($stub); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getBrowserKitBaseTestContent() |
|
|
|
|
|
{ |
|
|
|
|
|
return $this->files->get(__DIR__.'/stubs/test-browserkit-base-class.stub'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public function getFeatureTestContent() |
|
|
public function getFeatureTestContent() |
|
|
{ |
|
|
{ |
|
|
$stub = $this->files->get(__DIR__.'/stubs/test-feature.stub'); |
|
|
$stub = $this->files->get(__DIR__.'/stubs/test-feature.stub'); |
|
|
|