faxriddin
10 years ago
1772 changed files with 104015 additions and 96755 deletions
@ -1,30 +0,0 @@
|
||||
# yii console command |
||||
/yii |
||||
|
||||
# phpstorm project files |
||||
.idea |
||||
|
||||
# netbeans project files |
||||
nbproject |
||||
|
||||
# zend studio for eclipse project files |
||||
.buildpath |
||||
.project |
||||
.settings |
||||
|
||||
# windows thumbnail cache |
||||
Thumbs.db |
||||
|
||||
# composer vendor dir |
||||
/vendor |
||||
|
||||
# composer itself is not needed |
||||
composer.phar |
||||
|
||||
# Mac DS_Store Files |
||||
.DS_Store |
||||
|
||||
# phpunit itself is not needed |
||||
phpunit.phar |
||||
# local phpunit config |
||||
/phpunit.xml |
@ -1,32 +0,0 @@
|
||||
The Yii framework is free software. It is released under the terms of |
||||
the following BSD License. |
||||
|
||||
Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) |
||||
All rights reserved. |
||||
|
||||
Redistribution and use in source and binary forms, with or without |
||||
modification, are permitted provided that the following conditions |
||||
are met: |
||||
|
||||
* Redistributions of source code must retain the above copyright |
||||
notice, this list of conditions and the following disclaimer. |
||||
* Redistributions in binary form must reproduce the above copyright |
||||
notice, this list of conditions and the following disclaimer in |
||||
the documentation and/or other materials provided with the |
||||
distribution. |
||||
* Neither the name of Yii Software LLC nor the names of its |
||||
contributors may be used to endorse or promote products derived |
||||
from this software without specific prior written permission. |
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||||
POSSIBILITY OF SUCH DAMAGE. |
@ -1,129 +0,0 @@
|
||||
Yii 2 Advanced Application Template |
||||
=================================== |
||||
|
||||
Yii 2 Advanced Application Template is a skeleton Yii 2 application best for |
||||
developing complex Web applications with multiple tiers. |
||||
|
||||
The template includes three tiers: front end, back end, and console, each of which |
||||
is a separate Yii application. |
||||
|
||||
The template is designed to work in a team development environment. It supports |
||||
deploying the application in different environments. |
||||
|
||||
|
||||
DIRECTORY STRUCTURE |
||||
------------------- |
||||
|
||||
``` |
||||
common |
||||
config/ contains shared configurations |
||||
mail/ contains view files for e-mails |
||||
models/ contains model classes used in both backend and frontend |
||||
tests/ contains various tests for objects that are common among applications |
||||
console |
||||
config/ contains console configurations |
||||
controllers/ contains console controllers (commands) |
||||
migrations/ contains database migrations |
||||
models/ contains console-specific model classes |
||||
runtime/ contains files generated during runtime |
||||
tests/ contains various tests for the console application |
||||
backend |
||||
assets/ contains application assets such as JavaScript and CSS |
||||
config/ contains backend configurations |
||||
controllers/ contains Web controller classes |
||||
models/ contains backend-specific model classes |
||||
runtime/ contains files generated during runtime |
||||
tests/ contains various tests for the backend application |
||||
views/ contains view files for the Web application |
||||
web/ contains the entry script and Web resources |
||||
frontend |
||||
assets/ contains application assets such as JavaScript and CSS |
||||
config/ contains frontend configurations |
||||
controllers/ contains Web controller classes |
||||
models/ contains frontend-specific model classes |
||||
runtime/ contains files generated during runtime |
||||
tests/ contains various tests for the frontend application |
||||
views/ contains view files for the Web application |
||||
web/ contains the entry script and Web resources |
||||
vendor/ contains dependent 3rd-party packages |
||||
environments/ contains environment-based overrides |
||||
``` |
||||
|
||||
|
||||
REQUIREMENTS |
||||
------------ |
||||
|
||||
The minimum requirement by this application template that your Web server supports PHP 5.4.0. |
||||
|
||||
|
||||
INSTALLATION |
||||
------------ |
||||
|
||||
### Install from an Archive File |
||||
|
||||
Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to |
||||
a directory named `advanced` that is directly under the Web root. |
||||
|
||||
Then follow the instructions given in "GETTING STARTED". |
||||
|
||||
|
||||
### Install via Composer |
||||
|
||||
If you do not have [Composer](http://getcomposer.org/), you may install it by following the instructions |
||||
at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). |
||||
|
||||
You can then install the application using the following command: |
||||
|
||||
~~~ |
||||
php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced advanced |
||||
~~~ |
||||
|
||||
|
||||
GETTING STARTED |
||||
--------------- |
||||
|
||||
After you install the application, you have to conduct the following steps to initialize |
||||
the installed application. You only need to do these once for all. |
||||
|
||||
1. Run command `init` to initialize the application with a specific environment. |
||||
2. Create a new database and adjust the `components['db']` configuration in `common/config/main-local.php` accordingly. |
||||
3. Apply migrations with console command `yii migrate`. This will create tables needed for the application to work. |
||||
4. Set document roots of your Web server: |
||||
|
||||
- for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://frontend/` |
||||
- for backend `/path/to/yii-application/backend/web/` and using the URL `http://backend/` |
||||
|
||||
To login into the application, you need to first sign up, with any of your email address, username and password. |
||||
Then, you can login into the application with same email address and password at any time. |
||||
|
||||
TESTING |
||||
------- |
||||
|
||||
Install additional composer packages: |
||||
* `php composer.phar require --dev codeception/codeception:2.0.* codeception/specify:* codeception/verify:* yiisoft/yii2-faker:*` |
||||
|
||||
This application boilerplate use database in testing, so you should create three databases that are used in tests: |
||||
* `yii2_advanced_unit` - database for unit tests; |
||||
* `yii2_advanced_functional` - database for functional tests; |
||||
* `yii2_advanced_acceptance` - database for acceptance tests. |
||||
|
||||
To make your database up to date, you can run in needed test folder `yii migrate`, for example |
||||
if you are starting from `frontend` tests then you should run `yii migrate` in each suite folder `acceptance`, `functional`, `unit` |
||||
it will upgrade your database to the last state according migrations. |
||||
|
||||
To be able to run acceptance tests you need a running webserver. For this you can use the php builtin server and run it in the directory where your main project folder is located. For example if your application is located in `/www/advanced` all you need to is: |
||||
`cd /www` and then `php -S 127.0.0.1:8080` because the default configuration of acceptance tests expects the url of the application to be `/advanced/`. |
||||
If you already have a server configured or your application is not located in a folder called `advanced`, you may need to adjust the `test_entry_url` in `backend/codeception.yml` and `frontend/codeception.yml`. |
||||
|
||||
After that is done you should be able to run your tests, for example to run `frontend` tests do: |
||||
|
||||
* `cd frontend` |
||||
* `../vendor/bin/codecept build` |
||||
* `../vendor/bin/codecept run` |
||||
|
||||
In similar way you can run tests for other application tiers - `backend`, `console`, `common`. |
||||
|
||||
If you already have run `../vendor/bin/codecept build` for each application, you can run all tests by one command: `vendor/bin/codecept run` |
||||
|
||||
You also can adjust you application suite configs and `_bootstrap.php` settings to use other urls and files, as it is can be done in `yii2-basic`. |
||||
Current template also includes [yii2-faker](https://github.com/yiisoft/yii2/tree/master/extensions/faker) extension, that is correctly setup for each application tier. |
@ -1,26 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
namespace backend\assets; |
||||
|
||||
use yii\web\AssetBundle; |
||||
|
||||
/** |
||||
* @author Qiang Xue <qiang.xue@gmail.com> |
||||
* @since 2.0 |
||||
*/ |
||||
class AppAsset extends AssetBundle |
||||
{ |
||||
public $basePath = '@webroot'; |
||||
public $baseUrl = '@web'; |
||||
public $css = ['css/site.css']; |
||||
public $js = []; |
||||
public $depends = [ |
||||
'yii\web\YiiAsset', |
||||
'yii\bootstrap\BootstrapAsset', |
||||
]; |
||||
} |
@ -1,24 +0,0 @@
|
||||
namespace: backend |
||||
actor: Tester |
||||
paths: |
||||
tests: tests |
||||
log: tests/_log |
||||
data: tests/_data |
||||
helpers: tests/_helpers |
||||
settings: |
||||
bootstrap: _bootstrap.php |
||||
suite_class: \PHPUnit_Framework_TestSuite |
||||
colors: true |
||||
memory_limit: 1024M |
||||
log: true |
||||
modules: |
||||
config: |
||||
Db: |
||||
dsn: '' |
||||
user: '' |
||||
password: '' |
||||
dump: tests/_data/dump.sql |
||||
config: |
||||
# the entry script URL (without host info) for functional and acceptance tests |
||||
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL |
||||
test_entry_url: /advanced/backend/web/index-test.php |
@ -1,2 +0,0 @@
|
||||
main-local.php |
||||
params-local.php |
@ -1,34 +0,0 @@
|
||||
<?php |
||||
$params = array_merge( |
||||
require(__DIR__ . '/../../common/config/params.php'), |
||||
require(__DIR__ . '/../../common/config/params-local.php'), |
||||
require(__DIR__ . '/params.php'), |
||||
require(__DIR__ . '/params-local.php') |
||||
); |
||||
|
||||
return [ |
||||
'id' => 'app-backend', |
||||
'basePath' => dirname(__DIR__), |
||||
'controllerNamespace' => 'backend\controllers', |
||||
'bootstrap' => ['log'], |
||||
'modules' => [], |
||||
'components' => [ |
||||
'user' => [ |
||||
'identityClass' => 'common\models\User', |
||||
'enableAutoLogin' => true, |
||||
], |
||||
'log' => [ |
||||
'traceLevel' => YII_DEBUG ? 3 : 0, |
||||
'targets' => [ |
||||
[ |
||||
'class' => 'yii\log\FileTarget', |
||||
'levels' => ['error', 'warning'], |
||||
], |
||||
], |
||||
], |
||||
'errorHandler' => [ |
||||
'errorAction' => 'site/error', |
||||
], |
||||
], |
||||
'params' => $params, |
||||
]; |
@ -1,4 +0,0 @@
|
||||
<?php |
||||
return [ |
||||
'adminEmail' => 'admin@example.com', |
||||
]; |
@ -1,83 +0,0 @@
|
||||
<?php |
||||
namespace backend\controllers; |
||||
|
||||
use Yii; |
||||
use yii\filters\AccessControl; |
||||
use yii\web\Controller; |
||||
use common\models\LoginForm; |
||||
use yii\filters\VerbFilter; |
||||
|
||||
/** |
||||
* Site controller |
||||
*/ |
||||
class SiteController extends Controller |
||||
{ |
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function behaviors() |
||||
{ |
||||
return [ |
||||
'access' => [ |
||||
'class' => AccessControl::className(), |
||||
'rules' => [ |
||||
[ |
||||
'actions' => ['login', 'error'], |
||||
'allow' => true, |
||||
], |
||||
[ |
||||
'actions' => ['logout', 'index'], |
||||
'allow' => true, |
||||
'roles' => ['@'], |
||||
], |
||||
], |
||||
], |
||||
'verbs' => [ |
||||
'class' => VerbFilter::className(), |
||||
'actions' => [ |
||||
'logout' => ['post'], |
||||
], |
||||
], |
||||
]; |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function actions() |
||||
{ |
||||
return [ |
||||
'error' => [ |
||||
'class' => 'yii\web\ErrorAction', |
||||
], |
||||
]; |
||||
} |
||||
|
||||
public function actionIndex() |
||||
{ |
||||
return $this->render('index'); |
||||
} |
||||
|
||||
public function actionLogin() |
||||
{ |
||||
if (!\Yii::$app->user->isGuest) { |
||||
return $this->goHome(); |
||||
} |
||||
|
||||
$model = new LoginForm(); |
||||
if ($model->load(Yii::$app->request->post()) && $model->login()) { |
||||
return $this->goBack(); |
||||
} else { |
||||
return $this->render('login', [ |
||||
'model' => $model, |
||||
]); |
||||
} |
||||
} |
||||
|
||||
public function actionLogout() |
||||
{ |
||||
Yii::$app->user->logout(); |
||||
|
||||
return $this->goHome(); |
||||
} |
||||
} |
@ -1,4 +0,0 @@
|
||||
# these files are auto generated by codeception build |
||||
/unit/CodeGuy.php |
||||
/functional/TestGuy.php |
||||
/acceptance/WebGuy.php |
@ -1,18 +0,0 @@
|
||||
<?php |
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true); |
||||
|
||||
defined('YII_ENV') or define('YII_ENV', 'test'); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php'); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); |
||||
|
||||
require(__DIR__ . '/../../common/config/aliases.php'); |
||||
|
||||
// set correct script paths |
||||
|
||||
// the entry script file path for functional and acceptance tests |
||||
$_SERVER['SCRIPT_FILENAME'] = dirname(__DIR__) . '/web/index-test.php'; |
||||
$_SERVER['SCRIPT_NAME'] = \Codeception\Configuration::config()['config']['test_entry_url']; |
||||
$_SERVER['SERVER_NAME'] = 'localhost'; |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* application configurations shared by all test types |
||||
*/ |
||||
return [ |
||||
'components' => [ |
||||
'mailer' => [ |
||||
'useFileTransport' => true, |
||||
], |
||||
'urlManager' => [ |
||||
'showScriptName' => true, |
||||
], |
||||
], |
||||
]; |
@ -1,19 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
// fcgi doesn't have STDIN and STDOUT defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php'); |
||||
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); |
||||
require_once(__DIR__ . '/../../common/config/aliases.php'); |
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true); |
||||
defined('YII_ENV') or define('YII_ENV', 'test'); |
@ -1 +0,0 @@
|
||||
/* Replace this file with actual dump of your database */ |
@ -1,2 +0,0 @@
|
||||
* |
||||
!.gitignore |
@ -1,27 +0,0 @@
|
||||
# Codeception Test Suite Configuration |
||||
|
||||
# suite for acceptance tests. |
||||
# perform tests in browser using the Selenium-like tools. |
||||
# powered by Mink (http://mink.behat.org). |
||||
# (tip: that's what your customer will see). |
||||
# (tip: test your ajax and javascript by one of Mink drivers). |
||||
|
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. |
||||
|
||||
class_name: WebGuy |
||||
modules: |
||||
enabled: |
||||
- PhpBrowser |
||||
- common\tests\_helpers\FixtureHelper |
||||
# you can use WebDriver instead of PhpBrowser to test javascript and ajax. |
||||
# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium |
||||
# "restart" option is used by the WebDriver to start each time per test-file new session and cookies, |
||||
# it is useful if you want to login in your app in each test. |
||||
# - WebDriver |
||||
config: |
||||
PhpBrowser: |
||||
url: 'http://localhost:8080' |
||||
# WebDriver: |
||||
# url: 'http://localhost' |
||||
# browser: firefox |
||||
# restart: true |
@ -1,33 +0,0 @@
|
||||
<?php |
||||
|
||||
use common\tests\_pages\LoginPage; |
||||
use backend\WebGuy; |
||||
|
||||
$I = new WebGuy($scenario); |
||||
$I->wantTo('ensure login page works'); |
||||
|
||||
$loginPage = LoginPage::openBy($I); |
||||
|
||||
$I->amGoingTo('submit login form with no data'); |
||||
$loginPage->login('', ''); |
||||
$I->expectTo('see validations errors'); |
||||
$I->see('Username cannot be blank.', '.help-block'); |
||||
$I->see('Password cannot be blank.', '.help-block'); |
||||
|
||||
$I->amGoingTo('try to login with wrong credentials'); |
||||
$I->expectTo('see validations errors'); |
||||
$loginPage->login('admin', 'wrong'); |
||||
$I->expectTo('see validations errors'); |
||||
$I->see('Incorrect username or password.', '.help-block'); |
||||
|
||||
$I->amGoingTo('try to login with correct credentials'); |
||||
$loginPage->login('erau', 'password_0'); |
||||
$I->expectTo('see that user is logged'); |
||||
$I->seeLink('Logout (erau)'); |
||||
$I->dontSeeLink('Login'); |
||||
$I->dontSeeLink('Signup'); |
||||
/** Uncomment if using WebDriver |
||||
* $I->click('Logout (erau)'); |
||||
* $I->dontSeeLink('Logout (erau)'); |
||||
* $I->seeLink('Login'); |
||||
*/ |
@ -1,3 +0,0 @@
|
||||
<?php |
||||
|
||||
new yii\web\Application(require(__DIR__ . '/_config.php')); |
@ -1,16 +0,0 @@
|
||||
<?php |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../config/main.php'), |
||||
require(__DIR__ . '/../../config/main-local.php'), |
||||
require(__DIR__ . '/../../../common/config/main.php'), |
||||
require(__DIR__ . '/../../../common/config/main-local.php'), |
||||
require(__DIR__ . '/../_config.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_acceptance', |
||||
], |
||||
], |
||||
] |
||||
); |
@ -1,15 +0,0 @@
|
||||
<?php |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../../common/config/main.php'), |
||||
require(__DIR__ . '/../../../common/config/main-local.php'), |
||||
require(__DIR__ . '/../../../console/config/main.php'), |
||||
require(__DIR__ . '/../../../console/config/main-local.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_acceptance', |
||||
], |
||||
], |
||||
] |
||||
); |
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env php |
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
// fcgi doesn't have STDIN and STDOUT defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); |
||||
|
||||
require_once(__DIR__ . '/../_console.php'); |
||||
|
||||
$config = require(__DIR__ . '/_console.php'); |
||||
|
||||
$application = new yii\console\Application($config); |
||||
$exitCode = $application->run(); |
||||
exit($exitCode); |
@ -1,20 +0,0 @@
|
||||
@echo off |
||||
|
||||
rem ------------------------------------------------------------- |
||||
rem Yii command line bootstrap script for Windows. |
||||
rem |
||||
rem @author Qiang Xue <qiang.xue@gmail.com> |
||||
rem @link http://www.yiiframework.com/ |
||||
rem @copyright Copyright © 2012 Yii Software LLC |
||||
rem @license http://www.yiiframework.com/license/ |
||||
rem ------------------------------------------------------------- |
||||
|
||||
@setlocal |
||||
|
||||
set YII_PATH=%~dp0 |
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe |
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%yii" %* |
||||
|
||||
@endlocal |
@ -1,17 +0,0 @@
|
||||
# Codeception Test Suite Configuration |
||||
|
||||
# suite for functional (integration) tests. |
||||
# emulate web requests and make application process them. |
||||
# (tip: better to use with frameworks). |
||||
|
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. |
||||
#basic/web/index.php |
||||
class_name: TestGuy |
||||
modules: |
||||
enabled: |
||||
- Filesystem |
||||
- Yii2 |
||||
- common\tests\_helpers\FixtureHelper |
||||
config: |
||||
Yii2: |
||||
configFile: 'tests/functional/_config.php' |
@ -1,28 +0,0 @@
|
||||
<?php |
||||
|
||||
use common\tests\_pages\LoginPage; |
||||
use backend\TestGuy; |
||||
|
||||
$I = new TestGuy($scenario); |
||||
$I->wantTo('ensure login page works'); |
||||
|
||||
$loginPage = LoginPage::openBy($I); |
||||
|
||||
$I->amGoingTo('submit login form with no data'); |
||||
$loginPage->login('', ''); |
||||
$I->expectTo('see validations errors'); |
||||
$I->see('Username cannot be blank.', '.help-block'); |
||||
$I->see('Password cannot be blank.', '.help-block'); |
||||
|
||||
$I->amGoingTo('try to login with wrong credentials'); |
||||
$I->expectTo('see validations errors'); |
||||
$loginPage->login('admin', 'wrong'); |
||||
$I->expectTo('see validations errors'); |
||||
$I->see('Incorrect username or password.', '.help-block'); |
||||
|
||||
$I->amGoingTo('try to login with correct credentials'); |
||||
$loginPage->login('erau', 'password_0'); |
||||
$I->expectTo('see that user is logged'); |
||||
$I->seeLink('Logout (erau)'); |
||||
$I->dontSeeLink('Login'); |
||||
$I->dontSeeLink('Signup'); |
@ -1,3 +0,0 @@
|
||||
<?php |
||||
|
||||
new yii\web\Application(require(__DIR__ . '/_config.php')); |
@ -1,20 +0,0 @@
|
||||
<?php |
||||
|
||||
// set correct script paths |
||||
$_SERVER['SCRIPT_FILENAME'] = dirname(dirname(__DIR__)) . '/web/index-test.php'; |
||||
$_SERVER['SCRIPT_NAME'] = \Codeception\Configuration::config()['config']['test_entry_url'];; |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../config/main.php'), |
||||
require(__DIR__ . '/../../config/main-local.php'), |
||||
require(__DIR__ . '/../../../common/config/main.php'), |
||||
require(__DIR__ . '/../../../common/config/main-local.php'), |
||||
require(__DIR__ . '/../_config.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_functional', |
||||
], |
||||
], |
||||
] |
||||
); |
@ -1,15 +0,0 @@
|
||||
<?php |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../../common/config/main.php'), |
||||
require(__DIR__ . '/../../../common/config/main-local.php'), |
||||
require(__DIR__ . '/../../../console/config/main.php'), |
||||
require(__DIR__ . '/../../../console/config/main-local.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_functional', |
||||
], |
||||
], |
||||
] |
||||
); |
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env php |
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
// fcgi doesn't have STDIN and STDOUT defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); |
||||
|
||||
require_once(__DIR__ . '/../_console.php'); |
||||
|
||||
$config = require(__DIR__ . '/_console.php'); |
||||
|
||||
$application = new yii\console\Application($config); |
||||
$exitCode = $application->run(); |
||||
exit($exitCode); |
@ -1,20 +0,0 @@
|
||||
@echo off |
||||
|
||||
rem ------------------------------------------------------------- |
||||
rem Yii command line bootstrap script for Windows. |
||||
rem |
||||
rem @author Qiang Xue <qiang.xue@gmail.com> |
||||
rem @link http://www.yiiframework.com/ |
||||
rem @copyright Copyright © 2012 Yii Software LLC |
||||
rem @license http://www.yiiframework.com/license/ |
||||
rem ------------------------------------------------------------- |
||||
|
||||
@setlocal |
||||
|
||||
set YII_PATH=%~dp0 |
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe |
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%yii" %* |
||||
|
||||
@endlocal |
@ -1,6 +0,0 @@
|
||||
# Codeception Test Suite Configuration |
||||
|
||||
# suite for unit (internal) tests. |
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. |
||||
|
||||
class_name: CodeGuy |
@ -1,8 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace backend\tests\unit; |
||||
|
||||
class DbTestCase extends \yii\codeception\DbTestCase |
||||
{ |
||||
public $appConfig = '@backend/tests/unit/_config.php'; |
||||
} |
@ -1,8 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace backend\tests\unit; |
||||
|
||||
class TestCase extends \yii\codeception\TestCase |
||||
{ |
||||
public $appConfig = '@backend/tests/unit/_config.php'; |
||||
} |
@ -1,2 +0,0 @@
|
||||
<?php |
||||
// Here you can initialize variables that will for your tests |
@ -1,16 +0,0 @@
|
||||
<?php |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../../common/config/main.php'), |
||||
require(__DIR__ . '/../../../common/config/main-local.php'), |
||||
require(__DIR__ . '/../../config/main.php'), |
||||
require(__DIR__ . '/../../config/main-local.php'), |
||||
require(__DIR__ . '/../_config.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit', |
||||
], |
||||
], |
||||
] |
||||
); |
@ -1,22 +0,0 @@
|
||||
<?php |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../../common/config/main.php'), |
||||
require(__DIR__ . '/../../../common/config/main-local.php'), |
||||
require(__DIR__ . '/../../../console/config/main.php'), |
||||
require(__DIR__ . '/../../../console/config/main-local.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit', |
||||
], |
||||
], |
||||
'controllerMap' => [ |
||||
'fixture' => [ |
||||
'class' => 'yii\faker\FixtureController', |
||||
'fixtureDataPath' => '@backend/tests/unit/fixtures/data', |
||||
'templatePath' => '@commmon/tests/templates/fixtures' |
||||
], |
||||
], |
||||
] |
||||
); |
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env php |
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
// fcgi doesn't have STDIN and STDOUT defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); |
||||
|
||||
require_once(__DIR__ . '/../_console.php'); |
||||
|
||||
$config = require(__DIR__ . '/_console.php'); |
||||
|
||||
$application = new yii\console\Application($config); |
||||
$exitCode = $application->run(); |
||||
exit($exitCode); |
@ -1,20 +0,0 @@
|
||||
@echo off |
||||
|
||||
rem ------------------------------------------------------------- |
||||
rem Yii command line bootstrap script for Windows. |
||||
rem |
||||
rem @author Qiang Xue <qiang.xue@gmail.com> |
||||
rem @link http://www.yiiframework.com/ |
||||
rem @copyright Copyright © 2012 Yii Software LLC |
||||
rem @license http://www.yiiframework.com/license/ |
||||
rem ------------------------------------------------------------- |
||||
|
||||
@setlocal |
||||
|
||||
set YII_PATH=%~dp0 |
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe |
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%yii" %* |
||||
|
||||
@endlocal |
@ -1,71 +0,0 @@
|
||||
<?php |
||||
use backend\assets\AppAsset; |
||||
use yii\helpers\Html; |
||||
use yii\bootstrap\Nav; |
||||
use yii\bootstrap\NavBar; |
||||
use yii\widgets\Breadcrumbs; |
||||
|
||||
/* @var $this \yii\web\View */ |
||||
/* @var $content string */ |
||||
|
||||
AppAsset::register($this); |
||||
?> |
||||
<?php $this->beginPage() ?> |
||||
<!DOCTYPE html> |
||||
<html lang="<?= Yii::$app->language ?>">
|
||||
<head> |
||||
<meta charset="<?= Yii::$app->charset ?>"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
<?= Html::csrfMetaTags() ?> |
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?php $this->head() ?> |
||||
</head> |
||||
<body> |
||||
<?php $this->beginBody() ?> |
||||
<div class="wrap"> |
||||
<?php |
||||
NavBar::begin([ |
||||
'brandLabel' => 'My Company', |
||||
'brandUrl' => Yii::$app->homeUrl, |
||||
'options' => [ |
||||
'class' => 'navbar-inverse navbar-fixed-top', |
||||
], |
||||
]); |
||||
$menuItems = [ |
||||
['label' => 'Home', 'url' => ['/site/index']], |
||||
]; |
||||
if (Yii::$app->user->isGuest) { |
||||
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; |
||||
} else { |
||||
$menuItems[] = [ |
||||
'label' => 'Logout (' . Yii::$app->user->identity->username . ')', |
||||
'url' => ['/site/logout'], |
||||
'linkOptions' => ['data-method' => 'post'] |
||||
]; |
||||
} |
||||
echo Nav::widget([ |
||||
'options' => ['class' => 'navbar-nav navbar-right'], |
||||
'items' => $menuItems, |
||||
]); |
||||
NavBar::end(); |
||||
?> |
||||
|
||||
<div class="container"> |
||||
<?= Breadcrumbs::widget([ |
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], |
||||
]) ?> |
||||
<?= $content ?> |
||||
</div> |
||||
</div> |
||||
|
||||
<footer class="footer"> |
||||
<div class="container"> |
||||
<p class="pull-left">© My Company <?= date('Y') ?></p>
|
||||
<p class="pull-right"><?= Yii::powered() ?></p>
|
||||
</div> |
||||
</footer> |
||||
|
||||
<?php $this->endBody() ?> |
||||
</body> |
||||
</html> |
||||
<?php $this->endPage() ?> |
@ -1,27 +0,0 @@
|
||||
<?php |
||||
|
||||
use yii\helpers\Html; |
||||
|
||||
/* @var $this yii\web\View */ |
||||
/* @var $name string */ |
||||
/* @var $message string */ |
||||
/* @var $exception Exception */ |
||||
|
||||
$this->title = $name; |
||||
?> |
||||
<div class="site-error"> |
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<div class="alert alert-danger"> |
||||
<?= nl2br(Html::encode($message)) ?> |
||||
</div> |
||||
|
||||
<p> |
||||
The above error occurred while the Web server was processing your request. |
||||
</p> |
||||
<p> |
||||
Please contact us if you think this is a server error. Thank you. |
||||
</p> |
||||
|
||||
</div> |
@ -1,52 +0,0 @@
|
||||
<?php |
||||
/* @var $this yii\web\View */ |
||||
|
||||
$this->title = 'My Yii Application'; |
||||
?> |
||||
<div class="site-index"> |
||||
|
||||
<div class="jumbotron"> |
||||
<h1>Congratulations!</h1> |
||||
|
||||
<p class="lead">You have successfully created your Yii-powered application.</p> |
||||
|
||||
<p><a class="btn btn-lg btn-success" href="http://www.yiiframework.com">Get started with Yii</a></p> |
||||
</div> |
||||
|
||||
<div class="body-content"> |
||||
|
||||
<div class="row"> |
||||
<div class="col-lg-4"> |
||||
<h2>Heading</h2> |
||||
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et |
||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip |
||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu |
||||
fugiat nulla pariatur.</p> |
||||
|
||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/doc/">Yii Documentation »</a></p> |
||||
</div> |
||||
<div class="col-lg-4"> |
||||
<h2>Heading</h2> |
||||
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et |
||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip |
||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu |
||||
fugiat nulla pariatur.</p> |
||||
|
||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/forum/">Yii Forum »</a></p> |
||||
</div> |
||||
<div class="col-lg-4"> |
||||
<h2>Heading</h2> |
||||
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et |
||||
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip |
||||
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu |
||||
fugiat nulla pariatur.</p> |
||||
|
||||
<p><a class="btn btn-default" href="http://www.yiiframework.com/extensions/">Yii Extensions »</a></p> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
@ -1,29 +0,0 @@
|
||||
<?php |
||||
use yii\helpers\Html; |
||||
use yii\widgets\ActiveForm; |
||||
|
||||
/* @var $this yii\web\View */ |
||||
/* @var $form yii\widgets\ActiveForm */ |
||||
/* @var $model \common\models\LoginForm */ |
||||
|
||||
$this->title = 'Login'; |
||||
$this->params['breadcrumbs'][] = $this->title; |
||||
?> |
||||
<div class="site-login"> |
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>Please fill out the following fields to login:</p> |
||||
|
||||
<div class="row"> |
||||
<div class="col-lg-5"> |
||||
<?php $form = ActiveForm::begin(['id' => 'login-form']); ?> |
||||
<?= $form->field($model, 'username') ?> |
||||
<?= $form->field($model, 'password')->passwordInput() ?> |
||||
<?= $form->field($model, 'rememberMe')->checkbox() ?> |
||||
<div class="form-group"> |
||||
<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?> |
||||
</div> |
||||
<?php ActiveForm::end(); ?> |
||||
</div> |
||||
</div> |
||||
</div> |
@ -1,2 +0,0 @@
|
||||
/index.php |
||||
/index-test.php |
@ -1,2 +0,0 @@
|
||||
* |
||||
!.gitignore |
@ -1,91 +0,0 @@
|
||||
html, |
||||
body { |
||||
height: 100%; |
||||
} |
||||
|
||||
.wrap { |
||||
min-height: 100%; |
||||
height: auto; |
||||
margin: 0 auto -60px; |
||||
padding: 0 0 60px; |
||||
} |
||||
|
||||
.wrap > .container { |
||||
padding: 70px 15px 20px; |
||||
} |
||||
|
||||
.footer { |
||||
height: 60px; |
||||
background-color: #f5f5f5; |
||||
border-top: 1px solid #ddd; |
||||
padding-top: 20px; |
||||
} |
||||
|
||||
.jumbotron { |
||||
text-align: center; |
||||
background-color: transparent; |
||||
} |
||||
|
||||
.jumbotron .btn { |
||||
font-size: 21px; |
||||
padding: 14px 24px; |
||||
} |
||||
|
||||
.not-set { |
||||
color: #c55; |
||||
font-style: italic; |
||||
} |
||||
|
||||
/* add sorting icons to gridview sort links */ |
||||
a.asc:after, a.desc:after { |
||||
position: relative; |
||||
top: 1px; |
||||
display: inline-block; |
||||
font-family: 'Glyphicons Halflings'; |
||||
font-style: normal; |
||||
font-weight: normal; |
||||
line-height: 1; |
||||
padding-left: 5px; |
||||
} |
||||
|
||||
a.asc:after { |
||||
content: /*"\e113"*/ "\e151"; |
||||
} |
||||
|
||||
a.desc:after { |
||||
content: /*"\e114"*/ "\e152"; |
||||
} |
||||
|
||||
.sort-numerical a.asc:after { |
||||
content: "\e153"; |
||||
} |
||||
|
||||
.sort-numerical a.desc:after { |
||||
content: "\e154"; |
||||
} |
||||
|
||||
.sort-ordinal a.asc:after { |
||||
content: "\e155"; |
||||
} |
||||
|
||||
.sort-ordinal a.desc:after { |
||||
content: "\e156"; |
||||
} |
||||
|
||||
.grid-view th { |
||||
white-space: nowrap; |
||||
} |
||||
|
||||
.hint-block { |
||||
display: block; |
||||
margin-top: 5px; |
||||
color: #999; |
||||
} |
||||
|
||||
.error-summary { |
||||
color: #a94442; |
||||
background: #fdf7f7; |
||||
border-left: 3px solid #eed3d7; |
||||
padding: 10px 20px; |
||||
margin: 0 0 15px 0; |
||||
} |
Before Width: | Height: | Size: 318 B |
@ -1,11 +0,0 @@
|
||||
include: |
||||
- common |
||||
- console |
||||
- backend |
||||
- frontend |
||||
|
||||
paths: |
||||
log: tests/_log |
||||
|
||||
settings: |
||||
colors: true |
@ -1,20 +0,0 @@
|
||||
namespace: common |
||||
actor: Tester |
||||
paths: |
||||
tests: tests |
||||
log: tests/_log |
||||
data: tests/_data |
||||
helpers: tests/_helpers |
||||
settings: |
||||
bootstrap: _bootstrap.php |
||||
suite_class: \PHPUnit_Framework_TestSuite |
||||
colors: true |
||||
memory_limit: 1024M |
||||
log: true |
||||
modules: |
||||
config: |
||||
Db: |
||||
dsn: '' |
||||
user: '' |
||||
password: '' |
||||
dump: tests/_data/dump.sql |
@ -1,2 +0,0 @@
|
||||
main-local.php |
||||
params-local.php |
@ -1,5 +0,0 @@
|
||||
<?php |
||||
Yii::setAlias('common', dirname(__DIR__)); |
||||
Yii::setAlias('frontend', dirname(dirname(__DIR__)) . '/frontend'); |
||||
Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend'); |
||||
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console'); |
@ -1,9 +0,0 @@
|
||||
<?php |
||||
return [ |
||||
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', |
||||
'components' => [ |
||||
'cache' => [ |
||||
'class' => 'yii\caching\FileCache', |
||||
], |
||||
], |
||||
]; |
@ -1,6 +0,0 @@
|
||||
<?php |
||||
return [ |
||||
'adminEmail' => 'admin@example.com', |
||||
'supportEmail' => 'support@example.com', |
||||
'user.passwordResetTokenExpire' => 3600, |
||||
]; |
@ -1,22 +0,0 @@
|
||||
<?php |
||||
use yii\helpers\Html; |
||||
|
||||
/* @var $this \yii\web\View view component instance */ |
||||
/* @var $message \yii\mail\MessageInterface the message being composed */ |
||||
/* @var $content string main view render result */ |
||||
?> |
||||
<?php $this->beginPage() ?> |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" />
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?php $this->head() ?> |
||||
</head> |
||||
<body> |
||||
<?php $this->beginBody() ?> |
||||
<?= $content ?> |
||||
<?php $this->endBody() ?> |
||||
</body> |
||||
</html> |
||||
<?php $this->endPage() ?> |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
use yii\helpers\Html; |
||||
|
||||
/* @var $this yii\web\View */ |
||||
/* @var $user common\models\User */ |
||||
|
||||
$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['site/reset-password', 'token' => $user->password_reset_token]); |
||||
?> |
||||
|
||||
Hello <?= Html::encode($user->username) ?>,
|
||||
|
||||
Follow the link below to reset your password: |
||||
|
||||
<?= Html::a(Html::encode($resetLink), $resetLink) ?> |
@ -1,77 +0,0 @@
|
||||
<?php |
||||
namespace common\models; |
||||
|
||||
use Yii; |
||||
use yii\base\Model; |
||||
|
||||
/** |
||||
* Login form |
||||
*/ |
||||
class LoginForm extends Model |
||||
{ |
||||
public $username; |
||||
public $password; |
||||
public $rememberMe = true; |
||||
|
||||
private $_user = false; |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function rules() |
||||
{ |
||||
return [ |
||||
// username and password are both required |
||||
[['username', 'password'], 'required'], |
||||
// rememberMe must be a boolean value |
||||
['rememberMe', 'boolean'], |
||||
// password is validated by validatePassword() |
||||
['password', 'validatePassword'], |
||||
]; |
||||
} |
||||
|
||||
/** |
||||
* Validates the password. |
||||
* This method serves as the inline validation for password. |
||||
* |
||||
* @param string $attribute the attribute currently being validated |
||||
* @param array $params the additional name-value pairs given in the rule |
||||
*/ |
||||
public function validatePassword($attribute, $params) |
||||
{ |
||||
if (!$this->hasErrors()) { |
||||
$user = $this->getUser(); |
||||
if (!$user || !$user->validatePassword($this->password)) { |
||||
$this->addError($attribute, 'Incorrect username or password.'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Logs in a user using the provided username and password. |
||||
* |
||||
* @return boolean whether the user is logged in successfully |
||||
*/ |
||||
public function login() |
||||
{ |
||||
if ($this->validate()) { |
||||
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Finds user by [[username]] |
||||
* |
||||
* @return User|null |
||||
*/ |
||||
public function getUser() |
||||
{ |
||||
if ($this->_user === false) { |
||||
$this->_user = User::findByUsername($this->username); |
||||
} |
||||
|
||||
return $this->_user; |
||||
} |
||||
} |
@ -1,180 +0,0 @@
|
||||
<?php |
||||
namespace common\models; |
||||
|
||||
use Yii; |
||||
use yii\base\NotSupportedException; |
||||
use yii\behaviors\TimestampBehavior; |
||||
use yii\db\ActiveRecord; |
||||
use yii\web\IdentityInterface; |
||||
|
||||
/** |
||||
* User model |
||||
* |
||||
* @property integer $id |
||||
* @property string $username |
||||
* @property string $password_hash |
||||
* @property string $password_reset_token |
||||
* @property string $email |
||||
* @property string $auth_key |
||||
* @property integer $role |
||||
* @property integer $status |
||||
* @property integer $created_at |
||||
* @property integer $updated_at |
||||
* @property string $password write-only password |
||||
*/ |
||||
class User extends ActiveRecord implements IdentityInterface |
||||
{ |
||||
const STATUS_DELETED = 0; |
||||
const STATUS_ACTIVE = 10; |
||||
const ROLE_USER = 10; |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public static function tableName() |
||||
{ |
||||
return '{{%user}}'; |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function behaviors() |
||||
{ |
||||
return [ |
||||
TimestampBehavior::className(), |
||||
]; |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function rules() |
||||
{ |
||||
return [ |
||||
['status', 'default', 'value' => self::STATUS_ACTIVE], |
||||
['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], |
||||
|
||||
['role', 'default', 'value' => self::ROLE_USER], |
||||
['role', 'in', 'range' => [self::ROLE_USER]], |
||||
]; |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public static function findIdentity($id) |
||||
{ |
||||
return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public static function findIdentityByAccessToken($token, $type = null) |
||||
{ |
||||
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.'); |
||||
} |
||||
|
||||
/** |
||||
* Finds user by username |
||||
* |
||||
* @param string $username |
||||
* @return static|null |
||||
*/ |
||||
public static function findByUsername($username) |
||||
{ |
||||
return static::findOne(['username' => $username, 'status' => self::STATUS_ACTIVE]); |
||||
} |
||||
|
||||
/** |
||||
* Finds user by password reset token |
||||
* |
||||
* @param string $token password reset token |
||||
* @return static|null |
||||
*/ |
||||
public static function findByPasswordResetToken($token) |
||||
{ |
||||
$expire = Yii::$app->params['user.passwordResetTokenExpire']; |
||||
$parts = explode('_', $token); |
||||
$timestamp = (int) end($parts); |
||||
if ($timestamp + $expire < time()) { |
||||
// token expired |
||||
return null; |
||||
} |
||||
|
||||
return static::findOne([ |
||||
'password_reset_token' => $token, |
||||
'status' => self::STATUS_ACTIVE, |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function getId() |
||||
{ |
||||
return $this->getPrimaryKey(); |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function getAuthKey() |
||||
{ |
||||
return $this->auth_key; |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function validateAuthKey($authKey) |
||||
{ |
||||
return $this->getAuthKey() === $authKey; |
||||
} |
||||
|
||||
/** |
||||
* Validates password |
||||
* |
||||
* @param string $password password to validate |
||||
* @return boolean if password provided is valid for current user |
||||
*/ |
||||
public function validatePassword($password) |
||||
{ |
||||
return Yii::$app->security->validatePassword($password, $this->password_hash); |
||||
} |
||||
|
||||
/** |
||||
* Generates password hash from password and sets it to the model |
||||
* |
||||
* @param string $password |
||||
*/ |
||||
public function setPassword($password) |
||||
{ |
||||
$this->password_hash = Yii::$app->security->generatePasswordHash($password); |
||||
} |
||||
|
||||
/** |
||||
* Generates "remember me" authentication key |
||||
*/ |
||||
public function generateAuthKey() |
||||
{ |
||||
$this->auth_key = Yii::$app->security->generateRandomString(); |
||||
} |
||||
|
||||
/** |
||||
* Generates new password reset token |
||||
*/ |
||||
public function generatePasswordResetToken() |
||||
{ |
||||
$this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time(); |
||||
} |
||||
|
||||
/** |
||||
* Removes password reset token |
||||
*/ |
||||
public function removePasswordResetToken() |
||||
{ |
||||
$this->password_reset_token = null; |
||||
} |
||||
} |
@ -1,4 +0,0 @@
|
||||
# these files are auto generated by codeception build |
||||
/unit/CodeGuy.php |
||||
/functional/TestGuy.php |
||||
/acceptance/WebGuy.php |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true); |
||||
|
||||
defined('YII_ENV') or define('YII_ENV', 'test'); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php'); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); |
||||
|
||||
require(__DIR__ . '/../../common/config/aliases.php'); |
||||
|
||||
// set correct script paths |
||||
$_SERVER['SERVER_NAME'] = 'localhost'; |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* application configurations shared by all test types |
||||
*/ |
||||
return [ |
||||
'components' => [ |
||||
'mailer' => [ |
||||
'useFileTransport' => true, |
||||
], |
||||
'urlManager' => [ |
||||
'showScriptName' => true, |
||||
], |
||||
], |
||||
]; |
@ -1,19 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
// fcgi doesn't have STDIN and STDOUT defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php'); |
||||
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); |
||||
require_once(__DIR__ . '/../../common/config/aliases.php'); |
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true); |
||||
defined('YII_ENV') or define('YII_ENV', 'test'); |
@ -1 +0,0 @@
|
||||
/* Replace this file with actual dump of your database */ |
@ -1,60 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace common\tests\_helpers; |
||||
|
||||
use Codeception\Module; |
||||
use yii\test\FixtureTrait; |
||||
use common\tests\fixtures\UserFixture; |
||||
|
||||
/** |
||||
* This helper is used to populate database with needed fixtures before any tests should be run. |
||||
* For example - populate database with demo login user that should be used in acceptance and functional tests. |
||||
* All fixtures will be loaded before suite will be starded and unloaded after it. |
||||
*/ |
||||
class FixtureHelper extends Module |
||||
{ |
||||
|
||||
/** |
||||
* Redeclare visibility because codeception includes all public methods that not starts from "_" |
||||
* and not excluded by module settings, in guy class. |
||||
*/ |
||||
use FixtureTrait { |
||||
loadFixtures as protected; |
||||
fixtures as protected; |
||||
globalFixtures as protected; |
||||
unloadFixtures as protected; |
||||
getFixtures as protected; |
||||
getFixture as protected; |
||||
} |
||||
|
||||
/** |
||||
* Method called before any suite tests run. Loads User fixture login user |
||||
* to use in acceptance and functional tests. |
||||
* @param array $settings |
||||
*/ |
||||
public function _beforeSuite($settings = []) |
||||
{ |
||||
$this->loadFixtures(); |
||||
} |
||||
|
||||
/** |
||||
* Method is called after all suite tests run |
||||
*/ |
||||
public function _afterSuite() |
||||
{ |
||||
$this->unloadFixtures(); |
||||
} |
||||
|
||||
/** |
||||
* @inheritdoc |
||||
*/ |
||||
public function fixtures() |
||||
{ |
||||
return [ |
||||
'user' => [ |
||||
'class' => UserFixture::className(), |
||||
'dataFile' => '@common/tests/fixtures/data/init_login.php', |
||||
], |
||||
]; |
||||
} |
||||
} |
@ -1,2 +0,0 @@
|
||||
* |
||||
!.gitignore |
@ -1,21 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace common\tests\_pages; |
||||
|
||||
use yii\codeception\BasePage; |
||||
|
||||
class LoginPage extends BasePage |
||||
{ |
||||
public $route = 'site/login'; |
||||
|
||||
/** |
||||
* @param string $username |
||||
* @param string $password |
||||
*/ |
||||
public function login($username, $password) |
||||
{ |
||||
$this->guy->fillField('input[name="LoginForm[username]"]', $username); |
||||
$this->guy->fillField('input[name="LoginForm[password]"]', $password); |
||||
$this->guy->click('login-button'); |
||||
} |
||||
} |
@ -1,10 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace common\tests\fixtures; |
||||
|
||||
use yii\test\ActiveFixture; |
||||
|
||||
class UserFixture extends ActiveFixture |
||||
{ |
||||
public $modelClass = 'common\models\User'; |
||||
} |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
|
||||
return [ |
||||
[ |
||||
'username' => 'erau', |
||||
'auth_key' => 'tUu1qHcde0diwUol3xeI-18MuHkkprQI', |
||||
// password_0 |
||||
'password_hash' => '$2y$13$nJ1WDlBaGcbCdbNC5.5l4.sgy.OMEKCqtDQOdQ2OWpgiKRWYyzzne', |
||||
'password_reset_token' => 'RkD_Jw0_8HEedzLk7MM-ZKEFfYR7VbMr_1392559490', |
||||
'created_at' => '1392559490', |
||||
'updated_at' => '1392559490', |
||||
'email' => 'sfriesen@jenkins.info', |
||||
], |
||||
]; |
@ -1,17 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* @var $faker \Faker\Generator |
||||
* @var $index integer |
||||
*/ |
||||
|
||||
$security = Yii::$app->getSecurity(); |
||||
|
||||
return [ |
||||
'username' => $faker->userName, |
||||
'email' => $faker->email, |
||||
'auth_key' => $security->generateRandomString(), |
||||
'password_hash' => $security->generatePasswordHash('password_' . $index), |
||||
'password_reset_token' => $security->generateRandomString() . '_' . time(), |
||||
'created_at' => time(), |
||||
'updated_at' => time(), |
||||
]; |
@ -1,6 +0,0 @@
|
||||
# Codeception Test Suite Configuration |
||||
|
||||
# suite for unit (internal) tests. |
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. |
||||
|
||||
class_name: CodeGuy |
@ -1,8 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace common\tests\unit; |
||||
|
||||
class DbTestCase extends \yii\codeception\DbTestCase |
||||
{ |
||||
public $appConfig = '@common/tests/unit/_config.php'; |
||||
} |
@ -1,8 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace common\tests\unit; |
||||
|
||||
class TestCase extends \yii\codeception\TestCase |
||||
{ |
||||
public $appConfig = '@common/tests/unit/_config.php'; |
||||
} |
@ -1,2 +0,0 @@
|
||||
<?php |
||||
// Here you can initialize variables that will for your tests |
@ -1,16 +0,0 @@
|
||||
<?php |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../config/main.php'), |
||||
require(__DIR__ . '/../../config/main-local.php'), |
||||
require(__DIR__ . '/../_config.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit', |
||||
], |
||||
], |
||||
'id' => 'app-common', |
||||
'basePath' => dirname(__DIR__), |
||||
] |
||||
); |
@ -1,22 +0,0 @@
|
||||
<?php |
||||
|
||||
return yii\helpers\ArrayHelper::merge( |
||||
require(__DIR__ . '/../../../console/config/main.php'), |
||||
require(__DIR__ . '/../../../console/config/main-local.php'), |
||||
require(__DIR__ . '/../../config/main.php'), |
||||
require(__DIR__ . '/../../config/main-local.php'), |
||||
[ |
||||
'components' => [ |
||||
'db' => [ |
||||
'dsn' => 'mysql:host=localhost;dbname=yii2_advanced_unit', |
||||
], |
||||
], |
||||
'controllerMap' => [ |
||||
'fixture' => [ |
||||
'class' => 'yii\faker\FixtureController', |
||||
'fixtureDataPath' => '@common/tests/unit/fixtures/data', |
||||
'templatePath' => '@common/tests/templates/fixtures' |
||||
], |
||||
], |
||||
] |
||||
); |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
|
||||
return [ |
||||
[ |
||||
'username' => 'bayer.hudson', |
||||
'auth_key' => 'HP187Mvq7Mmm3CTU80dLkGmni_FUH_lR', |
||||
//password_0 |
||||
'password_hash' => '$2y$13$EjaPFBnZOQsHdGuHI.xvhuDp1fHpo8hKRSk6yshqa9c5EG8s3C3lO', |
||||
'password_reset_token' => 'ExzkCOaYc1L8IOBs4wdTGGbgNiG3Wz1I_1402312317', |
||||
'created_at' => '1402312317', |
||||
'updated_at' => '1402312317', |
||||
'email' => 'nicole.paucek@schultz.info', |
||||
], |
||||
]; |
@ -1,88 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace common\tests\unit\models; |
||||
|
||||
use Yii; |
||||
use common\tests\unit\DbTestCase; |
||||
use Codeception\Specify; |
||||
use common\models\LoginForm; |
||||
use common\tests\fixtures\UserFixture; |
||||
|
||||
class LoginFormTest extends DbTestCase |
||||
{ |
||||
|
||||
use Specify; |
||||
|
||||
public function setUp() |
||||
{ |
||||
parent::setUp(); |
||||
|
||||
Yii::configure(Yii::$app, [ |
||||
'components' => [ |
||||
'user' => [ |
||||
'class' => 'yii\web\User', |
||||
'identityClass' => 'common\models\User', |
||||
], |
||||
], |
||||
]); |
||||
} |
||||
|
||||
protected function tearDown() |
||||
{ |
||||
Yii::$app->user->logout(); |
||||
parent::tearDown(); |
||||
} |
||||
|
||||
public function testLoginNoUser() |
||||
{ |
||||
$model = new LoginForm([ |
||||
'username' => 'not_existing_username', |
||||
'password' => 'not_existing_password', |
||||
]); |
||||
|
||||
$this->specify('user should not be able to login, when there is no identity', function () use ($model) { |
||||
expect('model should not login user', $model->login())->false(); |
||||
expect('user should not be logged in', Yii::$app->user->isGuest)->true(); |
||||
}); |
||||
} |
||||
|
||||
public function testLoginWrongPassword() |
||||
{ |
||||
$model = new LoginForm([ |
||||
'username' => 'bayer.hudson', |
||||
'password' => 'wrong_password', |
||||
]); |
||||
|
||||
$this->specify('user should not be able to login with wrong password', function () use ($model) { |
||||
expect('model should not login user', $model->login())->false(); |
||||
expect('error message should be set', $model->errors)->hasKey('password'); |
||||
expect('user should not be logged in', Yii::$app->user->isGuest)->true(); |
||||
}); |
||||
} |
||||
|
||||
public function testLoginCorrect() |
||||
{ |
||||
|
||||
$model = new LoginForm([ |
||||
'username' => 'bayer.hudson', |
||||
'password' => 'password_0', |
||||
]); |
||||
|
||||
$this->specify('user should be able to login with correct credentials', function () use ($model) { |
||||
expect('model should login user', $model->login())->true(); |
||||
expect('error message should not be set', $model->errors)->hasntKey('password'); |
||||
expect('user should be logged in', Yii::$app->user->isGuest)->false(); |
||||
}); |
||||
} |
||||
|
||||
public function fixtures() |
||||
{ |
||||
return [ |
||||
'user' => [ |
||||
'class' => UserFixture::className(), |
||||
'dataFile' => '@common/tests/unit/fixtures/data/models/user.php' |
||||
], |
||||
]; |
||||
} |
||||
|
||||
} |
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env php |
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
// fcgi doesn't have STDIN and STDOUT defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); |
||||
|
||||
require_once(__DIR__ . '/../_console.php'); |
||||
|
||||
$config = require(__DIR__ . '/_console.php'); |
||||
|
||||
$application = new yii\console\Application($config); |
||||
$exitCode = $application->run(); |
||||
exit($exitCode); |
@ -1,20 +0,0 @@
|
||||
@echo off |
||||
|
||||
rem ------------------------------------------------------------- |
||||
rem Yii command line bootstrap script for Windows. |
||||
rem |
||||
rem @author Qiang Xue <qiang.xue@gmail.com> |
||||
rem @link http://www.yiiframework.com/ |
||||
rem @copyright Copyright © 2012 Yii Software LLC |
||||
rem @license http://www.yiiframework.com/license/ |
||||
rem ------------------------------------------------------------- |
||||
|
||||
@setlocal |
||||
|
||||
set YII_PATH=%~dp0 |
||||
|
||||
if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe |
||||
|
||||
"%PHP_COMMAND%" "%YII_PATH%yii" %* |
||||
|
||||
@endlocal |
@ -1,50 +0,0 @@
|
||||
{ |
||||
"name": "yiisoft/yii2-app-advanced", |
||||
"description": "Yii 2 Advanced Application Template", |
||||
"keywords": ["yii2", "framework", "advanced", "application template"], |
||||
"homepage": "http://www.yiiframework.com/", |
||||
"type": "project", |
||||
"license": "BSD-3-Clause", |
||||
"support": { |
||||
"issues": "https://github.com/yiisoft/yii2/issues?state=open", |
||||
"forum": "http://www.yiiframework.com/forum/", |
||||
"wiki": "http://www.yiiframework.com/wiki/", |
||||
"irc": "irc://irc.freenode.net/yii", |
||||
"source": "https://github.com/yiisoft/yii2" |
||||
}, |
||||
"minimum-stability": "dev", |
||||
"require": { |
||||
"php": ">=5.4.0", |
||||
"yiisoft/yii2": "*", |
||||
"yiisoft/yii2-bootstrap": "*", |
||||
"yiisoft/yii2-swiftmailer": "*" |
||||
}, |
||||
"require-dev": { |
||||
"yiisoft/yii2-codeception": "*", |
||||
"yiisoft/yii2-debug": "*", |
||||
"yiisoft/yii2-gii": "*" |
||||
}, |
||||
"suggest": { |
||||
"codeception/codeception": "Codeception, 2.0.* is currently works well with Yii.", |
||||
"codeception/specify": "BDD style code blocks for PHPUnit and Codeception", |
||||
"codeception/verify": "BDD Assertions for PHPUnit and Codeception", |
||||
"yiisoft/yii2-faker": "Fixtures generator for Yii2 based on Faker lib" |
||||
}, |
||||
"scripts": { |
||||
"post-create-project-cmd": [ |
||||
"yii\\composer\\Installer::setPermission" |
||||
] |
||||
}, |
||||
"config": { |
||||
"process-timeout": 1800 |
||||
}, |
||||
"extra": { |
||||
"writable": [ |
||||
"backend/runtime", |
||||
"backend/web/assets", |
||||
|
||||
"frontend/runtime", |
||||
"frontend/web/assets" |
||||
] |
||||
} |
||||
} |
@ -1,20 +0,0 @@
|
||||
namespace: console |
||||
actor: Tester |
||||
paths: |
||||
tests: tests |
||||
log: tests/_log |
||||
data: tests/_data |
||||
helpers: tests/_helpers |
||||
settings: |
||||
bootstrap: _bootstrap.php |
||||
suite_class: \PHPUnit_Framework_TestSuite |
||||
colors: true |
||||
memory_limit: 1024M |
||||
log: true |
||||
modules: |
||||
config: |
||||
Db: |
||||
dsn: '' |
||||
user: '' |
||||
password: '' |
||||
dump: tests/_data/dump.sql |
@ -1,2 +0,0 @@
|
||||
main-local.php |
||||
params-local.php |
@ -1,26 +0,0 @@
|
||||
<?php |
||||
$params = array_merge( |
||||
require(__DIR__ . '/../../common/config/params.php'), |
||||
require(__DIR__ . '/../../common/config/params-local.php'), |
||||
require(__DIR__ . '/params.php'), |
||||
require(__DIR__ . '/params-local.php') |
||||
); |
||||
|
||||
return [ |
||||
'id' => 'app-console', |
||||
'basePath' => dirname(__DIR__), |
||||
'bootstrap' => ['log'], |
||||
'controllerNamespace' => 'console\controllers', |
||||
'modules' => [], |
||||
'components' => [ |
||||
'log' => [ |
||||
'targets' => [ |
||||
[ |
||||
'class' => 'yii\log\FileTarget', |
||||
'levels' => ['error', 'warning'], |
||||
], |
||||
], |
||||
], |
||||
], |
||||
'params' => $params, |
||||
]; |
@ -1,4 +0,0 @@
|
||||
<?php |
||||
return [ |
||||
'adminEmail' => 'admin@example.com', |
||||
]; |
@ -1,34 +0,0 @@
|
||||
<?php |
||||
|
||||
use yii\db\Schema; |
||||
use yii\db\Migration; |
||||
|
||||
class m130524_201442_init extends Migration |
||||
{ |
||||
public function up() |
||||
{ |
||||
$tableOptions = null; |
||||
if ($this->db->driverName === 'mysql') { |
||||
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; |
||||
} |
||||
|
||||
$this->createTable('{{%user}}', [ |
||||
'id' => Schema::TYPE_PK, |
||||
'username' => Schema::TYPE_STRING . ' NOT NULL', |
||||
'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', |
||||
'password_hash' => Schema::TYPE_STRING . ' NOT NULL', |
||||
'password_reset_token' => Schema::TYPE_STRING, |
||||
'email' => Schema::TYPE_STRING . ' NOT NULL', |
||||
'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', |
||||
|
||||
'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', |
||||
'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', |
||||
'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL', |
||||
], $tableOptions); |
||||
} |
||||
|
||||
public function down() |
||||
{ |
||||
$this->dropTable('{{%user}}'); |
||||
} |
||||
} |
@ -1,2 +0,0 @@
|
||||
# these files are auto generated by codeception build |
||||
/unit/CodeGuy.php |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true); |
||||
|
||||
defined('YII_ENV') or define('YII_ENV', 'test'); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php'); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); |
||||
|
||||
require(__DIR__ . '/../../common/config/aliases.php'); |
||||
|
||||
// set correct script paths |
||||
$_SERVER['SERVER_NAME'] = 'localhost'; |
@ -1,14 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* application configurations shared by all test types |
||||
*/ |
||||
return [ |
||||
'components' => [ |
||||
'mailer' => [ |
||||
'useFileTransport' => true, |
||||
], |
||||
'urlManager' => [ |
||||
'showScriptName' => true, |
||||
], |
||||
], |
||||
]; |
@ -1,19 +0,0 @@
|
||||
<?php |
||||
/** |
||||
* Yii console bootstrap file. |
||||
* |
||||
* @link http://www.yiiframework.com/ |
||||
* @copyright Copyright (c) 2008 Yii Software LLC |
||||
* @license http://www.yiiframework.com/license/ |
||||
*/ |
||||
|
||||
// fcgi doesn't have STDIN and STDOUT defined by default |
||||
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); |
||||
defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); |
||||
|
||||
require_once(__DIR__ . '/../../vendor/autoload.php'); |
||||
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); |
||||
require_once(__DIR__ . '/../../common/config/aliases.php'); |
||||
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true); |
||||
defined('YII_ENV') or define('YII_ENV', 'test'); |
@ -1 +0,0 @@
|
||||
/* Replace this file with actual dump of your database */ |
@ -1,2 +0,0 @@
|
||||
* |
||||
!.gitignore |
@ -1,6 +0,0 @@
|
||||
# Codeception Test Suite Configuration |
||||
|
||||
# suite for unit (internal) tests. |
||||
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. |
||||
|
||||
class_name: CodeGuy |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue