mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2025-04-16 14:12:26 +03:00
Fixing the failing build
This commit is contained in:
parent
942b8fefb4
commit
17bc595db9
@ -8,7 +8,7 @@ php:
|
|||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- php: 7.0
|
- php: hhvm
|
||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
|
1
lumen-test/.gitignore
vendored
1
lumen-test/.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
tests/_output/*
|
tests/_output/*
|
||||||
|
|
||||||
composer.lock
|
composer.lock
|
||||||
|
tests/_output/*
|
@ -1,10 +0,0 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectsController extends Controller {
|
|
||||||
|
|
||||||
const MODEL = "App\Project";
|
|
||||||
|
|
||||||
use RESTActions;
|
|
||||||
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
|
|
||||||
class TagsController extends Controller {
|
|
||||||
|
|
||||||
const MODEL = "App\Tag";
|
|
||||||
|
|
||||||
use RESTActions;
|
|
||||||
|
|
||||||
}
|
|
@ -7,7 +7,7 @@ paths:
|
|||||||
envs: tests/_envs
|
envs: tests/_envs
|
||||||
settings:
|
settings:
|
||||||
bootstrap: _bootstrap.php
|
bootstrap: _bootstrap.php
|
||||||
colors: true
|
colors: false
|
||||||
memory_limit: 1024M
|
memory_limit: 1024M
|
||||||
extensions:
|
extensions:
|
||||||
enabled:
|
enabled:
|
||||||
|
@ -19,3 +19,24 @@ $factory->define(App\User::class, function ($faker) {
|
|||||||
'remember_token' => str_random(10),
|
'remember_token' => str_random(10),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
/**
|
||||||
|
* Factory definition for model App\Task.
|
||||||
|
*/
|
||||||
|
$factory->define(App\Task::class, function ($faker) {
|
||||||
|
return [
|
||||||
|
// Fields here
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory definition for model App\TaskCategory.
|
||||||
|
*/
|
||||||
|
$factory->define(App\TaskCategory::class, function ($faker) {
|
||||||
|
return [
|
||||||
|
'name' => $faker->word,
|
||||||
|
'descr' => $faker->paragraph,
|
||||||
|
'due' => $faker->date,
|
||||||
|
'project_id' => $faker->key,
|
||||||
|
'user_id' => $faker->key,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* A basic test example.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testBasicExample()
|
|
||||||
{
|
|
||||||
$this->visit('/')
|
|
||||||
->see('Lumen.');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class TestCase extends Laravel\Lumen\Testing\TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Creates the application.
|
|
||||||
*
|
|
||||||
* @return \Laravel\Lumen\Application
|
|
||||||
*/
|
|
||||||
public function createApplication()
|
|
||||||
{
|
|
||||||
return require __DIR__.'/../bootstrap/app.php';
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,7 +12,7 @@
|
|||||||
* @method void am($role)
|
* @method void am($role)
|
||||||
* @method void lookForwardTo($achieveValue)
|
* @method void lookForwardTo($achieveValue)
|
||||||
* @method void comment($description)
|
* @method void comment($description)
|
||||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD)
|
* @SuppressWarnings(PHPMD)
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* @method void am($role)
|
* @method void am($role)
|
||||||
* @method void lookForwardTo($achieveValue)
|
* @method void lookForwardTo($achieveValue)
|
||||||
* @method void comment($description)
|
* @method void comment($description)
|
||||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD)
|
* @SuppressWarnings(PHPMD)
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Helper;
|
namespace Helper;
|
||||||
|
|
||||||
// here you can define custom actions
|
// here you can define custom actions
|
||||||
// all public methods declared in helper class will be available in $I
|
// all public methods declared in helper class will be available in $I
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Helper;
|
namespace Helper;
|
||||||
|
|
||||||
// here you can define custom actions
|
// here you can define custom actions
|
||||||
// all public methods declared in helper class will be available in $I
|
// all public methods declared in helper class will be available in $I
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Helper;
|
namespace Helper;
|
||||||
|
|
||||||
// here you can define custom actions
|
// here you can define custom actions
|
||||||
// all public methods declared in helper class will be available in $I
|
// all public methods declared in helper class will be available in $I
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* @method void am($role)
|
* @method void am($role)
|
||||||
* @method void lookForwardTo($achieveValue)
|
* @method void lookForwardTo($achieveValue)
|
||||||
* @method void comment($description)
|
* @method void comment($description)
|
||||||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null)
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
*
|
*
|
||||||
* @SuppressWarnings(PHPMD)
|
* @SuppressWarnings(PHPMD)
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php //[STAMP] 90ca27738c5db3919bd1f5813987c735
|
<?php //[STAMP] 6172d62f52ee53bf8d6f975a52df4f0d
|
||||||
namespace _generated;
|
namespace _generated;
|
||||||
|
|
||||||
// This class was automatically generated by build task
|
// This class was automatically generated by build task
|
||||||
@ -250,6 +250,74 @@ trait AcceptanceTesterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks If opened file has the `number` of new lines.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* ``` php
|
||||||
|
* <?php
|
||||||
|
* $I->openFile('composer.json');
|
||||||
|
* $I->seeNumberNewLines(5);
|
||||||
|
* ?>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param int $number New lines
|
||||||
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
|
* @see \Codeception\Module\Filesystem::seeNumberNewLines()
|
||||||
|
*/
|
||||||
|
public function canSeeNumberNewLines($number) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeNumberNewLines', func_get_args()));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks If opened file has the `number` of new lines.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* ``` php
|
||||||
|
* <?php
|
||||||
|
* $I->openFile('composer.json');
|
||||||
|
* $I->seeNumberNewLines(5);
|
||||||
|
* ?>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param int $number New lines
|
||||||
|
* @see \Codeception\Module\Filesystem::seeNumberNewLines()
|
||||||
|
*/
|
||||||
|
public function seeNumberNewLines($number) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeNumberNewLines', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that contents of currently opened file matches $regex
|
||||||
|
*
|
||||||
|
* @param $regex
|
||||||
|
* Conditional Assertion: Test won't be stopped on fail
|
||||||
|
* @see \Codeception\Module\Filesystem::seeThisFileMatches()
|
||||||
|
*/
|
||||||
|
public function canSeeThisFileMatches($regex) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeThisFileMatches', func_get_args()));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that contents of currently opened file matches $regex
|
||||||
|
*
|
||||||
|
* @param $regex
|
||||||
|
* @see \Codeception\Module\Filesystem::seeThisFileMatches()
|
||||||
|
*/
|
||||||
|
public function seeThisFileMatches($regex) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeThisFileMatches', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php //[STAMP] ffada6587f597b23930f2f63d3309fd0
|
<?php //[STAMP] 113b78942a9c8ce85a7c18397003b17c
|
||||||
namespace _generated;
|
namespace _generated;
|
||||||
|
|
||||||
// This class was automatically generated by build task
|
// This class was automatically generated by build task
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php //[STAMP] c871459f363e639d6d4c21f535bb78f4
|
<?php //[STAMP] afa4f0350422fae145b4236dce66191a
|
||||||
namespace _generated;
|
namespace _generated;
|
||||||
|
|
||||||
// This class was automatically generated by build task
|
// This class was automatically generated by build task
|
||||||
@ -24,8 +24,6 @@ trait UnitTesterActions
|
|||||||
* @param $expected
|
* @param $expected
|
||||||
* @param $actual
|
* @param $actual
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
* @see \Codeception\Module\Asserts::assertEquals()
|
* @see \Codeception\Module\Asserts::assertEquals()
|
||||||
*/
|
*/
|
||||||
public function assertEquals($expected, $actual, $message = null) {
|
public function assertEquals($expected, $actual, $message = null) {
|
||||||
@ -56,8 +54,7 @@ trait UnitTesterActions
|
|||||||
* @param $expected
|
* @param $expected
|
||||||
* @param $actual
|
* @param $actual
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*
|
* @return mixed|void
|
||||||
* @return mixed
|
|
||||||
* @see \Codeception\Module\Asserts::assertSame()
|
* @see \Codeception\Module\Asserts::assertSame()
|
||||||
*/
|
*/
|
||||||
public function assertSame($expected, $actual, $message = null) {
|
public function assertSame($expected, $actual, $message = null) {
|
||||||
@ -95,17 +92,6 @@ trait UnitTesterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
* @see \Codeception\Module\Asserts::assertGreaterThen()
|
|
||||||
*/
|
|
||||||
public function assertGreaterThen($expected, $actual, $message = null) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
@ -121,17 +107,6 @@ trait UnitTesterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
|
||||||
*
|
|
||||||
* @deprecated
|
|
||||||
* @see \Codeception\Module\Asserts::assertGreaterThenOrEqual()
|
|
||||||
*/
|
|
||||||
public function assertGreaterThenOrEqual($expected, $actual, $message = null) {
|
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
@ -334,6 +309,122 @@ trait UnitTesterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertGreaterOrEquals()
|
||||||
|
*/
|
||||||
|
public function assertGreaterOrEquals($expected, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertLessOrEquals()
|
||||||
|
*/
|
||||||
|
public function assertLessOrEquals($expected, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertIsEmpty()
|
||||||
|
*/
|
||||||
|
public function assertIsEmpty($actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $key
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertArrayHasKey()
|
||||||
|
*/
|
||||||
|
public function assertArrayHasKey($key, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $key
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertArrayNotHasKey()
|
||||||
|
*/
|
||||||
|
public function assertArrayNotHasKey($key, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $expectedCount
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertCount()
|
||||||
|
*/
|
||||||
|
public function assertCount($expectedCount, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $class
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertInstanceOf()
|
||||||
|
*/
|
||||||
|
public function assertInstanceOf($class, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $class
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotInstanceOf()
|
||||||
|
*/
|
||||||
|
public function assertNotInstanceOf($class, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $type
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertInternalType()
|
||||||
|
*/
|
||||||
|
public function assertInternalType($type, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [!] Method is generated. Documentation taken from corresponding module.
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
*
|
*
|
||||||
@ -345,4 +436,38 @@ trait UnitTesterActions
|
|||||||
public function fail($message) {
|
public function fail($message) {
|
||||||
return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args()));
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Handles and checks exception called inside callback function.
|
||||||
|
* Either exception class name or exception instance should be provided.
|
||||||
|
*
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* $I->expectException(MyException::class, function() {
|
||||||
|
* $this->doSomethingBad();
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* $I->expectException(new MyException(), function() {
|
||||||
|
* $this->doSomethingBad();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* If you want to check message or exception code, you can pass them with exception instance:
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* // will check that exception MyException is thrown with "Don't do bad things" message
|
||||||
|
* $I->expectException(new MyException("Don't do bad things"), function() {
|
||||||
|
* $this->doSomethingBad();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param $exception string or \Exception
|
||||||
|
* @param $callback
|
||||||
|
* @see \Codeception\Module\Asserts::expectException()
|
||||||
|
*/
|
||||||
|
public function expectException($exception, $callback) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
class_name: AcceptanceTester
|
class_name: AcceptanceTester
|
||||||
modules:
|
modules:
|
||||||
enabled:
|
enabled:
|
||||||
# - PhpBrowser:
|
|
||||||
# url: http://localhost/myapp
|
|
||||||
- \Helper\Acceptance
|
- \Helper\Acceptance
|
||||||
- Cli
|
- Cli
|
||||||
- Filesystem
|
- Filesystem
|
@ -8,12 +8,11 @@ $I->seeFileFound('./app/Http/Controllers/TestsController.php');
|
|||||||
$I->openFile('./app/Http/Controllers/TestsController.php');
|
$I->openFile('./app/Http/Controllers/TestsController.php');
|
||||||
$I->seeFileContentsEqual('<?php namespace App\Http\Controllers;
|
$I->seeFileContentsEqual('<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
|
||||||
class TestsController extends Controller {
|
class TestsController extends Controller {
|
||||||
|
|
||||||
const MODEL = "App\\Test";
|
const MODEL = "App\\Test";
|
||||||
|
|
||||||
use RESTActions;
|
use RESTActions;
|
||||||
|
|
||||||
}
|
}
|
||||||
');
|
');
|
||||||
@ -26,12 +25,11 @@ $I->seeFileFound('./app/Http/Controllers/CategoriesController.php');
|
|||||||
$I->openFile('./app/Http/Controllers/CategoriesController.php');
|
$I->openFile('./app/Http/Controllers/CategoriesController.php');
|
||||||
$I->seeFileContentsEqual('<?php namespace App\Http\Controllers;
|
$I->seeFileContentsEqual('<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
|
||||||
class CategoriesController extends Controller {
|
class CategoriesController extends Controller {
|
||||||
|
|
||||||
const MODEL = "App\\Models\\Category";
|
const MODEL = "App\\Models\\Category";
|
||||||
|
|
||||||
use RESTActions;
|
use RESTActions;
|
||||||
|
|
||||||
}
|
}
|
||||||
');
|
');
|
||||||
|
@ -8,7 +8,7 @@ $I->openFile('./database/factories/ModelFactory.php');
|
|||||||
$I->seeInThisFile('
|
$I->seeInThisFile('
|
||||||
$factory->define(App\Task::class, function ($faker) {
|
$factory->define(App\Task::class, function ($faker) {
|
||||||
return [
|
return [
|
||||||
// Fields here
|
// Fields here
|
||||||
];
|
];
|
||||||
});');
|
});');
|
||||||
$I->writeToFile('./database/factories/ModelFactory.php', "<?php
|
$I->writeToFile('./database/factories/ModelFactory.php', "<?php
|
||||||
@ -39,10 +39,10 @@ $I->runShellCommand('php artisan wn:factory "App\Task" --fields="title:sentence(
|
|||||||
$I->seeInShellOutput('App\Task factory generated');
|
$I->seeInShellOutput('App\Task factory generated');
|
||||||
$I->openFile('./database/factories/ModelFactory.php');
|
$I->openFile('./database/factories/ModelFactory.php');
|
||||||
$I->seeInThisFile("
|
$I->seeInThisFile("
|
||||||
'title' => \$faker->sentence(3),
|
'title' => \$faker->sentence(3),
|
||||||
'description' => \$faker->paragraph(3),
|
'description' => \$faker->paragraph(3),
|
||||||
'due' => \$faker->date,
|
'due' => \$faker->date,
|
||||||
'hidden' => \$faker->boolean,
|
'hidden' => \$faker->boolean,
|
||||||
");
|
");
|
||||||
$I->writeToFile('./database/factories/ModelFactory.php', "<?php
|
$I->writeToFile('./database/factories/ModelFactory.php', "<?php
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ $I->openFile('./database/migrations/create_tasks.php');
|
|||||||
$I->seeInThisFile('$table->foreign(\'category_type_id\')
|
$I->seeInThisFile('$table->foreign(\'category_type_id\')
|
||||||
->references(\'id\')
|
->references(\'id\')
|
||||||
->on(\'category_types\');');
|
->on(\'category_types\');');
|
||||||
$I->seeInThisFile('$table->foreign(\'user_id\')
|
$I->seeInThisFile("\$table->foreign('user_id')
|
||||||
->references(\'identifier\')
|
->references('identifier')
|
||||||
->on(\'members\')
|
->on('members')
|
||||||
->onDelete(\'cascade\');');
|
->onDelete('cascade');");
|
||||||
$I->deleteFile('./database/migrations/create_tasks.php');
|
$I->deleteFile('./database/migrations/create_tasks.php');
|
@ -13,15 +13,15 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class TestingModel extends Model {
|
class TestingModel extends Model {
|
||||||
|
|
||||||
protected $fillable = [];
|
protected $fillable = [];
|
||||||
|
|
||||||
protected $dates = [];
|
protected $dates = [];
|
||||||
|
|
||||||
public static $rules = [
|
public static $rules = [
|
||||||
// Validation rules
|
// Validation rules
|
||||||
];
|
];
|
||||||
|
|
||||||
// Relationships
|
// Relationships
|
||||||
|
|
||||||
}
|
}
|
||||||
');
|
');
|
||||||
@ -43,22 +43,22 @@ $I->runShellCommand('php artisan wn:model TestingModel --has-many=accounts --bel
|
|||||||
$I->seeFileFound('./tests/tmp/TestingModel.php');
|
$I->seeFileFound('./tests/tmp/TestingModel.php');
|
||||||
$I->openFile('./tests/tmp/TestingModel.php');
|
$I->openFile('./tests/tmp/TestingModel.php');
|
||||||
$I->seeInThisFile('
|
$I->seeInThisFile('
|
||||||
public function accounts()
|
public function accounts()
|
||||||
{
|
{
|
||||||
return $this->hasMany("Tests\\Tmp\\Account");
|
return $this->hasMany("Tests\\Tmp\\Account");
|
||||||
}
|
}
|
||||||
');
|
');
|
||||||
$I->seeInThisFile('
|
$I->seeInThisFile('
|
||||||
public function owner()
|
public function owner()
|
||||||
{
|
{
|
||||||
return $this->belongsTo("App\\User");
|
return $this->belongsTo("App\\User");
|
||||||
}
|
}
|
||||||
');
|
');
|
||||||
$I->seeInThisFile('
|
$I->seeInThisFile('
|
||||||
public function number()
|
public function number()
|
||||||
{
|
{
|
||||||
return $this->hasOne("Tests\\Tmp\\Phone");
|
return $this->hasOne("Tests\\Tmp\\Phone");
|
||||||
}
|
}
|
||||||
');
|
');
|
||||||
|
|
||||||
$I->wantTo('generate a model with validation rules');
|
$I->wantTo('generate a model with validation rules');
|
||||||
@ -66,11 +66,11 @@ $I->runShellCommand('php artisan wn:model TestingModel --rules="name=required ag
|
|||||||
$I->seeFileFound('./tests/tmp/TestingModel.php');
|
$I->seeFileFound('./tests/tmp/TestingModel.php');
|
||||||
$I->openFile('./tests/tmp/TestingModel.php');
|
$I->openFile('./tests/tmp/TestingModel.php');
|
||||||
$I->seeInThisFile('
|
$I->seeInThisFile('
|
||||||
public static $rules = [
|
public static $rules = [
|
||||||
"name" => "required",
|
"name" => "required",
|
||||||
"age" => "integer|min:13",
|
"age" => "integer|min:13",
|
||||||
"email" => "email|unique:users,email_address",
|
"email" => "email|unique:users,email_address",
|
||||||
];
|
];
|
||||||
');
|
');
|
||||||
|
|
||||||
$I->deleteFile('./tests/tmp/TestingModel.php');
|
$I->deleteFile('./tests/tmp/TestingModel.php');
|
@ -13,16 +13,16 @@ class ShortTagTaskTableSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
\$faker = Faker::create();
|
\$faker = Faker::create();
|
||||||
|
|
||||||
\$firstIds = DB::table('short_tags')->lists('id');
|
\$firstIds = DB::table('short_tags')->lists('id');
|
||||||
\$secondIds = DB::table('tasks')->lists('id');
|
\$secondIds = DB::table('tasks')->lists('id');
|
||||||
|
|
||||||
for(\$i = 0; \$i < 10; \$i++) {
|
for(\$i = 0; \$i < 10; \$i++) {
|
||||||
DB::table('short_tag_task')->insert([
|
DB::table('short_tag_task')->insert([
|
||||||
'short_tag_id' => \$faker->randomElement(\$firstIds),
|
'short_tag_id' => \$faker->randomElement(\$firstIds),
|
||||||
'task_id' => \$faker->randomElement(\$secondIds)
|
'task_id' => \$faker->randomElement(\$secondIds)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}");
|
}");
|
||||||
|
@ -14,30 +14,30 @@ $I->seeInThisFile('class TaskCategory extends Model');
|
|||||||
$I->seeInThisFile('protected $fillable = ["name", "descr", "due", "project_id", "user_id"];');
|
$I->seeInThisFile('protected $fillable = ["name", "descr", "due", "project_id", "user_id"];');
|
||||||
$I->seeInThisFile('protected $dates = ["due"];');
|
$I->seeInThisFile('protected $dates = ["due"];');
|
||||||
$I->seeInThisFile('public static $rules = [
|
$I->seeInThisFile('public static $rules = [
|
||||||
"name" => "requied",
|
"name" => "requied",
|
||||||
"project_id" => "required|numeric",
|
"project_id" => "required|numeric",
|
||||||
"user_id" => "required|numeric",
|
"user_id" => "required|numeric",
|
||||||
];');
|
];');
|
||||||
$I->seeInThisFile('
|
$I->seeInThisFile('
|
||||||
public function tags()
|
public function tags()
|
||||||
{
|
{
|
||||||
return $this->hasMany("App\Tag");
|
return $this->hasMany("App\Tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tasks()
|
public function tasks()
|
||||||
{
|
{
|
||||||
return $this->hasMany("App\Task");
|
return $this->hasMany("App\Task");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function project()
|
public function project()
|
||||||
{
|
{
|
||||||
return $this->belongsTo("App\Project");
|
return $this->belongsTo("App\Project");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function creator()
|
public function creator()
|
||||||
{
|
{
|
||||||
return $this->belongsTo("App\User");
|
return $this->belongsTo("App\User");
|
||||||
}');
|
}');
|
||||||
$I->deleteFile('./app/TaskCategory.php');
|
$I->deleteFile('./app/TaskCategory.php');
|
||||||
|
|
||||||
// Checking the migration
|
// Checking the migration
|
||||||
@ -75,9 +75,9 @@ $I->openFile('./app/Http/Controllers/TaskCategoriesController.php');
|
|||||||
|
|
||||||
$I->seeInThisFile('class TaskCategoriesController extends Controller {
|
$I->seeInThisFile('class TaskCategoriesController extends Controller {
|
||||||
|
|
||||||
const MODEL = "App\TaskCategory";
|
const MODEL = "App\TaskCategory";
|
||||||
|
|
||||||
use RESTActions;
|
use RESTActions;
|
||||||
|
|
||||||
}');
|
}');
|
||||||
|
|
||||||
@ -117,9 +117,9 @@ $I->openFile('./database/factories/ModelFactory.php');
|
|||||||
// */
|
// */
|
||||||
// \$factory->define(App\TaskCategory::class, function (\$faker) {
|
// \$factory->define(App\TaskCategory::class, function (\$faker) {
|
||||||
// return [
|
// return [
|
||||||
// 'name' => \$faker->word,
|
// 'name' => \$faker->word,
|
||||||
// 'descr' => \$faker->paragraph,
|
// 'descr' => \$faker->paragraph,
|
||||||
// 'due' => \$faker->date,
|
// 'due' => \$faker->date,
|
||||||
// ];
|
// ];
|
||||||
// });");
|
// });");
|
||||||
$I->writeToFile('./database/factories/ModelFactory.php', "<?php
|
$I->writeToFile('./database/factories/ModelFactory.php', "<?php
|
||||||
|
17
lumen-test/tests/tmp/TestingModel.php
Normal file
17
lumen-test/tests/tmp/TestingModel.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php namespace Tests\Tmp;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class TestingModel extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [];
|
||||||
|
|
||||||
|
protected $dates = [];
|
||||||
|
|
||||||
|
public static $rules = [
|
||||||
|
// Validation rules
|
||||||
|
];
|
||||||
|
|
||||||
|
// Relationships
|
||||||
|
|
||||||
|
}
|
@ -56,7 +56,7 @@ class FactoryCommand extends BaseCommand {
|
|||||||
}
|
}
|
||||||
$content = implode(PHP_EOL, $content);
|
$content = implode(PHP_EOL, $content);
|
||||||
} else {
|
} else {
|
||||||
$content = "\t\t// Fields here";
|
$content = " // Fields here";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
@ -66,7 +66,7 @@ class ModelCommand extends BaseCommand {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if(empty($relations)){
|
if(empty($relations)){
|
||||||
return "\t// Relationships";
|
return " // Relationships";
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(PHP_EOL, $relations);
|
return implode(PHP_EOL, $relations);
|
||||||
@ -99,7 +99,7 @@ class ModelCommand extends BaseCommand {
|
|||||||
{
|
{
|
||||||
$rules = $this->option('rules');
|
$rules = $this->option('rules');
|
||||||
if(! $rules){
|
if(! $rules){
|
||||||
return "\t\t// Validation rules";
|
return " // Validation rules";
|
||||||
}
|
}
|
||||||
$items = $rules;
|
$items = $rules;
|
||||||
if(! $this->option('parsed')){
|
if(! $this->option('parsed')){
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php namespace App\Http\Controllers;
|
<?php namespace App\Http\Controllers;
|
||||||
|
|
||||||
class {{name}} extends Controller
|
class {{name}} extends Controller {
|
||||||
{
|
|
||||||
const MODEL = "{{model}}";
|
const MODEL = "{{model}}";
|
||||||
|
|
||||||
use RESTActions;
|
use RESTActions;
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class {{name}} extends Model
|
class {{name}} extends Model {
|
||||||
{
|
|
||||||
protected $fillable = [{{fillable}}];
|
protected $fillable = [{{fillable}}];
|
||||||
|
|
||||||
protected $dates = [{{dates}}];
|
protected $dates = [{{dates}}];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user