Commit f5ee8e45 by Alexander Makarov

Added faker to basic app console commands, adjusted readme to mention database setup

parent a9445b4a
...@@ -21,20 +21,40 @@ Changed current directory to <directory> ...@@ -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 Then add `<directory>/vendor/bin` to you `PATH` environment variable. Now we're able to use `codecept` from command
line globally. 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 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: webserver. In the `web` directory execute the following:
``` ```
php -S localhost:8080 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 # run all available tests
......
...@@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge( ...@@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/config/console.php'), require(YII_APP_BASE_PATH . '/config/console.php'),
require(__DIR__ . '/../config/config.php'), require(__DIR__ . '/../config/config.php'),
[ [
'controllerMap' => [
'fixture' => [
'class' => 'yii\faker\FixtureController',
'fixtureDataPath' => dirname(__DIR__) . 'fixtures',
'templatePath' => dirname(__DIR__) . 'templates'
],
],
'components' => [ 'components' => [
'db' => [ 'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance',
......
...@@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge( ...@@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/config/console.php'), require(YII_APP_BASE_PATH . '/config/console.php'),
require(__DIR__ . '/../config/config.php'), require(__DIR__ . '/../config/config.php'),
[ [
'controllerMap' => [
'fixture' => [
'class' => 'yii\faker\FixtureController',
'fixtureDataPath' => dirname(__DIR__) . 'fixtures',
'templatePath' => dirname(__DIR__) . 'templates'
],
],
'components' => [ 'components' => [
'db' => [ 'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional',
......
...@@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge( ...@@ -14,6 +14,13 @@ $config = yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/config/console.php'), require(YII_APP_BASE_PATH . '/config/console.php'),
require(__DIR__ . '/../config/config.php'), require(__DIR__ . '/../config/config.php'),
[ [
'controllerMap' => [
'fixture' => [
'class' => 'yii\faker\FixtureController',
'fixtureDataPath' => dirname(__DIR__) . 'fixtures',
'templatePath' => dirname(__DIR__) . 'templates'
],
],
'components' => [ 'components' => [
'db' => [ 'db' => [
'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit',
......
*
!.gitignore
\ No newline at end of file
*
!.gitignore
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment