for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @link https://github.com/yiiviet/yii2-payment
* @copyright Copyright (c) 2017 Yii2VN
* @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
*/
namespace yiiviet\tests\unit\validator;
use Yii;
use yii\helpers\ArrayHelper;
use yiiviet\validator\Bootstrap;
use PHPUnit\Framework\TestCase as BaseTestCase;
* Class TestCase
*
* @author Vuong Minh <[email protected]>
* @since 1.0
class TestCase extends BaseTestCase
{
public function setUp()
$this->mockApplication();
parent::setUp();
}
public function tearDown()
$this->destroyApplication();
parent::tearDown();
protected function mockApplication($config = [], $appClass = '\yii\console\Application')
new $appClass(ArrayHelper::merge([
'id' => 'testapp',
'basePath' => __DIR__,
'bootstrap' => [
Bootstrap::class
],
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
], $config));
* Destroys application in Yii::$app by setting it to null.
protected function destroyApplication()
Yii::$app = null;