Yii2 Bootstrap 3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.2 KiB

<?php
namespace yii\codeception;
use Yii;
/**
* TestCase is the base class for all codeception unit tests
*
* @author Mark Jebri <mark.github@yandex.ru>
* @since 2.0
*/
class TestCase extends \PHPUnit_Framework_TestCase
{
/**
11 years ago
* @var array the application configuration that will be used for creating an application instance for each test.
*/
11 years ago
public static $appConfig = [];
/**
11 years ago
* @var string the application class that [[mockApplication()]] should use
*/
11 years ago
public static $appClass = 'yii\web\Application';
/**
11 years ago
* @inheritdoc
*/
protected function tearDown()
{
$this->destroyApplication();
parent::tearDown();
}
/**
11 years ago
* Mocks up the application instance.
* @param array $config the configuration that should be used to generate the application instance.
* If null, [[appConfig]] will be used.
* @return \yii\web\Application|\yii\console\Application the application instance
*/
11 years ago
protected function mockApplication($config = null)
{
11 years ago
return new static::$appClass($config === null ? static::$appConfig : $config);
}
/**
11 years ago
* Destroys the application instance created by [[mockApplication]].
*/
protected function destroyApplication()
{
11 years ago
Yii::$app = null;
}
}