From 0be486ebe9a668d9f3af5d0c877b68dc63532105 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Sun, 24 Sep 2017 09:53:24 +0800 Subject: [PATCH] Add model custom stub for model creation and fix invalid BaseTestCase --- src/CrudMake.php | 8 +++++++- src/stubs/model.stub | 10 ++++++++++ src/stubs/test-browserkit-base-class.stub | 2 +- src/stubs/test-feature.stub | 2 +- tests/Generators/FeatureTestGeneratorTest.php | 4 ++-- tests/Generators/ModelGeneratorTest.php | 2 +- 6 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 src/stubs/model.stub diff --git a/src/CrudMake.php b/src/CrudMake.php index a72439d..b1c5fd8 100644 --- a/src/CrudMake.php +++ b/src/CrudMake.php @@ -67,7 +67,7 @@ class CrudMake extends Command public function generateModel() { - $this->callSilent('make:model', ['name' => $this->modelName]);; + $this->files->put(app_path($this->modelName.'.php'), $this->getModelContent()); $this->info($this->modelName.' model generated.'); } @@ -160,6 +160,12 @@ class CrudMake extends Command return $this->replaceStubString($stub); } + public function getModelContent() + { + $stub = $this->files->get(__DIR__.'/stubs/model.stub'); + return $this->replaceStubString($stub); + } + private function getMigrationContent() { $stub = $this->files->get(__DIR__.'/stubs/migration-create.stub'); diff --git a/src/stubs/model.stub b/src/stubs/model.stub new file mode 100644 index 0000000..77c039e --- /dev/null +++ b/src/stubs/model.stub @@ -0,0 +1,10 @@ +assertEquals($modelClassContent, file_get_contents($modelPath));