From a33ffc7742211c59703237eccdda855231f10a83 Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Sat, 5 Dec 2015 21:03:15 +0100 Subject: [PATCH] factory command will be added on the next release --- .../tests/acceptance/FactoryCommandCept.php | 122 +++++++++--------- .../tests/acceptance/ResourceCommandCept.php | 64 ++++----- src/Commands/ResourceCommand.php | 10 +- 3 files changed, 98 insertions(+), 98 deletions(-) diff --git a/lumen-test/tests/acceptance/FactoryCommandCept.php b/lumen-test/tests/acceptance/FactoryCommandCept.php index 9d7cc59..c6ef52c 100644 --- a/lumen-test/tests/acceptance/FactoryCommandCept.php +++ b/lumen-test/tests/acceptance/FactoryCommandCept.php @@ -1,69 +1,69 @@ wantTo('generate model factories without fields'); -$I->runShellCommand('php artisan wn:factory "App\Task"'); -$I->seeInShellOutput('App\Task factory generated'); -$I->openFile('./database/factories/ModelFactory.php'); -$I->seeInThisFile(' -$factory->define(App\Task::class, function ($faker) { - return [ - // Fields here - ]; -});'); -$I->writeToFile('./database/factories/ModelFactory.php', "wantTo('generate model factories without fields'); +// $I->runShellCommand('php artisan wn:factory "App\Task"'); +// $I->seeInShellOutput('App\Task factory generated'); +// $I->openFile('./database/factories/ModelFactory.php'); +// $I->seeInThisFile(' +// $factory->define(App\Task::class, function ($faker) { +// return [ +// // Fields here +// ]; +// });'); +// $I->writeToFile('./database/factories/ModelFactory.php', "define(App\User::class, function (\$faker) { - return [ - 'name' => \$faker->name, - 'email' => \$faker->email, - 'password' => str_random(10), - 'remember_token' => str_random(10), - ]; -}); -"); +// \$factory->define(App\User::class, function (\$faker) { +// return [ +// 'name' => \$faker->name, +// 'email' => \$faker->email, +// 'password' => str_random(10), +// 'remember_token' => str_random(10), +// ]; +// }); +// "); -$I->wantTo('generate model factories with fields'); -$I->runShellCommand('php artisan wn:factory "App\Task" --fields="title:sentence(3),description:paragraph(3),due:date,hidden:boolean"'); -$I->seeInShellOutput('App\Task factory generated'); -$I->openFile('./database/factories/ModelFactory.php'); -$I->seeInThisFile(" - 'title' => \$faker->sentence(3), - 'description' => \$faker->paragraph(3), - 'due' => \$faker->date, - 'hidden' => \$faker->boolean, -"); -$I->writeToFile('./database/factories/ModelFactory.php', "wantTo('generate model factories with fields'); +// $I->runShellCommand('php artisan wn:factory "App\Task" --fields="title:sentence(3),description:paragraph(3),due:date,hidden:boolean"'); +// $I->seeInShellOutput('App\Task factory generated'); +// $I->openFile('./database/factories/ModelFactory.php'); +// $I->seeInThisFile(" +// 'title' => \$faker->sentence(3), +// 'description' => \$faker->paragraph(3), +// 'due' => \$faker->date, +// 'hidden' => \$faker->boolean, +// "); +// $I->writeToFile('./database/factories/ModelFactory.php', "define(App\User::class, function (\$faker) { - return [ - 'name' => \$faker->name, - 'email' => \$faker->email, - 'password' => str_random(10), - 'remember_token' => str_random(10), - ]; -}); -"); +// \$factory->define(App\User::class, function (\$faker) { +// return [ +// 'name' => \$faker->name, +// 'email' => \$faker->email, +// 'password' => str_random(10), +// 'remember_token' => str_random(10), +// ]; +// }); +// "); diff --git a/lumen-test/tests/acceptance/ResourceCommandCept.php b/lumen-test/tests/acceptance/ResourceCommandCept.php index 7a56935..eb54a56 100644 --- a/lumen-test/tests/acceptance/ResourceCommandCept.php +++ b/lumen-test/tests/acceptance/ResourceCommandCept.php @@ -105,37 +105,37 @@ $app->get("/", function () use ($app) { '); // Checking model factory -$I->openFile('./database/factories/ModelFactory.php'); -$I->seeInThisFile(" -/** - * Factory definition for model App\TaskCategory. - */ -\$factory->define(App\TaskCategory::class, function (\$faker) { - return [ - 'name' => \$faker->word, - 'descr' => \$faker->paragraph, - 'due' => \$faker->date, - ]; -});"); -$I->writeToFile('./database/factories/ModelFactory.php', "openFile('./database/factories/ModelFactory.php'); +// $I->seeInThisFile(" +// /** +// * Factory definition for model App\TaskCategory. +// */ +// \$factory->define(App\TaskCategory::class, function (\$faker) { +// return [ +// 'name' => \$faker->word, +// 'descr' => \$faker->paragraph, +// 'due' => \$faker->date, +// ]; +// });"); +// $I->writeToFile('./database/factories/ModelFactory.php', "define(App\User::class, function (\$faker) { - return [ - 'name' => \$faker->name, - 'email' => \$faker->email, - 'password' => str_random(10), - 'remember_token' => str_random(10), - ]; -}); -"); \ No newline at end of file +// \$factory->define(App\User::class, function (\$faker) { +// return [ +// 'name' => \$faker->name, +// 'email' => \$faker->email, +// 'password' => str_random(10), +// 'remember_token' => str_random(10), +// ]; +// }); +// "); \ No newline at end of file diff --git a/src/Commands/ResourceCommand.php b/src/Commands/ResourceCommand.php index d777e01..0d8b0b9 100644 --- a/src/Commands/ResourceCommand.php +++ b/src/Commands/ResourceCommand.php @@ -61,11 +61,11 @@ class ResourceCommand extends BaseCommand { ]); // generating model factory - $this->call('wn:factory', [ - 'model' => 'App\\' . $modelName, - '--fields' => $this->factoryFields(), - '--parsed' => true - ]); + // $this->call('wn:factory', [ + // 'model' => 'App\\' . $modelName, + // '--fields' => $this->factoryFields(), + // '--parsed' => true + // ]); }