-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
792 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
return yii\helpers\ArrayHelper::merge( | ||
require(__DIR__ . '/../../common/config/test-local.php'), | ||
require(__DIR__ . '/main.php'), | ||
require(__DIR__ . '/main-local.php'), | ||
require(__DIR__ . '/test.php'), | ||
[ | ||
] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
defined('YII_ENV') or define('YII_ENV', 'test'); | ||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', __DIR__.'/../../'); | ||
|
||
require_once YII_APP_BASE_PATH . '/vendor/autoload.php'; | ||
require_once YII_APP_BASE_PATH . '/vendor/yiisoft/yii2/Yii.php'; | ||
require_once YII_APP_BASE_PATH . '/common/config/bootstrap.php'; | ||
require_once __DIR__ . '/../config/bootstrap.php'; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?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' => '[email protected]', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace backend\tests; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class FunctionalTester extends \Codeception\Actor | ||
{ | ||
use _generated\FunctionalTesterActions; | ||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace backend\tests; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class UnitTester extends \Codeception\Actor | ||
{ | ||
use _generated\UnitTesterActions; | ||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class_name: FunctionalTester | ||
modules: | ||
enabled: | ||
- Yii2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace backend\tests\functional; | ||
|
||
use backend\tests\FunctionalTester; | ||
use common\fixtures\UserFixture; | ||
|
||
/** | ||
* Class LoginCest | ||
*/ | ||
class LoginCest | ||
{ | ||
|
||
/** | ||
* Load fixtures before db transaction begin | ||
* Called in _before() | ||
* @see \Codeception\Module\Yii2::_before() | ||
* @see \Codeception\Module\Yii2::loadFixtures() | ||
* @return array | ||
*/ | ||
public function _fixtures() | ||
{ | ||
return [ | ||
'user' => [ | ||
'class' => UserFixture::className(), | ||
'dataFile' => codecept_data_dir() . 'login_data.php' | ||
] | ||
]; | ||
} | ||
|
||
/** | ||
* @param FunctionalTester $I | ||
*/ | ||
public function loginUser(FunctionalTester $I) | ||
{ | ||
$I->amOnPage('/site/login'); | ||
$I->fillField('Username', 'erau'); | ||
$I->fillField('Password', 'password_0'); | ||
$I->click('login-button'); | ||
|
||
$I->see('Logout (erau)', 'form button[type=submit]'); | ||
$I->dontSeeLink('Login'); | ||
$I->dontSeeLink('Signup'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Here you can initialize variables via \Codeception\Util\Fixtures class | ||
* to store data in global array and use it in Cests. | ||
* | ||
* ```php | ||
* // Here _bootstrap.php | ||
* \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']); | ||
* ``` | ||
* | ||
* In Cests | ||
* | ||
* ```php | ||
* \Codeception\Util\Fixtures::get('user1'); | ||
* ``` | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class_name: UnitTester |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Here you can initialize variables via \Codeception\Util\Fixtures class | ||
* to store data in global array and use it in Tests. | ||
* | ||
* ```php | ||
* // Here _bootstrap.php | ||
* \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']); | ||
* ``` | ||
* | ||
* In Tests | ||
* | ||
* ```php | ||
* \Codeception\Util\Fixtures::get('user1'); | ||
* ``` | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
return yii\helpers\ArrayHelper::merge( | ||
require(__DIR__ . '/main.php'), | ||
require(__DIR__ . '/main-local.php'), | ||
require(__DIR__ . '/test.php'), | ||
[ | ||
'components' => [ | ||
'db' => [ | ||
'dsn' => 'mysql:host=localhost;dbname=yii2advanced_test', | ||
] | ||
], | ||
] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
return [ | ||
'id' => 'app-common-tests', | ||
'basePath' => dirname(__DIR__), | ||
'components' => [ | ||
'user' => [ | ||
'class' => 'yii\web\User', | ||
'identityClass' => 'common\models\User', | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
return yii\helpers\ArrayHelper::merge( | ||
require(__DIR__ . '/../../common/config/test-local.php'), | ||
require(__DIR__ . '/main.php'), | ||
require(__DIR__ . '/main-local.php'), | ||
require(__DIR__ . '/test.php'), | ||
[ | ||
] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
defined('YII_ENV') or define('YII_ENV', 'test'); | ||
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', __DIR__.'/../../'); | ||
|
||
require_once YII_APP_BASE_PATH . '/vendor/autoload.php'; | ||
require_once YII_APP_BASE_PATH . '/vendor/yiisoft/yii2/Yii.php'; | ||
require_once YII_APP_BASE_PATH . '/common/config/bootstrap.php'; | ||
require_once __DIR__ . '/../config/bootstrap.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?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' => '[email protected]', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
return [ | ||
[ | ||
'username' => 'okirlin', | ||
'auth_key' => 'iwTNae9t34OmnK6l4vT4IeaTk-YWI2Rv', | ||
'password_hash' => '$2y$13$CXT0Rkle1EMJ/c1l5bylL.EylfmQ39O5JlHJVFpNn618OUS1HwaIi', | ||
'password_reset_token' => 't5GU9NwpuGYSfb7FEZMAxqtuz2PkEvv_' . time(), | ||
'created_at' => '1391885313', | ||
'updated_at' => '1391885313', | ||
'email' => '[email protected]', | ||
], | ||
[ | ||
'username' => 'troy.becker', | ||
'auth_key' => 'EdKfXrx88weFMV0vIxuTMWKgfK2tS3Lp', | ||
'password_hash' => '$2y$13$g5nv41Px7VBqhS3hVsVN2.MKfgT3jFdkXEsMC4rQJLfaMa7VaJqL2', | ||
'password_reset_token' => '4BSNyiZNAuxjs5Mty990c47sVrgllIi_' . time(), | ||
'created_at' => '1391885313', | ||
'updated_at' => '1391885313', | ||
'email' => '[email protected]', | ||
'status' => '0', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
namespace frontend\tests; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class FunctionalTester extends \Codeception\Actor | ||
{ | ||
use _generated\FunctionalTesterActions; | ||
|
||
|
||
public function seeValidationError($message) | ||
{ | ||
$this->see($message, '.help-block'); | ||
} | ||
|
||
public function dontSeeValidationError($message) | ||
{ | ||
$this->dontSee($message, '.help-block'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
namespace frontend\tests; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class UnitTester extends \Codeception\Actor | ||
{ | ||
use _generated\UnitTesterActions; | ||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class_name: AcceptanceTester | ||
modules: | ||
enabled: | ||
- WebDriver: | ||
url: http://localhost:8080 | ||
browser: firefox | ||
- Yii2: | ||
part: init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace frontend\tests\acceptance; | ||
|
||
use frontend\tests\AcceptanceTester; | ||
use yii\helpers\Url; | ||
|
||
class HomeCest | ||
{ | ||
public function checkHome(AcceptanceTester $I) | ||
{ | ||
$I->amOnPage(Url::toRoute('/site/index')); | ||
$I->see('My Application'); | ||
|
||
$I->seeLink('About'); | ||
$I->click('About'); | ||
$I->wait(2); // wait for page to be opened | ||
|
||
$I->see('This is the About page.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Here you can initialize variables via \Codeception\Util\Fixtures class | ||
* to store data in global array and use it in Cepts. | ||
* | ||
* ```php | ||
* // Here _bootstrap.php | ||
* \Codeception\Util\Fixtures::add('user1', ['name' => 'davert']); | ||
* ``` | ||
* | ||
* In Cept | ||
* | ||
* ```php | ||
* \Codeception\Util\Fixtures::get('user1'); | ||
* ``` | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class_name: FunctionalTester | ||
modules: | ||
enabled: | ||
- Filesystem | ||
- Yii2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
namespace frontend\tests\functional; | ||
|
||
use frontend\tests\FunctionalTester; | ||
|
||
class AboutCest | ||
{ | ||
public function checkAbout(FunctionalTester $I) | ||
{ | ||
$I->amOnRoute('site/about'); | ||
$I->see('About', 'h1'); | ||
} | ||
} |
Oops, something went wrong.