|
|
@ -28,26 +28,19 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Populates Yii::$app with a new application |
|
|
|
* @param array $config |
|
|
|
* The application will be destroyed on tearDown() automatically. |
|
|
|
* @param string $appClass |
|
|
|
* @param array $config The application configuration, if needed |
|
|
|
|
|
|
|
* @param string $appClass name of the application class to create |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
protected function mockApplication($config = [], $appClass = '\yii\console\Application') |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new $appClass(ArrayHelper::merge([ |
|
|
|
|
|
|
|
'id' => 'testapp', |
|
|
|
|
|
|
|
'basePath' => __DIR__, |
|
|
|
|
|
|
|
'vendorPath' => dirname(__DIR__) . '/vendor', |
|
|
|
|
|
|
|
], $config)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function mockWebApplication($config = [], $appClass = '\yii\web\Application') |
|
|
|
protected function mockWebApplication($config = [], $appClass = '\yii\web\Application') |
|
|
|
{ |
|
|
|
{ |
|
|
|
new $appClass(ArrayHelper::merge([ |
|
|
|
new $appClass(ArrayHelper::merge([ |
|
|
|
'id' => 'testapp', |
|
|
|
'id' => 'testapp', |
|
|
|
'basePath' => __DIR__, |
|
|
|
'basePath' => __DIR__, |
|
|
|
'vendorPath' => dirname(__DIR__) . '/vendor', |
|
|
|
'vendorPath' => dirname(__DIR__) . '/vendor', |
|
|
|
|
|
|
|
'aliases' => [ |
|
|
|
|
|
|
|
'@bower' => '@vendor/bower-asset', |
|
|
|
|
|
|
|
'@npm' => '@vendor/npm-asset', |
|
|
|
|
|
|
|
], |
|
|
|
'components' => [ |
|
|
|
'components' => [ |
|
|
|
'request' => [ |
|
|
|
'request' => [ |
|
|
|
'cookieValidationKey' => 'wefJDF8sfdsfSDefwqdxj9oq', |
|
|
|
'cookieValidationKey' => 'wefJDF8sfdsfSDefwqdxj9oq', |
|
|
|