mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2025-04-20 16:12:26 +03:00
Compare commits
No commits in common. "master" and "1.3.3" have entirely different histories.
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,5 +7,3 @@ tests/_output/*
|
|||||||
lumen-test/app
|
lumen-test/app
|
||||||
lumen-test/database
|
lumen-test/database
|
||||||
lumen-test/tests/tmp
|
lumen-test/tests/tmp
|
||||||
|
|
||||||
.idea
|
|
||||||
|
28
README.md
28
README.md
@ -5,7 +5,7 @@
|
|||||||
[](https://insight.sensiolabs.com/projects/838624c3-208d-4ba5-84aa-3afc76b093bb)
|
[](https://insight.sensiolabs.com/projects/838624c3-208d-4ba5-84aa-3afc76b093bb)
|
||||||
[](https://github.com/webNeat/lumen-generators/blob/master/LICENSE)
|
[](https://github.com/webNeat/lumen-generators/blob/master/LICENSE)
|
||||||
|
|
||||||
A collection of generators for [Lumen](http://lumen.laravel.com) and [Laravel 6](http://laravel.com/).
|
A collection of generators for [Lumen](http://lumen.laravel.com) and [Laravel 5](http://laravel.com/).
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
@ -511,8 +511,6 @@ The second command is `wn:controller` which actually generates the controller. T
|
|||||||
|
|
||||||
- **--force**: tells the generator to override the existing file.
|
- **--force**: tells the generator to override the existing file.
|
||||||
|
|
||||||
- **--laravel**: create Laravel style routes
|
|
||||||
|
|
||||||
`php artisan wn:controller Task --no-routes` gives:
|
`php artisan wn:controller Task --no-routes` gives:
|
||||||
|
|
||||||
|
|
||||||
@ -541,9 +539,6 @@ The `wn:route` command is used to generate RESTfull routes for a controller. It
|
|||||||
|
|
||||||
- **--force**: tells the generator to override the existing file.
|
- **--force**: tells the generator to override the existing file.
|
||||||
|
|
||||||
- **--laravel**: create Laravel style routes
|
|
||||||
|
|
||||||
|
|
||||||
`php artisan wn:route project-type` adds the following routes:
|
`php artisan wn:route project-type` adds the following routes:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
@ -554,17 +549,6 @@ $app->put('project-type/{id}', 'ProjectTypesController@put');
|
|||||||
$app->delete('project-type/{id}', 'ProjectTypesController@remove');
|
$app->delete('project-type/{id}', 'ProjectTypesController@remove');
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
`php artisan wn:route project-type --laravel` adds the following routes:
|
|
||||||
|
|
||||||
```php
|
|
||||||
Route::get('project-type', 'ProjectTypesController@all');
|
|
||||||
Route::get('project-type/{id}', 'ProjectTypesController@get');
|
|
||||||
Route::post('project-type', 'ProjectTypesController@add');
|
|
||||||
Route::put('project-type/{id}', 'ProjectTypesController@put');
|
|
||||||
Route::delete('project-type/{id}', 'ProjectTypesController@remove');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Resource Generator
|
### Resource Generator
|
||||||
|
|
||||||
The `wn:resource` command makes it very easy to generate a RESTful resource. It generates a model, migration, controller and routes. The syntax is : `wn:resource name fields [--add=...] [--has-many=...] [--has-one=...] [--belongs-to=...] [--migration-file=...] [--path=...] [--force=true]`
|
The `wn:resource` command makes it very easy to generate a RESTful resource. It generates a model, migration, controller and routes. The syntax is : `wn:resource name fields [--add=...] [--has-many=...] [--has-one=...] [--belongs-to=...] [--migration-file=...] [--path=...] [--force=true]`
|
||||||
@ -597,9 +581,6 @@ The `wn:resource` command makes it very easy to generate a RESTful resource. It
|
|||||||
|
|
||||||
- **--force**: tells the generator to override the existing file.
|
- **--force**: tells the generator to override the existing file.
|
||||||
|
|
||||||
- **--laravel**: create Laravel style routes
|
|
||||||
|
|
||||||
|
|
||||||
### Multiple Resources From File
|
### Multiple Resources From File
|
||||||
|
|
||||||
The `wn:resources` (note the "s" in "resources") command takes the generation process to an other level by parsing a file and generating multiple resources based on it. The syntax is
|
The `wn:resources` (note the "s" in "resources") command takes the generation process to an other level by parsing a file and generating multiple resources based on it. The syntax is
|
||||||
@ -614,9 +595,6 @@ The file given to the command should be a valid YAML file ( for the moment, supp
|
|||||||
|
|
||||||
- **--path**: Defines where to store the model files as well as their namespace.
|
- **--path**: Defines where to store the model files as well as their namespace.
|
||||||
|
|
||||||
- **--laravel**: create Laravel style routes
|
|
||||||
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
Store:
|
Store:
|
||||||
@ -669,10 +647,6 @@ To test the generators, I included a fresh lumen installation under the folder `
|
|||||||
|
|
||||||
- Documentation: [Adding examples](https://github.com/webNeat/lumen-generators/issues/20)
|
- Documentation: [Adding examples](https://github.com/webNeat/lumen-generators/issues/20)
|
||||||
|
|
||||||
- **Version 1.3.3**
|
|
||||||
|
|
||||||
- Bug Fixed: [Rules issue when creating resources from YAML file](https://github.com/webNeat/lumen-generators/issues/30)
|
|
||||||
|
|
||||||
- **Version 1.3.2**
|
- **Version 1.3.2**
|
||||||
|
|
||||||
- Bug Fixed: [softDeletes not added to model](https://github.com/webNeat/lumen-generators/issues/25)
|
- Bug Fixed: [softDeletes not added to model](https://github.com/webNeat/lumen-generators/issues/25)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "zorgcc/lumen-generators",
|
"name": "wn/lumen-generators",
|
||||||
"description": "A collection of generators for Lumen and Laravel 5.",
|
"description": "A collection of generators for Lumen and Laravel 5.",
|
||||||
"keywords": ["lumen", "laravel", "rest", "api", "generators"],
|
"keywords": ["lumen", "laravel", "rest", "api", "generators"],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -10,10 +10,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2",
|
"php": ">=5.5.0",
|
||||||
"illuminate/console": "^5.1|^6",
|
"illuminate/console": "^5.1",
|
||||||
"illuminate/filesystem": "^5.1|^6",
|
"illuminate/filesystem": "^5.1",
|
||||||
"fzaninotto/faker": "^1.5"
|
"fzaninotto/faker": "^1.5"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
92
composer.lock
generated
92
composer.lock
generated
@ -123,16 +123,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/console",
|
"name": "illuminate/console",
|
||||||
"version": "v5.4.19",
|
"version": "v5.4.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/console.git",
|
"url": "https://github.com/illuminate/console.git",
|
||||||
"reference": "8ea19d470cdc0d6ab88269b1841dfd234cf308b8"
|
"reference": "7b4bbbcf4b45e009fc6b8af2a100ca35ee01ca94"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/console/zipball/8ea19d470cdc0d6ab88269b1841dfd234cf308b8",
|
"url": "https://api.github.com/repos/illuminate/console/zipball/7b4bbbcf4b45e009fc6b8af2a100ca35ee01ca94",
|
||||||
"reference": "8ea19d470cdc0d6ab88269b1841dfd234cf308b8",
|
"reference": "7b4bbbcf4b45e009fc6b8af2a100ca35ee01ca94",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -170,20 +170,20 @@
|
|||||||
],
|
],
|
||||||
"description": "The Illuminate Console package.",
|
"description": "The Illuminate Console package.",
|
||||||
"homepage": "https://laravel.com",
|
"homepage": "https://laravel.com",
|
||||||
"time": "2017-03-23T15:59:01+00:00"
|
"time": "2017-01-19T18:42:00+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/contracts",
|
"name": "illuminate/contracts",
|
||||||
"version": "v5.4.19",
|
"version": "v5.4.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/contracts.git",
|
"url": "https://github.com/illuminate/contracts.git",
|
||||||
"reference": "ab2825726bee46a67c8cc66789852189dbef74a9"
|
"reference": "4ec919d294aca396d172e644b243b49885cd2cc7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/ab2825726bee46a67c8cc66789852189dbef74a9",
|
"url": "https://api.github.com/repos/illuminate/contracts/zipball/4ec919d294aca396d172e644b243b49885cd2cc7",
|
||||||
"reference": "ab2825726bee46a67c8cc66789852189dbef74a9",
|
"reference": "4ec919d294aca396d172e644b243b49885cd2cc7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -212,20 +212,20 @@
|
|||||||
],
|
],
|
||||||
"description": "The Illuminate Contracts package.",
|
"description": "The Illuminate Contracts package.",
|
||||||
"homepage": "https://laravel.com",
|
"homepage": "https://laravel.com",
|
||||||
"time": "2017-03-29T13:17:47+00:00"
|
"time": "2017-01-18T20:23:54+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/filesystem",
|
"name": "illuminate/filesystem",
|
||||||
"version": "v5.4.19",
|
"version": "v5.4.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/filesystem.git",
|
"url": "https://github.com/illuminate/filesystem.git",
|
||||||
"reference": "7f656e3421b94d759627e891567380b50586f045"
|
"reference": "9e74fd5bef124640852da3ec71ec6365408de417"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/7f656e3421b94d759627e891567380b50586f045",
|
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/9e74fd5bef124640852da3ec71ec6365408de417",
|
||||||
"reference": "7f656e3421b94d759627e891567380b50586f045",
|
"reference": "9e74fd5bef124640852da3ec71ec6365408de417",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -262,20 +262,20 @@
|
|||||||
],
|
],
|
||||||
"description": "The Illuminate Filesystem package.",
|
"description": "The Illuminate Filesystem package.",
|
||||||
"homepage": "https://laravel.com",
|
"homepage": "https://laravel.com",
|
||||||
"time": "2017-04-07T19:38:05+00:00"
|
"time": "2017-01-03T14:19:43+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/support",
|
"name": "illuminate/support",
|
||||||
"version": "v5.4.19",
|
"version": "v5.4.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/support.git",
|
"url": "https://github.com/illuminate/support.git",
|
||||||
"reference": "b8cb37e15331c59da51c8ee5838038baa22d7955"
|
"reference": "7abd69eb3f83004664ab40f8e9c6914935c30752"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/support/zipball/b8cb37e15331c59da51c8ee5838038baa22d7955",
|
"url": "https://api.github.com/repos/illuminate/support/zipball/7abd69eb3f83004664ab40f8e9c6914935c30752",
|
||||||
"reference": "b8cb37e15331c59da51c8ee5838038baa22d7955",
|
"reference": "7abd69eb3f83004664ab40f8e9c6914935c30752",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -319,7 +319,7 @@
|
|||||||
],
|
],
|
||||||
"description": "The Illuminate Support package.",
|
"description": "The Illuminate Support package.",
|
||||||
"homepage": "https://laravel.com",
|
"homepage": "https://laravel.com",
|
||||||
"time": "2017-04-09T14:34:57+00:00"
|
"time": "2017-01-24T13:12:44+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nesbot/carbon",
|
"name": "nesbot/carbon",
|
||||||
@ -376,16 +376,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "paragonie/random_compat",
|
"name": "paragonie/random_compat",
|
||||||
"version": "v2.0.10",
|
"version": "v2.0.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/paragonie/random_compat.git",
|
"url": "https://github.com/paragonie/random_compat.git",
|
||||||
"reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d"
|
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/634bae8e911eefa89c1abfbf1b66da679ac8f54d",
|
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
|
||||||
"reference": "634bae8e911eefa89c1abfbf1b66da679ac8f54d",
|
"reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -420,7 +420,7 @@
|
|||||||
"pseudorandom",
|
"pseudorandom",
|
||||||
"random"
|
"random"
|
||||||
],
|
],
|
||||||
"time": "2017-03-13T16:27:32+00:00"
|
"time": "2016-11-07T23:38:38+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/log",
|
"name": "psr/log",
|
||||||
@ -471,16 +471,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v3.2.8",
|
"version": "v3.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/console.git",
|
"url": "https://github.com/symfony/console.git",
|
||||||
"reference": "a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38"
|
"reference": "4f9e449e76996adf310498a8ca955c6deebe29dd"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/console/zipball/a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38",
|
"url": "https://api.github.com/repos/symfony/console/zipball/4f9e449e76996adf310498a8ca955c6deebe29dd",
|
||||||
"reference": "a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38",
|
"reference": "4f9e449e76996adf310498a8ca955c6deebe29dd",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -530,20 +530,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Console Component",
|
"description": "Symfony Console Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2017-04-26T01:39:17+00:00"
|
"time": "2017-01-08T20:47:33+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/debug",
|
"name": "symfony/debug",
|
||||||
"version": "v3.2.8",
|
"version": "v3.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/debug.git",
|
"url": "https://github.com/symfony/debug.git",
|
||||||
"reference": "fd6eeee656a5a7b384d56f1072243fe1c0e81686"
|
"reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/debug/zipball/fd6eeee656a5a7b384d56f1072243fe1c0e81686",
|
"url": "https://api.github.com/repos/symfony/debug/zipball/810ba5c1c5352a4ddb15d4719e8936751dff0b05",
|
||||||
"reference": "fd6eeee656a5a7b384d56f1072243fe1c0e81686",
|
"reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -587,20 +587,20 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Debug Component",
|
"description": "Symfony Debug Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2017-04-19T20:17:50+00:00"
|
"time": "2017-01-02T20:32:22+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/finder",
|
"name": "symfony/finder",
|
||||||
"version": "v3.2.8",
|
"version": "v3.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/finder.git",
|
"url": "https://github.com/symfony/finder.git",
|
||||||
"reference": "9cf076f8f492f4b1ffac40aae9c2d287b4ca6930"
|
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/finder/zipball/9cf076f8f492f4b1ffac40aae9c2d287b4ca6930",
|
"url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6",
|
||||||
"reference": "9cf076f8f492f4b1ffac40aae9c2d287b4ca6930",
|
"reference": "8c71141cae8e2957946b403cc71a67213c0380d6",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -636,7 +636,7 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Finder Component",
|
"description": "Symfony Finder Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2017-04-12T14:13:17+00:00"
|
"time": "2017-01-02T20:32:22+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-mbstring",
|
"name": "symfony/polyfill-mbstring",
|
||||||
@ -699,16 +699,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/translation",
|
"name": "symfony/translation",
|
||||||
"version": "v3.2.8",
|
"version": "v3.2.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/translation.git",
|
"url": "https://github.com/symfony/translation.git",
|
||||||
"reference": "f4a04d2df710f81515df576b2de06bdeee518b83"
|
"reference": "6520f3d4cce604d9dd1e86cac7af954984dd9bda"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/translation/zipball/f4a04d2df710f81515df576b2de06bdeee518b83",
|
"url": "https://api.github.com/repos/symfony/translation/zipball/6520f3d4cce604d9dd1e86cac7af954984dd9bda",
|
||||||
"reference": "f4a04d2df710f81515df576b2de06bdeee518b83",
|
"reference": "6520f3d4cce604d9dd1e86cac7af954984dd9bda",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -721,7 +721,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"psr/log": "~1.0",
|
"psr/log": "~1.0",
|
||||||
"symfony/config": "~2.8|~3.0",
|
"symfony/config": "~2.8|~3.0",
|
||||||
"symfony/intl": "^2.8.18|^3.2.5",
|
"symfony/intl": "~2.8|~3.0",
|
||||||
"symfony/yaml": "~2.8|~3.0"
|
"symfony/yaml": "~2.8|~3.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
@ -759,7 +759,7 @@
|
|||||||
],
|
],
|
||||||
"description": "Symfony Translation Component",
|
"description": "Symfony Translation Component",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2017-04-12T14:13:17+00:00"
|
"time": "2017-01-02T20:32:22+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
|
4
lumen-test/.gitignore
vendored
4
lumen-test/.gitignore
vendored
@ -1,11 +1,7 @@
|
|||||||
/vendor
|
/vendor
|
||||||
.env
|
.env
|
||||||
codecept.phar
|
|
||||||
|
|
||||||
tests/_output/*
|
tests/_output/*
|
||||||
|
|
||||||
composer.lock
|
composer.lock
|
||||||
tests/_output/*
|
tests/_output/*
|
||||||
|
|
||||||
codecept.phar
|
|
||||||
|
|
||||||
|
@ -1,16 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Routes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here is where you can register all of the routes for an application.
|
|
||||||
| It is a breeze. Simply tell Lumen the URIs it should respond to
|
|
||||||
| and give it the Closure to call when that URI is requested.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$app->get("/", function () use ($app) {
|
$app->get("/", function () use ($app) {
|
||||||
return $app->welcome();
|
return $app->welcome();
|
||||||
});
|
});
|
||||||
|
@ -11,14 +11,6 @@ echo "<?php
|
|||||||
return \$app->welcome();
|
return \$app->welcome();
|
||||||
});" > app/Http/routes.php
|
});" > app/Http/routes.php
|
||||||
|
|
||||||
echo "<?php
|
|
||||||
/*
|
|
||||||
|------------------------------------------
|
|
||||||
| ***** DUMMY ROUTES FOR TESTING ONLY *****
|
|
||||||
|------------------------------------------
|
|
||||||
*/
|
|
||||||
" > routes/api.php
|
|
||||||
|
|
||||||
# Controllers
|
# Controllers
|
||||||
rm app/Http/Controllers/*.php 2> /dev/null
|
rm app/Http/Controllers/*.php 2> /dev/null
|
||||||
echo "<?php
|
echo "<?php
|
||||||
|
@ -5,7 +5,6 @@ paths:
|
|||||||
data: tests/_data
|
data: tests/_data
|
||||||
support: tests/_support
|
support: tests/_support
|
||||||
envs: tests/_envs
|
envs: tests/_envs
|
||||||
helpers: nil
|
|
||||||
settings:
|
settings:
|
||||||
bootstrap: _bootstrap.php
|
bootstrap: _bootstrap.php
|
||||||
colors: false
|
colors: false
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "~4.0",
|
||||||
"fzaninotto/faker": "~1.0",
|
"fzaninotto/faker": "~1.0",
|
||||||
"phpspec/phpspec": "2.0.0",
|
"phpspec/phpspec": "2.0.0",
|
||||||
"codeception/codeception": "^2.2"
|
"codeception/codeception": "2.0.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
@ -1,16 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Model Factories
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may define all of your model factories. Model factories give
|
|
||||||
| you a convenient way to create models for testing and seeding your
|
|
||||||
| database. Just tell the factory how a default model should look.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$factory->define(App\User::class, function ($faker) {
|
$factory->define(App\User::class, function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => $faker->name,
|
'name' => $faker->name,
|
||||||
@ -19,3 +8,4 @@ $factory->define(App\User::class, function ($faker) {
|
|||||||
'remember_token' => str_random(10),
|
'remember_token' => str_random(10),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
Author:
|
|
||||||
belongsTo: book
|
|
||||||
fields:
|
|
||||||
name:
|
|
||||||
schema: string
|
|
||||||
tags: fillable
|
|
||||||
Book:
|
|
||||||
belongsTo: librarys # Yes I know it's misspelled...
|
|
||||||
hasOne: author
|
|
||||||
fields:
|
|
||||||
title:
|
|
||||||
schema: string
|
|
||||||
tags: fillable
|
|
||||||
published:
|
|
||||||
schema: date
|
|
||||||
tags: fillable
|
|
||||||
Library:
|
|
||||||
hasMany: books
|
|
||||||
fields:
|
|
||||||
name:
|
|
||||||
schema: string
|
|
||||||
tags: fillable
|
|
||||||
address:
|
|
||||||
schema: string
|
|
||||||
tags: fillable
|
|
@ -1,4 +1,4 @@
|
|||||||
<?php //[STAMP] d6606f78456705b0875c6b8343fc6a4a
|
<?php //[STAMP] 6172d62f52ee53bf8d6f975a52df4f0d
|
||||||
namespace _generated;
|
namespace _generated;
|
||||||
|
|
||||||
// This class was automatically generated by build task
|
// This class was automatically generated by build task
|
||||||
@ -17,22 +17,6 @@ trait AcceptanceTesterActions
|
|||||||
abstract protected function getScenario();
|
abstract protected function getScenario();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks that array contains subset.
|
|
||||||
*
|
|
||||||
* @param array $subset
|
|
||||||
* @param array $array
|
|
||||||
* @param bool $strict
|
|
||||||
* @param string $message
|
|
||||||
* @see \Codeception\Module::assertArraySubset()
|
|
||||||
*/
|
|
||||||
public function assertArraySubset($subset, $array, $strict = null, $message = null) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
@ -111,7 +95,7 @@ trait AcceptanceTesterActions
|
|||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
* @param $regex
|
*
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
* @see \Codeception\Module\Cli::seeShellOutputMatches()
|
* @see \Codeception\Module\Cli::seeShellOutputMatches()
|
||||||
*/
|
*/
|
||||||
@ -121,7 +105,7 @@ trait AcceptanceTesterActions
|
|||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
* @param $regex
|
*
|
||||||
* @see \Codeception\Module\Cli::seeShellOutputMatches()
|
* @see \Codeception\Module\Cli::seeShellOutputMatches()
|
||||||
*/
|
*/
|
||||||
public function seeShellOutputMatches($regex) {
|
public function seeShellOutputMatches($regex) {
|
||||||
@ -129,83 +113,13 @@ trait AcceptanceTesterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks result code
|
|
||||||
*
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->seeResultCodeIs(0);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param $code
|
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
|
||||||
* @see \Codeception\Module\Cli::seeResultCodeIs()
|
|
||||||
*/
|
|
||||||
public function canSeeResultCodeIs($code) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResultCodeIs', func_get_args()));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks result code
|
|
||||||
*
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->seeResultCodeIs(0);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param $code
|
|
||||||
* @see \Codeception\Module\Cli::seeResultCodeIs()
|
|
||||||
*/
|
|
||||||
public function seeResultCodeIs($code) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResultCodeIs', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks result code
|
|
||||||
*
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->seeResultCodeIsNot(0);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param $code
|
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
|
||||||
* @see \Codeception\Module\Cli::seeResultCodeIsNot()
|
|
||||||
*/
|
|
||||||
public function canSeeResultCodeIsNot($code) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResultCodeIsNot', func_get_args()));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks result code
|
|
||||||
*
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->seeResultCodeIsNot(0);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param $code
|
|
||||||
* @see \Codeception\Module\Cli::seeResultCodeIsNot()
|
|
||||||
*/
|
|
||||||
public function seeResultCodeIsNot($code) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResultCodeIsNot', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
* Enters a directory In local filesystem.
|
* Enters a directory In local filesystem.
|
||||||
* Project root directory is used by default
|
* Project root directory is used by default
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param $path
|
||||||
* @see \Codeception\Module\Filesystem::amInPath()
|
* @see \Codeception\Module\Filesystem::amInPath()
|
||||||
*/
|
*/
|
||||||
public function amInPath($path) {
|
public function amInPath($path) {
|
||||||
@ -227,7 +141,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param $filename
|
||||||
* @see \Codeception\Module\Filesystem::openFile()
|
* @see \Codeception\Module\Filesystem::openFile()
|
||||||
*/
|
*/
|
||||||
public function openFile($filename) {
|
public function openFile($filename) {
|
||||||
@ -246,7 +160,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param $filename
|
||||||
* @see \Codeception\Module\Filesystem::deleteFile()
|
* @see \Codeception\Module\Filesystem::deleteFile()
|
||||||
*/
|
*/
|
||||||
public function deleteFile($filename) {
|
public function deleteFile($filename) {
|
||||||
@ -265,7 +179,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $dirname
|
* @param $dirname
|
||||||
* @see \Codeception\Module\Filesystem::deleteDir()
|
* @see \Codeception\Module\Filesystem::deleteDir()
|
||||||
*/
|
*/
|
||||||
public function deleteDir($dirname) {
|
public function deleteDir($dirname) {
|
||||||
@ -284,8 +198,8 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $src
|
* @param $src
|
||||||
* @param string $dst
|
* @param $dst
|
||||||
* @see \Codeception\Module\Filesystem::copyDir()
|
* @see \Codeception\Module\Filesystem::copyDir()
|
||||||
*/
|
*/
|
||||||
public function copyDir($src, $dst) {
|
public function copyDir($src, $dst) {
|
||||||
@ -307,7 +221,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param $text
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
* @see \Codeception\Module\Filesystem::seeInThisFile()
|
* @see \Codeception\Module\Filesystem::seeInThisFile()
|
||||||
*/
|
*/
|
||||||
@ -328,7 +242,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param $text
|
||||||
* @see \Codeception\Module\Filesystem::seeInThisFile()
|
* @see \Codeception\Module\Filesystem::seeInThisFile()
|
||||||
*/
|
*/
|
||||||
public function seeInThisFile($text) {
|
public function seeInThisFile($text) {
|
||||||
@ -384,7 +298,7 @@ trait AcceptanceTesterActions
|
|||||||
*
|
*
|
||||||
* Checks that contents of currently opened file matches $regex
|
* Checks that contents of currently opened file matches $regex
|
||||||
*
|
*
|
||||||
* @param string $regex
|
* @param $regex
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
* @see \Codeception\Module\Filesystem::seeThisFileMatches()
|
* @see \Codeception\Module\Filesystem::seeThisFileMatches()
|
||||||
*/
|
*/
|
||||||
@ -396,7 +310,7 @@ trait AcceptanceTesterActions
|
|||||||
*
|
*
|
||||||
* Checks that contents of currently opened file matches $regex
|
* Checks that contents of currently opened file matches $regex
|
||||||
*
|
*
|
||||||
* @param string $regex
|
* @param $regex
|
||||||
* @see \Codeception\Module\Filesystem::seeThisFileMatches()
|
* @see \Codeception\Module\Filesystem::seeThisFileMatches()
|
||||||
*/
|
*/
|
||||||
public function seeThisFileMatches($regex) {
|
public function seeThisFileMatches($regex) {
|
||||||
@ -419,7 +333,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param $text
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
* @see \Codeception\Module\Filesystem::seeFileContentsEqual()
|
* @see \Codeception\Module\Filesystem::seeFileContentsEqual()
|
||||||
*/
|
*/
|
||||||
@ -441,7 +355,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param $text
|
||||||
* @see \Codeception\Module\Filesystem::seeFileContentsEqual()
|
* @see \Codeception\Module\Filesystem::seeFileContentsEqual()
|
||||||
*/
|
*/
|
||||||
public function seeFileContentsEqual($text) {
|
public function seeFileContentsEqual($text) {
|
||||||
@ -461,7 +375,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param $text
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
* @see \Codeception\Module\Filesystem::dontSeeInThisFile()
|
* @see \Codeception\Module\Filesystem::dontSeeInThisFile()
|
||||||
*/
|
*/
|
||||||
@ -480,7 +394,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param $text
|
||||||
* @see \Codeception\Module\Filesystem::dontSeeInThisFile()
|
* @see \Codeception\Module\Filesystem::dontSeeInThisFile()
|
||||||
*/
|
*/
|
||||||
public function dontSeeInThisFile($text) {
|
public function dontSeeInThisFile($text) {
|
||||||
@ -511,7 +425,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param $filename
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
* @see \Codeception\Module\Filesystem::seeFileFound()
|
* @see \Codeception\Module\Filesystem::seeFileFound()
|
||||||
@ -531,7 +445,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param $filename
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @see \Codeception\Module\Filesystem::seeFileFound()
|
* @see \Codeception\Module\Filesystem::seeFileFound()
|
||||||
*/
|
*/
|
||||||
@ -545,7 +459,7 @@ trait AcceptanceTesterActions
|
|||||||
*
|
*
|
||||||
* Checks if file does not exist in path
|
* Checks if file does not exist in path
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param $filename
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* Conditional Assertion: Test won't be stopped on fail
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
* @see \Codeception\Module\Filesystem::dontSeeFileFound()
|
* @see \Codeception\Module\Filesystem::dontSeeFileFound()
|
||||||
@ -558,7 +472,7 @@ trait AcceptanceTesterActions
|
|||||||
*
|
*
|
||||||
* Checks if file does not exist in path
|
* Checks if file does not exist in path
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param $filename
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @see \Codeception\Module\Filesystem::dontSeeFileFound()
|
* @see \Codeception\Module\Filesystem::dontSeeFileFound()
|
||||||
*/
|
*/
|
||||||
@ -578,7 +492,7 @@ trait AcceptanceTesterActions
|
|||||||
* ?>
|
* ?>
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param string $dirname
|
* @param $dirname
|
||||||
* @see \Codeception\Module\Filesystem::cleanDir()
|
* @see \Codeception\Module\Filesystem::cleanDir()
|
||||||
*/
|
*/
|
||||||
public function cleanDir($dirname) {
|
public function cleanDir($dirname) {
|
||||||
@ -591,8 +505,8 @@ trait AcceptanceTesterActions
|
|||||||
*
|
*
|
||||||
* Saves contents to file
|
* Saves contents to file
|
||||||
*
|
*
|
||||||
* @param string $filename
|
* @param $filename
|
||||||
* @param string $contents
|
* @param $contents
|
||||||
* @see \Codeception\Module\Filesystem::writeToFile()
|
* @see \Codeception\Module\Filesystem::writeToFile()
|
||||||
*/
|
*/
|
||||||
public function writeToFile($filename, $contents) {
|
public function writeToFile($filename, $contents) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php //[STAMP] d2a298893573661fdbd787dcfa27a7b0
|
<?php //[STAMP] 113b78942a9c8ce85a7c18397003b17c
|
||||||
namespace _generated;
|
namespace _generated;
|
||||||
|
|
||||||
// This class was automatically generated by build task
|
// This class was automatically generated by build task
|
||||||
@ -15,18 +15,4 @@ trait FunctionalTesterActions
|
|||||||
abstract protected function getScenario();
|
abstract protected function getScenario();
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks that array contains subset.
|
|
||||||
*
|
|
||||||
* @param array $subset
|
|
||||||
* @param array $array
|
|
||||||
* @param bool $strict
|
|
||||||
* @param string $message
|
|
||||||
* @see \Codeception\Module::assertArraySubset()
|
|
||||||
*/
|
|
||||||
public function assertArraySubset($subset, $array, $strict = null, $message = null) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php //[STAMP] 1467e0d5027bbc2413077351642a21f3
|
<?php //[STAMP] afa4f0350422fae145b4236dce66191a
|
||||||
namespace _generated;
|
namespace _generated;
|
||||||
|
|
||||||
// This class was automatically generated by build task
|
// This class was automatically generated by build task
|
||||||
@ -19,29 +19,14 @@ trait UnitTesterActions
|
|||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
* Checks that two variables are equal. If you're comparing floating-point values,
|
* Checks that two variables are equal.
|
||||||
* you can specify the optional "delta" parameter which dictates how great of a precision
|
|
||||||
* error are you willing to tolerate in order to consider the two values equal.
|
|
||||||
*
|
|
||||||
* Regular example:
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->assertEquals($element->getChildrenCount(), 5);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Floating-point example:
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01);
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @param $expected
|
* @param $expected
|
||||||
* @param $actual
|
* @param $actual
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param float $delta
|
|
||||||
* @see \Codeception\Module\Asserts::assertEquals()
|
* @see \Codeception\Module\Asserts::assertEquals()
|
||||||
*/
|
*/
|
||||||
public function assertEquals($expected, $actual, $message = null, $delta = null) {
|
public function assertEquals($expected, $actual, $message = null) {
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args()));
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,29 +34,14 @@ trait UnitTesterActions
|
|||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
* Checks that two variables are not equal. If you're comparing floating-point values,
|
* Checks that two variables are not equal
|
||||||
* you can specify the optional "delta" parameter which dictates how great of a precision
|
|
||||||
* error are you willing to tolerate in order to consider the two values not equal.
|
|
||||||
*
|
|
||||||
* Regular example:
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->assertNotEquals($element->getChildrenCount(), 0);
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* Floating-point example:
|
|
||||||
* ```php
|
|
||||||
* <?php
|
|
||||||
* $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01);
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @param $expected
|
* @param $expected
|
||||||
* @param $actual
|
* @param $actual
|
||||||
* @param string $message
|
* @param string $message
|
||||||
* @param float $delta
|
|
||||||
* @see \Codeception\Module\Asserts::assertNotEquals()
|
* @see \Codeception\Module\Asserts::assertNotEquals()
|
||||||
*/
|
*/
|
||||||
public function assertNotEquals($expected, $actual, $message = null, $delta = null) {
|
public function assertNotEquals($expected, $actual, $message = null) {
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args()));
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +54,7 @@ trait UnitTesterActions
|
|||||||
* @param $expected
|
* @param $expected
|
||||||
* @param $actual
|
* @param $actual
|
||||||
* @param string $message
|
* @param string $message
|
||||||
|
* @return mixed|void
|
||||||
* @see \Codeception\Module\Asserts::assertSame()
|
* @see \Codeception\Module\Asserts::assertSame()
|
||||||
*/
|
*/
|
||||||
public function assertSame($expected, $actual, $message = null) {
|
public function assertSame($expected, $actual, $message = null) {
|
||||||
@ -226,36 +197,6 @@ trait UnitTesterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks that a string starts with the given prefix.
|
|
||||||
*
|
|
||||||
* @param string $prefix
|
|
||||||
* @param string $string
|
|
||||||
* @param string $message
|
|
||||||
* @see \Codeception\Module\Asserts::assertStringStartsWith()
|
|
||||||
*/
|
|
||||||
public function assertStringStartsWith($prefix, $string, $message = null) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks that a string doesn't start with the given prefix.
|
|
||||||
*
|
|
||||||
* @param string $prefix
|
|
||||||
* @param string $string
|
|
||||||
* @param string $message
|
|
||||||
* @see \Codeception\Module\Asserts::assertStringStartsNotWith()
|
|
||||||
*/
|
|
||||||
public function assertStringStartsNotWith($prefix, $string, $message = null) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
@ -432,22 +373,6 @@ trait UnitTesterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* Checks that array contains subset.
|
|
||||||
*
|
|
||||||
* @param array $subset
|
|
||||||
* @param array $array
|
|
||||||
* @param bool $strict
|
|
||||||
* @param string $message
|
|
||||||
* @see \Codeception\Module::assertArraySubset()
|
|
||||||
*/
|
|
||||||
public function assertArraySubset($subset, $array, $strict = null, $message = null) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
|
@ -1,136 +0,0 @@
|
|||||||
<?php
|
|
||||||
$I = new AcceptanceTester($scenario);
|
|
||||||
|
|
||||||
$I->wantTo('Generate RESTful resources from a file');
|
|
||||||
$I->writeToFile('database/database.sqlite', '');
|
|
||||||
|
|
||||||
$I->runShellCommand('php artisan wn:resources tests/_data/ResourcesTest.yml');
|
|
||||||
|
|
||||||
// Checking the model
|
|
||||||
$I->seeInShellOutput('Author model generated');
|
|
||||||
$I->seeInShellOutput('Book model generated');
|
|
||||||
$I->seeInShellOutput('Library model generated');
|
|
||||||
$I->seeFileFound('./app/Author.php');
|
|
||||||
$I->seeFileFound('./app/Book.php');
|
|
||||||
$I->seeFileFound('./app/Library.php');
|
|
||||||
$I->deleteFile('./app/Author.php');
|
|
||||||
$I->deleteFile('./app/Book.php');
|
|
||||||
$I->deleteFile('./app/Library.php');
|
|
||||||
|
|
||||||
// Checking the migration
|
|
||||||
$I->seeInShellOutput('authors migration generated');
|
|
||||||
$I->seeInShellOutput('books migration generated');
|
|
||||||
$I->seeInShellOutput('libraries migration generated');
|
|
||||||
// Can't check for specific file names, so we'll just strip the directory
|
|
||||||
$I->cleanDir('database/migrations');
|
|
||||||
$I->writeToFile('database/migrations/.gitkeep', '');
|
|
||||||
|
|
||||||
// Checking the RESTActions trait
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/RESTActions.php');
|
|
||||||
$I->deleteFile('./app/Http/Controllers/RESTActions.php');
|
|
||||||
|
|
||||||
// Checking the controller
|
|
||||||
$I->seeInShellOutput('AuthorsController generated');
|
|
||||||
$I->seeInShellOutput('LibrariesController generated');
|
|
||||||
$I->seeInShellOutput('BooksController generated');
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/AuthorsController.php');
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/LibrariesController.php');
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/BooksController.php');
|
|
||||||
|
|
||||||
$I->deleteFile('./app/Http/Controllers/AuthorsController.php');
|
|
||||||
$I->deleteFile('./app/Http/Controllers/LibrariesController.php');
|
|
||||||
$I->deleteFile('./app/Http/Controllers/BooksController.php');
|
|
||||||
|
|
||||||
|
|
||||||
// Checking routes
|
|
||||||
$I->openFile('./app/Http/routes.php');
|
|
||||||
$I->seeInThisFile('
|
|
||||||
$app->get(\'author\', \'AuthorsController@all\');
|
|
||||||
$app->get(\'author/{id}\', \'AuthorsController@get\');
|
|
||||||
$app->post(\'author\', \'AuthorsController@add\');
|
|
||||||
$app->put(\'author/{id}\', \'AuthorsController@put\');
|
|
||||||
$app->delete(\'author/{id}\', \'AuthorsController@remove\');');
|
|
||||||
|
|
||||||
$I->seeInThisFile('
|
|
||||||
$app->get(\'book\', \'BooksController@all\');
|
|
||||||
$app->get(\'book/{id}\', \'BooksController@get\');
|
|
||||||
$app->post(\'book\', \'BooksController@add\');
|
|
||||||
$app->put(\'book/{id}\', \'BooksController@put\');
|
|
||||||
$app->delete(\'book/{id}\', \'BooksController@remove\');');
|
|
||||||
|
|
||||||
$I->seeInThisFile('
|
|
||||||
$app->get(\'library\', \'LibrariesController@all\');
|
|
||||||
$app->get(\'library/{id}\', \'LibrariesController@get\');
|
|
||||||
$app->post(\'library\', \'LibrariesController@add\');
|
|
||||||
$app->put(\'library/{id}\', \'LibrariesController@put\');
|
|
||||||
$app->delete(\'library/{id}\', \'LibrariesController@remove\');');
|
|
||||||
$I->writeToFile('./app/Http/routes.php', '<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Application Routes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here is where you can register all of the routes for an application.
|
|
||||||
| It is a breeze. Simply tell Lumen the URIs it should respond to
|
|
||||||
| and give it the Closure to call when that URI is requested.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
$app->get("/", function () use ($app) {
|
|
||||||
return $app->welcome();
|
|
||||||
});
|
|
||||||
');
|
|
||||||
|
|
||||||
// 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', "<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Model Factories
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may define all of your model factories. Model factories give
|
|
||||||
| you a convenient way to create models for testing and seeding your
|
|
||||||
| database. Just tell the factory how a default model should look.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
\$factory->define(App\User::class, function (\$faker) {
|
|
||||||
return [
|
|
||||||
'name' => \$faker->name,
|
|
||||||
'email' => \$faker->email,
|
|
||||||
'password' => str_random(10),
|
|
||||||
'remember_token' => str_random(10),
|
|
||||||
];
|
|
||||||
});
|
|
||||||
");
|
|
||||||
|
|
||||||
$I->deleteFile('database/database.sqlite');
|
|
||||||
|
|
||||||
|
|
||||||
// Checking database seeder
|
|
||||||
// $I->openFile('./database/seeds/TaskCategoriesTableSeeder.php');
|
|
||||||
// $I->seeInThisFile('
|
|
||||||
// use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
// class TaskCategoriesTableSeeder extends Seeder
|
|
||||||
// {
|
|
||||||
// public function run()
|
|
||||||
// {
|
|
||||||
// factory(App\TaskCategory::class, 10)->create();
|
|
||||||
// }
|
|
||||||
// }');
|
|
||||||
// $I->deleteFile('./database/seeds/TaskCategoriesTableSeeder.php');
|
|
@ -1,124 +0,0 @@
|
|||||||
<?php
|
|
||||||
$I = new AcceptanceTester($scenario);
|
|
||||||
|
|
||||||
$I->wantTo('Generate RESTful resources from a file with Laravel Routes');
|
|
||||||
$I->writeToFile('database/database.sqlite', '');
|
|
||||||
$I->runShellCommand('php artisan wn:resources tests/_data/ResourcesTest.yml --laravel=true');
|
|
||||||
|
|
||||||
// Checking the model
|
|
||||||
$I->seeInShellOutput('Author model generated');
|
|
||||||
$I->seeInShellOutput('Book model generated');
|
|
||||||
$I->seeInShellOutput('Library model generated');
|
|
||||||
$I->seeFileFound('./app/Author.php');
|
|
||||||
$I->seeFileFound('./app/Book.php');
|
|
||||||
$I->seeFileFound('./app/Library.php');
|
|
||||||
$I->deleteFile('./app/Author.php');
|
|
||||||
$I->deleteFile('./app/Book.php');
|
|
||||||
$I->deleteFile('./app/Library.php');
|
|
||||||
|
|
||||||
// Checking the migration
|
|
||||||
$I->seeInShellOutput('authors migration generated');
|
|
||||||
$I->seeInShellOutput('books migration generated');
|
|
||||||
$I->seeInShellOutput('libraries migration generated');
|
|
||||||
// Can't check for specific file names, so we'll just strip the directory
|
|
||||||
$I->cleanDir('database/migrations');
|
|
||||||
$I->writeToFile('database/migrations/.gitkeep', '');
|
|
||||||
|
|
||||||
// Checking the RESTActions trait
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/RESTActions.php');
|
|
||||||
$I->deleteFile('./app/Http/Controllers/RESTActions.php');
|
|
||||||
|
|
||||||
// Checking the controller
|
|
||||||
$I->seeInShellOutput('AuthorsController generated');
|
|
||||||
$I->seeInShellOutput('LibrariesController generated');
|
|
||||||
$I->seeInShellOutput('BooksController generated');
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/AuthorsController.php');
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/LibrariesController.php');
|
|
||||||
$I->seeFileFound('./app/Http/Controllers/BooksController.php');
|
|
||||||
|
|
||||||
$I->deleteFile('./app/Http/Controllers/AuthorsController.php');
|
|
||||||
$I->deleteFile('./app/Http/Controllers/LibrariesController.php');
|
|
||||||
$I->deleteFile('./app/Http/Controllers/BooksController.php');
|
|
||||||
|
|
||||||
$I->seeFileFound('./routes/api.php');
|
|
||||||
|
|
||||||
$I->seeInThisFile('
|
|
||||||
Route::get(\'author\', \'AuthorsController@all\');
|
|
||||||
Route::get(\'author/{id}\', \'AuthorsController@get\');
|
|
||||||
Route::post(\'author\', \'AuthorsController@add\');
|
|
||||||
Route::put(\'author/{id}\', \'AuthorsController@put\');
|
|
||||||
Route::delete(\'author/{id}\', \'AuthorsController@remove\');');
|
|
||||||
|
|
||||||
$I->seeInThisFile('
|
|
||||||
Route::get(\'book\', \'BooksController@all\');
|
|
||||||
Route::get(\'book/{id}\', \'BooksController@get\');
|
|
||||||
Route::post(\'book\', \'BooksController@add\');
|
|
||||||
Route::put(\'book/{id}\', \'BooksController@put\');
|
|
||||||
Route::delete(\'book/{id}\', \'BooksController@remove\');');
|
|
||||||
|
|
||||||
$I->seeInThisFile('
|
|
||||||
Route::get(\'library\', \'LibrariesController@all\');
|
|
||||||
Route::get(\'library/{id}\', \'LibrariesController@get\');
|
|
||||||
Route::post(\'library\', \'LibrariesController@add\');
|
|
||||||
Route::put(\'library/{id}\', \'LibrariesController@put\');
|
|
||||||
Route::delete(\'library/{id}\', \'LibrariesController@remove\');');
|
|
||||||
$I->writeToFile('./app/Http/routes.php', '<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|------------------------------------------
|
|
||||||
| ***** DUMMY ROUTES FOR TESTING ONLY *****
|
|
||||||
|------------------------------------------
|
|
||||||
*/
|
|
||||||
');
|
|
||||||
|
|
||||||
// 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', "<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Model Factories
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may define all of your model factories. Model factories give
|
|
||||||
| you a convenient way to create models for testing and seeding your
|
|
||||||
| database. Just tell the factory how a default model should look.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
\$factory->define(App\User::class, function (\$faker) {
|
|
||||||
return [
|
|
||||||
'name' => \$faker->name,
|
|
||||||
'email' => \$faker->email,
|
|
||||||
'password' => str_random(10),
|
|
||||||
'remember_token' => str_random(10),
|
|
||||||
];
|
|
||||||
});
|
|
||||||
");
|
|
||||||
|
|
||||||
$I->deleteFile('database/database.sqlite');
|
|
||||||
|
|
||||||
// Checking database seeder
|
|
||||||
// $I->openFile('./database/seeds/TaskCategoriesTableSeeder.php');
|
|
||||||
// $I->seeInThisFile('
|
|
||||||
// use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
// class TaskCategoriesTableSeeder extends Seeder
|
|
||||||
// {
|
|
||||||
// public function run()
|
|
||||||
// {
|
|
||||||
// factory(App\TaskCategory::class, 10)->create();
|
|
||||||
// }
|
|
||||||
// }');
|
|
||||||
// $I->deleteFile('./database/seeds/TaskCategoriesTableSeeder.php');
|
|
@ -62,9 +62,7 @@ $app->get("/", function () use ($app) {
|
|||||||
|
|
||||||
|
|
||||||
$I->wantTo('run wn:routes in Lumen 5.3+');
|
$I->wantTo('run wn:routes in Lumen 5.3+');
|
||||||
if(!file_exists('./routes')) {
|
mkdir('./routes');
|
||||||
mkdir('./routes');
|
|
||||||
}
|
|
||||||
$I->writeToFile('./routes/web.php', '<?php
|
$I->writeToFile('./routes/web.php', '<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
<?php namespace Wn\Generators\Commands;
|
<?php namespace Wn\Generators\Commands;
|
||||||
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class ControllerCommand extends BaseCommand {
|
class ControllerCommand extends BaseCommand {
|
||||||
|
|
||||||
protected $signature = 'wn:controller
|
protected $signature = 'wn:controller
|
||||||
{model : Name of the model (with namespace if not App)}
|
{model : Name of the model (with namespace if not App)}
|
||||||
{--no-routes= : without routes}
|
{--no-routes= : without routes}
|
||||||
{--force= : override the existing files}
|
{--force= : override the existing files}
|
||||||
{--laravel : Use Laravel style route definitions}
|
|
||||||
';
|
';
|
||||||
|
|
||||||
protected $description = 'Generates RESTful controller using the RESTActions trait';
|
protected $description = 'Generates RESTful controller using the RESTActions trait';
|
||||||
@ -34,17 +31,12 @@ class ControllerCommand extends BaseCommand {
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
$this->save($content, "./app/Http/Controllers/{$controller}.php", "{$controller}");
|
$this->save($content, "./app/Http/Controllers/{$controller}.php", "{$controller}");
|
||||||
|
|
||||||
if(! $this->option('no-routes')){
|
if(! $this->option('no-routes')){
|
||||||
$options = [
|
$this->call('wn:route', [
|
||||||
'resource' => snake_case($name, '-'),
|
'resource' => snake_case($name, '-'),
|
||||||
'--controller' => $controller,
|
'--controller' => $controller
|
||||||
];
|
]);
|
||||||
|
|
||||||
if ($this->option('laravel')) {
|
|
||||||
$options['--laravel'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->call('wn:route', $options);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
class MigrationCommand extends BaseCommand {
|
class MigrationCommand extends BaseCommand {
|
||||||
|
|
||||||
protected $signature = 'wn:migration
|
protected $signature = 'wn:migration
|
||||||
{table : The table name.}
|
{table : The table name.}
|
||||||
{--schema= : the schema.}
|
{--schema= : the schema.}
|
||||||
{--add= : specifies additional columns like timestamps, softDeletes, rememberToken and nullableTimestamps.}
|
{--add= : specifies additional columns like timestamps, softDeletes, rememberToken and nullableTimestamps.}
|
||||||
@ -12,16 +12,15 @@ class MigrationCommand extends BaseCommand {
|
|||||||
{--parsed : tells the command that arguments have been already parsed. To use when calling the command from an other command and passing the parsed arguments and options}
|
{--parsed : tells the command that arguments have been already parsed. To use when calling the command from an other command and passing the parsed arguments and options}
|
||||||
{--force= : override the existing files}
|
{--force= : override the existing files}
|
||||||
';
|
';
|
||||||
// {action : One of create, add, remove or drop options.}
|
// {action : One of create, add, remove or drop options.}
|
||||||
// The action is only create for the moment
|
// The action is only create for the moment
|
||||||
|
|
||||||
protected $description = 'Generates a migration to create a table with schema';
|
protected $description = 'Generates a migration to create a table with schema';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$table = $this->argument('table');
|
$table = $this->argument('table');
|
||||||
$name = 'Create' . ucwords(camel_case($table));
|
$name = 'Create' . ucwords(camel_case($table));
|
||||||
$snakeName = snake_case($name);
|
|
||||||
|
|
||||||
$content = $this->getTemplate('migration')
|
$content = $this->getTemplate('migration')
|
||||||
->with([
|
->with([
|
||||||
@ -35,26 +34,12 @@ class MigrationCommand extends BaseCommand {
|
|||||||
|
|
||||||
$file = $this->option('file');
|
$file = $this->option('file');
|
||||||
if(! $file){
|
if(! $file){
|
||||||
$file = date('Y_m_d_His_') . $snakeName . '_table';
|
$file = date('Y_m_d_His_') . snake_case($name) . '_table';
|
||||||
$this->deleteOldMigration($snakeName);
|
|
||||||
}else{
|
|
||||||
$this->deleteOldMigration($file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->save($content, "./database/migrations/{$file}.php", "{$table} migration");
|
$this->save($content, "./database/migrations/{$file}.php", "{$table} migration");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function deleteOldMigration($fileName)
|
|
||||||
{
|
|
||||||
foreach (new \DirectoryIterator("./database/migrations/") as $fileInfo){
|
|
||||||
if($fileInfo->isDot()) continue;
|
|
||||||
|
|
||||||
if(strpos($fileInfo->getFilename(), $fileName) !== FALSE){
|
|
||||||
unlink($fileInfo->getPathname());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getSchema()
|
protected function getSchema()
|
||||||
{
|
{
|
||||||
$schema = $this->option('schema');
|
$schema = $this->option('schema');
|
||||||
@ -142,20 +127,20 @@ class MigrationCommand extends BaseCommand {
|
|||||||
|
|
||||||
if($key['on_delete']){
|
if($key['on_delete']){
|
||||||
$constraint .= PHP_EOL . $this->getTemplate('migration/on-constraint')
|
$constraint .= PHP_EOL . $this->getTemplate('migration/on-constraint')
|
||||||
->with([
|
->with([
|
||||||
'event' => 'Delete',
|
'event' => 'Delete',
|
||||||
'action' => $key['on_delete']
|
'action' => $key['on_delete']
|
||||||
])
|
])
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($key['on_update']){
|
if($key['on_update']){
|
||||||
$constraint .= PHP_EOL . $this->getTemplate('migration/on-constraint')
|
$constraint .= PHP_EOL . $this->getTemplate('migration/on-constraint')
|
||||||
->with([
|
->with([
|
||||||
'event' => 'Update',
|
'event' => 'Update',
|
||||||
'action' => $key['on_update']
|
'action' => $key['on_update']
|
||||||
])
|
])
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $constraint . ';';
|
return $constraint . ';';
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<?php namespace Wn\Generators\Commands;
|
<?php namespace Wn\Generators\Commands;
|
||||||
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class ResourceCommand extends BaseCommand {
|
class ResourceCommand extends BaseCommand {
|
||||||
|
|
||||||
protected $signature = 'wn:resource
|
protected $signature = 'wn:resource
|
||||||
@ -17,7 +15,6 @@ class ResourceCommand extends BaseCommand {
|
|||||||
{--path=app : where to store the model file.}
|
{--path=app : where to store the model file.}
|
||||||
{--parsed : tells the command that arguments have been already parsed. To use when calling the command from an other command and passing the parsed arguments and options}
|
{--parsed : tells the command that arguments have been already parsed. To use when calling the command from an other command and passing the parsed arguments and options}
|
||||||
{--force= : override the existing files}
|
{--force= : override the existing files}
|
||||||
{--laravel= : Use Laravel style route definitions}
|
|
||||||
';
|
';
|
||||||
|
|
||||||
protected $description = 'Generates a model, migration, controller and routes for RESTful resource';
|
protected $description = 'Generates a model, migration, controller and routes for RESTful resource';
|
||||||
@ -64,16 +61,13 @@ class ResourceCommand extends BaseCommand {
|
|||||||
if(! $this->fs->exists('./app/Http/Controllers/RESTActions.php')){
|
if(! $this->fs->exists('./app/Http/Controllers/RESTActions.php')){
|
||||||
$this->call('wn:controller:rest-actions');
|
$this->call('wn:controller:rest-actions');
|
||||||
}
|
}
|
||||||
|
|
||||||
// generating the controller and routes
|
// generating the controller and routes
|
||||||
$controllerOptions = [
|
$this->call('wn:controller', [
|
||||||
'model' => $modelName,
|
'model' => $modelName,
|
||||||
'--force' => $this->option('force'),
|
'--force' => $this->option('force'),
|
||||||
'--no-routes' => false,
|
'--no-routes' => false
|
||||||
];
|
]);
|
||||||
if ($this->option('laravel')) {
|
|
||||||
$controllerOptions['--laravel'] = true;
|
|
||||||
}
|
|
||||||
$this->call('wn:controller', $controllerOptions);
|
|
||||||
|
|
||||||
// generating model factory
|
// generating model factory
|
||||||
$this->call('wn:factory', [
|
$this->call('wn:factory', [
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?php namespace Wn\Generators\Commands;
|
<?php namespace Wn\Generators\Commands;
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
|
|
||||||
@ -10,8 +9,6 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
{file : Path to the file containing resources declarations}
|
{file : Path to the file containing resources declarations}
|
||||||
{--path=app : where to store the model files.}
|
{--path=app : where to store the model files.}
|
||||||
{--force= : override the existing files}
|
{--force= : override the existing files}
|
||||||
{--laravel= : Use Laravel style route definitions}
|
|
||||||
|
|
||||||
';
|
';
|
||||||
|
|
||||||
protected $description = 'Generates multiple resources from a file';
|
protected $description = 'Generates multiple resources from a file';
|
||||||
@ -23,14 +20,10 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
$content = $this->fs->get($this->argument('file'));
|
$content = $this->fs->get($this->argument('file'));
|
||||||
$content = Yaml::parse($content);
|
$content = Yaml::parse($content);
|
||||||
|
|
||||||
$modelIndex = 0;
|
|
||||||
foreach ($content as $model => $i){
|
foreach ($content as $model => $i){
|
||||||
$i = $this->getResourceParams($model, $i);
|
$i = $this->getResourceParams($model, $i);
|
||||||
$migrationName = 'Create' . ucwords(str_plural($i['name']));
|
|
||||||
$migrationFile = date('Y_m_d_His') . '-' . str_pad($modelIndex , 3, 0, STR_PAD_LEFT) . '_' . snake_case($migrationName) . '_table';
|
|
||||||
|
|
||||||
|
$this->call('wn:resource', [
|
||||||
$options = [
|
|
||||||
'name' => $i['name'],
|
'name' => $i['name'],
|
||||||
'fields' => $i['fields'],
|
'fields' => $i['fields'],
|
||||||
'--add' => $i['add'],
|
'--add' => $i['add'],
|
||||||
@ -39,15 +32,8 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
'--belongs-to' => $i['belongsTo'],
|
'--belongs-to' => $i['belongsTo'],
|
||||||
'--belongs-to-many' => $i['belongsToMany'],
|
'--belongs-to-many' => $i['belongsToMany'],
|
||||||
'--path' => $this->option('path'),
|
'--path' => $this->option('path'),
|
||||||
'--force' => $this->option('force'),
|
'--force' => $this->option('force')
|
||||||
'--migration-file' => $migrationFile
|
]);
|
||||||
];
|
|
||||||
if ($this->option('laravel')) {
|
|
||||||
$options['--laravel'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->call('wn:resource', $options);
|
|
||||||
$modelIndex++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->call('migrate'); // actually needed for pivot seeders !
|
// $this->call('migrate'); // actually needed for pivot seeders !
|
||||||
@ -119,9 +105,6 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
$name = $field['name'];
|
$name = $field['name'];
|
||||||
$schema = $this->convertArray(str_replace(':', '.', $field['schema']), ' ', ':');
|
$schema = $this->convertArray(str_replace(':', '.', $field['schema']), ' ', ':');
|
||||||
$rules = (isset($field['rules'])) ? trim($field['rules']) : '';
|
$rules = (isset($field['rules'])) ? trim($field['rules']) : '';
|
||||||
// Replace space by comma
|
|
||||||
$rules = str_replace(' ', ',', $rules);
|
|
||||||
|
|
||||||
$tags = $this->convertArray($field['tags'], ' ', ',');
|
$tags = $this->convertArray($field['tags'], ' ', ',');
|
||||||
|
|
||||||
$string = "{$name};{$schema};{$rules};{$tags}";
|
$string = "{$name};{$schema};{$rules};{$tags}";
|
||||||
|
@ -1,66 +1,31 @@
|
|||||||
<?php namespace Wn\Generators\Commands;
|
<?php namespace Wn\Generators\Commands;
|
||||||
|
|
||||||
|
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
class RouteCommand extends BaseCommand {
|
class RouteCommand extends BaseCommand {
|
||||||
|
|
||||||
protected $signature = 'wn:route
|
protected $signature = 'wn:route
|
||||||
{resource : Name of the resource.}
|
{resource : Name of the resource.}
|
||||||
{--controller= : Name of the RESTful controller.}
|
{--controller= : Name of the RESTful controller.}';
|
||||||
{--laravel= : Use Laravel style route definitions}
|
|
||||||
';
|
|
||||||
|
|
||||||
protected $description = 'Generates RESTful routes.';
|
protected $description = 'Generates RESTful routes.';
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$resource = $this->argument('resource');
|
$resource = $this->argument('resource');
|
||||||
$laravelRoutes = $this->option('laravel');
|
|
||||||
$templateFile = 'routes';
|
|
||||||
$routesPath = 'routes/web.php';
|
|
||||||
if ($laravelRoutes) {
|
|
||||||
$templateFile = 'routes-laravel';
|
|
||||||
$routesPath = 'routes/api.php';
|
|
||||||
if (!$this->fs->isFile($routesPath)) {
|
|
||||||
if (!$this->fs->isDirectory('./routes')) {
|
|
||||||
$this->fs->makeDirectory('./routes');
|
|
||||||
}
|
|
||||||
$this->fs->put($routesPath, "
|
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
$routesPath = './routes/web.php';
|
||||||
|
if (! $this->fs->exists($routesPath))
|
||||||
|
$routesPath = './app/Http/routes.php';
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| API Routes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here is where you can register API routes for your application. These
|
|
||||||
| routes are loaded by the RouteServiceProvider within a group which
|
|
||||||
| is assigned the \"api\" middleware group. Enjoy building your API!
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
Route::middleware('auth:api')->get('/user', function (Request \$request) {
|
|
||||||
return \$request->user();
|
|
||||||
});
|
|
||||||
|
|
||||||
");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->fs->isFile($routesPath)) {
|
|
||||||
$routesPath = 'app/Http/routes.php';
|
|
||||||
}
|
|
||||||
$content = $this->fs->get($routesPath);
|
$content = $this->fs->get($routesPath);
|
||||||
|
|
||||||
$content .= PHP_EOL . $this->getTemplate($templateFile)
|
$content .= PHP_EOL . $this->getTemplate('routes')
|
||||||
->with([
|
->with([
|
||||||
'resource' => $resource,
|
'resource' => $resource,
|
||||||
'controller' => $this->getController()
|
'controller' => $this->getController()
|
||||||
])
|
])
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$this->save($content, $routesPath, "{$resource} routes", true);
|
$this->save($content, $routesPath, "{$resource} routes", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class {{name}} extends Controller {
|
class {{name}} extends Controller {
|
||||||
|
|
||||||
const MODEL = '{{model}}';
|
const MODEL = "{{model}}";
|
||||||
|
|
||||||
use RESTActions;
|
use RESTActions;
|
||||||
|
|
||||||
|
@ -53,12 +53,6 @@ trait RESTActions {
|
|||||||
|
|
||||||
protected function respond($status, $data = [])
|
protected function respond($status, $data = [])
|
||||||
{
|
{
|
||||||
if($status == Response::HTTP_NO_CONTENT){
|
|
||||||
return response(null,Response::HTTP_NO_CONTENT);
|
|
||||||
}
|
|
||||||
if($status == Response::HTTP_NOT_FOUND){
|
|
||||||
return response(['message'=>'resource not found'],Response::HTTP_NOT_FOUND);
|
|
||||||
}
|
|
||||||
return response()->json($data, $status);
|
return response()->json($data, $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* Routes for resource {{resource}}
|
|
||||||
*/
|
|
||||||
Route::get('{{resource}}', '{{controller}}@all');
|
|
||||||
Route::get('{{resource}}/{id}', '{{controller}}@get');
|
|
||||||
Route::post('{{resource}}', '{{controller}}@add');
|
|
||||||
Route::put('{{resource}}/{id}', '{{controller}}@put');
|
|
||||||
Route::delete('{{resource}}/{id}', '{{controller}}@remove');
|
|
@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* Routes for resource {{resource}}
|
* Routes for resource {{resource}}
|
||||||
*/
|
*/
|
||||||
$router->get('{{resource}}', '{{controller}}@all');
|
$app->get('{{resource}}', '{{controller}}@all');
|
||||||
$router->get('{{resource}}/{id}', '{{controller}}@get');
|
$app->get('{{resource}}/{id}', '{{controller}}@get');
|
||||||
$router->post('{{resource}}', '{{controller}}@add');
|
$app->post('{{resource}}', '{{controller}}@add');
|
||||||
$router->put('{{resource}}/{id}', '{{controller}}@put');
|
$app->put('{{resource}}/{id}', '{{controller}}@put');
|
||||||
$router->delete('{{resource}}/{id}', '{{controller}}@remove');
|
$app->delete('{{resource}}/{id}', '{{controller}}@remove');
|
||||||
|
9
test.sh
9
test.sh
@ -1,9 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Runing tests for Lumen
|
# Runing tests for Lumen
|
||||||
cd lumen-test || return
|
cd lumen-test
|
||||||
|
wget http://codeception.com/codecept.phar
|
||||||
if [ ! -f codecept.phar ]; then
|
|
||||||
wget http://codeception.com/codecept.phar
|
|
||||||
fi
|
|
||||||
php codecept.phar run
|
php codecept.phar run
|
Loading…
x
Reference in New Issue
Block a user