1
0
www.mikescher.com/www/protected/extensions/bootstrap/tests/unit/TbTestCase.php

69 lines
1.5 KiB
PHP
Raw Normal View History

2014-05-13 14:06:18 +02:00
<?php
require(__DIR__ . '/../../vendor/yiisoft/yii/tests/TestApplication.php');
require(__DIR__ . '/../../vendor/yiisoft/yii/framework/collections/CMap.php');
class TbTestCase extends \Codeception\TestCase\Test
{
/**
*
*/
protected function _after()
{
$this->destroyApplication();
}
/**
* @param array $config
* @param string $appClass
*/
protected function mockApplication($config = array(), $appClass = 'TestApplication')
{
$defaultConfig = array(
'basePath' => __DIR__,
'aliases' => array(
'bootstrap' => __DIR__ . '/../..',
),
);
Yii::createApplication(
$appClass,
CMap::mergeArray($defaultConfig, $config)
);
}
/**
*
*/
protected function destroyApplication()
{
Yii::setApplication(null);
}
/**
* @param $widgetClass
* @param array $properties
* @return string
*/
protected function runWidget($widgetClass, $properties = array())
{
return $this->mockController()->widget($widgetClass, $properties, true);
}
/**
* @param $widgetClass
* @param array $properties
* @return CWidget
*/
protected function beginWidget($widgetClass, $properties = array())
{
return $this->mockController()->beginWidget($widgetClass, $properties);
}
/**
* @return CController
*/
private function mockController()
{
return new CController('dummy');
}
}