Added faker to basic app console commands, adjusted readme to mention database setup
This commit is contained in:
parent
a3efcafd38
commit
2e9a0839dd
@ -21,20 +21,40 @@ Changed current directory to <directory>
|
||||
Then add `<directory>/vendor/bin` to you `PATH` environment variable. Now we're able to use `codecept` from command
|
||||
line globally.
|
||||
|
||||
2. Build the test suites:
|
||||
2. Install faker extension by running the following from template root directory where `composer.json` is:
|
||||
|
||||
```
|
||||
composer require --dev yiisoft/yii2-faker:*
|
||||
```
|
||||
|
||||
3. Create three databases that are used in tests:
|
||||
|
||||
* `yii2_basic_unit` - for unit tests;
|
||||
* `yii2_basic_functional` - for functional tests;
|
||||
* `yii2_basic_acceptance` - for acceptance tests.
|
||||
|
||||
Then update databases by applying migrations:
|
||||
|
||||
```
|
||||
codeception/bin/yii_acceptance migrate
|
||||
codeception/bin/yii_functional migrate
|
||||
codeception/bin/yii_unit migrate
|
||||
```
|
||||
|
||||
4. Build the test suites:
|
||||
|
||||
```
|
||||
codecept build
|
||||
```
|
||||
|
||||
3. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use PHP built in
|
||||
5. In order to be able to run acceptance tests you need to start a webserver. The simplest way is to use PHP built in
|
||||
webserver. In the `web` directory execute the following:
|
||||
|
||||
```
|
||||
php -S localhost:8080
|
||||
```
|
||||
|
||||
4. Now you can run the tests with the following commands:
|
||||
6. Now you can run the tests with the following commands:
|
||||
|
||||
```
|
||||
# run all available tests
|
||||
|
@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/config/console.php'),
|
||||
require(__DIR__ . '/../config/config.php'),
|
||||
[
|
||||
'controllerMap' => [
|
||||
'fixture' => [
|
||||
'class' => 'yii\faker\FixtureController',
|
||||
'fixtureDataPath' => dirname(__DIR__) . 'fixtures',
|
||||
'templatePath' => dirname(__DIR__) . 'templates'
|
||||
],
|
||||
],
|
||||
'components' => [
|
||||
'db' => [
|
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance',
|
||||
|
@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/config/console.php'),
|
||||
require(__DIR__ . '/../config/config.php'),
|
||||
[
|
||||
'controllerMap' => [
|
||||
'fixture' => [
|
||||
'class' => 'yii\faker\FixtureController',
|
||||
'fixtureDataPath' => dirname(__DIR__) . 'fixtures',
|
||||
'templatePath' => dirname(__DIR__) . 'templates'
|
||||
],
|
||||
],
|
||||
'components' => [
|
||||
'db' => [
|
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional',
|
||||
|
@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge(
|
||||
require(YII_APP_BASE_PATH . '/config/console.php'),
|
||||
require(__DIR__ . '/../config/config.php'),
|
||||
[
|
||||
'controllerMap' => [
|
||||
'fixture' => [
|
||||
'class' => 'yii\faker\FixtureController',
|
||||
'fixtureDataPath' => dirname(__DIR__) . 'fixtures',
|
||||
'templatePath' => dirname(__DIR__) . 'templates'
|
||||
],
|
||||
],
|
||||
'components' => [
|
||||
'db' => [
|
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit',
|
||||
|
2
tests/codeception/fixtures/.gitignore
vendored
Normal file
2
tests/codeception/fixtures/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
2
tests/codeception/templates/.gitignore
vendored
Normal file
2
tests/codeception/templates/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
Loading…
Reference in New Issue
Block a user