Commit 1e24d60b by Mark

added new extension yii2-codeception, modified composer settings

parent 520b491d
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"yiisoft/yii2": "*", "yiisoft/yii2": "*",
"yiisoft/yii2-swiftmailer": "*", "yiisoft/yii2-swiftmailer": "*",
"yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*", "yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*" "yiisoft/yii2-gii": "*"
}, },
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
"minimum-stability": "dev", "minimum-stability": "dev",
"replace": { "replace": {
"yiisoft/yii2-bootstrap": "self.version", "yiisoft/yii2-bootstrap": "self.version",
"yiisoft/yii2-codeception": "self.version",
"yiisoft/yii2-debug": "self.version", "yiisoft/yii2-debug": "self.version",
"yiisoft/yii2-elasticsearch": "self.version", "yiisoft/yii2-elasticsearch": "self.version",
"yiisoft/yii2-gii": "self.version", "yiisoft/yii2-gii": "self.version",
...@@ -79,6 +80,7 @@ ...@@ -79,6 +80,7 @@
"autoload": { "autoload": {
"psr-0": { "psr-0": {
"yii\\bootstrap\\": "extensions/bootstrap/", "yii\\bootstrap\\": "extensions/bootstrap/",
"yii\\codeception\\": "extensions/codeception/",
"yii\\debug\\": "extensions/debug/", "yii\\debug\\": "extensions/debug/",
"yii\\elasticsearch\\": "extensions/elasticsearch/", "yii\\elasticsearch\\": "extensions/elasticsearch/",
"yii\\gii\\": "extensions/gii/", "yii\\gii\\": "extensions/gii/",
......
<?php
namespace yii\codeception;
class BasePage
{
// include url of current page
public static $URL = '';
/**
* Declare UI map for this page here. CSS or XPath allowed.
* public static $usernameField = '#username';
* public static $formSubmitButton = "#mainForm input[type=submit]";
*/
/**
* Basic route example for your current URL
* You can append any additional parameter to URL
* and use it in tests like: EditPage::route('/123-post');
*/
public static function route($param)
{
return static::$URL.$param;
}
/**
* @var
*/
protected $guy;
public function __construct($I)
{
$this->guy = $I;
}
/**
* @return $this
*/
public static function of($I)
{
return new static($I);
}
}
<?php
namespace yii\codeception;
use Yii;
class TestCase extends \PHPUnit_Framework_TestCase
{
/**
* Your application base config that will be used for creating application each time before test.
* This can be an array or alias, pointing to the config file. For example for console application it can be
* '@tests/unit/console_bootstrap.php' that can be similar to existing unit tests bootstrap file.
* @var mixed
*/
protected $baseConfig = '@tests/unit/_bootstrap.php';
/**
* Your application config, will be merged with base config when creating application. Can be an alias too.
* @var mixed
*/
protected $config = array();
/**
* Created application class
* @var string
*/
protected $appClass = '\yii\web\Application';
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
protected function tearDown()
{
$this->destroyApplication();
parent::tearDown();
}
protected function mockApplication()
{
$baseConfig = is_array($this->baseConfig)? $this->baseConfig : require(Yii::getAlias($this->baseConfig, true));
$config = is_array($this->config)? $this->config : require(Yii::getAlias($this->config, true));
new $this->appClass(\yii\helpers\ArrayHelper::merge($baseConfig,$config));
}
protected function destroyApplication()
{
\Yii::$app = null;
}
}
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