Commit 2ca11229 by Qiang Xue

Merge branch 'master' of github.com:yiisoft/yii2

parents 61669700 7cd9123c
<?php
namespace yiiunit;
class MysqlTestCase extends TestCase
{
protected function setUp()
{
parent::setUp();
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) {
$this->markTestSkipped('pdo and pdo_mysql extensions are required.');
}
}
/**
* @param bool $reset whether to clean up the test database
* @return \yii\db\Connection
*/
public function getConnection($reset = true)
{
$params = $this->getParam('mysql');
$db = new \yii\db\Connection;
$db->dsn = $params['dsn'];
$db->username = $params['username'];
$db->password = $params['password'];
if ($reset) {
$db->open();
$lines = explode(';', file_get_contents($params['fixture']));
foreach ($lines as $line) {
if (trim($line) !== '') {
$db->pdo->exec($line);
}
}
}
return $db;
}
}
......@@ -5,7 +5,7 @@ namespace yiiunit;
/**
* This is the base class for all yii framework unit tests.
*/
class TestCase extends \yii\test\TestCase
abstract class TestCase extends \yii\test\TestCase
{
public static $params;
......
<?php
namespace yiiunit\framework\caching;
use yii\caching\ApcCache;
use yiiunit\TestCase;
/**
* Class for testing APC cache backend
*/
class ApcCacheTest extends CacheTest
class ApcCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
......
......@@ -7,7 +7,7 @@ namespace yii\caching;
* @return int
*/
function time() {
return \yiiunit\framework\caching\CacheTest::$time ?: \time();
return \yiiunit\framework\caching\CacheTestCase::$time ?: \time();
}
namespace yiiunit\framework\caching;
......@@ -18,7 +18,7 @@ use yii\caching\Cache;
/**
* Base class for testing cache backends
*/
abstract class CacheTest extends TestCase
abstract class CacheTestCase extends TestCase
{
/**
* @var int virtual time to be returned by mocked time() function.
......
......@@ -3,12 +3,11 @@
namespace yiiunit\framework\caching;
use yii\caching\DbCache;
use yiiunit\TestCase;
/**
* Class for testing file cache backend
*/
class DbCacheTest extends CacheTest
class DbCacheTest extends CacheTestCase
{
private $_cacheInstance;
private $_connection;
......
<?php
namespace yiiunit\framework\caching;
use yii\caching\FileCache;
use yiiunit\TestCase;
/**
* Class for testing file cache backend
*/
class FileCacheTest extends CacheTest
class FileCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
......
<?php
namespace yiiunit\framework\caching;
use yii\caching\MemCache;
use yiiunit\TestCase;
/**
* Class for testing memcache cache backend
*/
class MemCacheTest extends CacheTest
class MemCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
......
<?php
namespace yiiunit\framework\caching;
use yii\caching\MemCache;
use yiiunit\TestCase;
/**
* Class for testing memcached cache backend
*/
class MemCachedTest extends CacheTest
class MemCachedTest extends CacheTestCase
{
private $_cacheInstance = null;
......
<?php
namespace yiiunit\framework\caching;
use yii\caching\FileCache;
use yiiunit\TestCase;
use yii\caching\WinCache;
/**
* Class for testing wincache backend
*/
class WinCacheTest extends CacheTest
class WinCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
......
<?php
namespace yiiunit\framework\caching;
use yii\caching\XCache;
use yiiunit\TestCase;
/**
* Class for testing xcache backend
*/
class XCacheTest extends CacheTest
class XCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
......
<?php
namespace yiiunit\framework\caching;
use yii\caching\Cache;
use yii\caching\ZendDataCache;
use yiiunit\TestCase;
/**
* Class for testing Zend cache backend
*/
class ZendDataCacheTest extends CacheTest
class ZendDataCacheTest extends CacheTestCase
{
private $_cacheInstance = null;
......
<?php
namespace yiiunit\framework\db;
use yii\db\Query;
......@@ -10,7 +9,7 @@ use yiiunit\data\ar\OrderItem;
use yiiunit\data\ar\Order;
use yiiunit\data\ar\Item;
class ActiveRecordTest extends \yiiunit\DatabaseTestCase
class ActiveRecordTest extends DatabaseTestCase
{
protected function setUp()
{
......
......@@ -7,7 +7,7 @@ use yii\db\Command;
use yii\db\Query;
use yii\db\DataReader;
class CommandTest extends \yiiunit\DatabaseTestCase
class CommandTest extends DatabaseTestCase
{
function testConstruct()
{
......
......@@ -4,7 +4,7 @@ namespace yiiunit\framework\db;
use yii\db\Connection;
class ConnectionTest extends \yiiunit\DatabaseTestCase
class ConnectionTest extends DatabaseTestCase
{
function testConstruct()
{
......
<?php
namespace yiiunit\framework\db;
namespace yiiunit;
use yiiunit\TestCase as TestCase;
class DatabaseTestCase extends TestCase
abstract class DatabaseTestCase extends TestCase
{
protected $database;
protected $driverName = 'mysql';
......
......@@ -7,7 +7,7 @@ use yii\db\Command;
use yii\db\Query;
use yii\db\DataReader;
class QueryTest extends \yiiunit\DatabaseTestCase
class QueryTest extends DatabaseTestCase
{
function testSelect()
{
......
......@@ -2,7 +2,9 @@
namespace yiiunit\framework\db\mssql;
class MssqlActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
use yiiunit\framework\db\ActiveRecordTest;
class MssqlActiveRecordTest extends ActiveRecordTest
{
protected function setUp()
{
......
......@@ -2,7 +2,9 @@
namespace yiiunit\framework\db\mssql;
class MssqlCommandTest extends \yiiunit\framework\db\CommandTest
use yiiunit\framework\db\CommandTest;
class MssqlCommandTest extends CommandTest
{
public function setUp()
{
......
......@@ -2,7 +2,9 @@
namespace yiiunit\framework\db\mssql;
class MssqlConnectionTest extends \yiiunit\framework\db\ConnectionTest
use yiiunit\framework\db\ConnectionTest;
class MssqlConnectionTest extends ConnectionTest
{
public function setUp()
{
......
......@@ -2,7 +2,9 @@
namespace yiiunit\framework\db\mssql;
class MssqlQueryTest extends \yiiunit\framework\db\QueryTest
use yiiunit\framework\db\QueryTest;
class MssqlQueryTest extends QueryTest
{
public function setUp()
{
......
<?php
namespace yiiunit\framework\db\sqlite;
class SqliteActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest
use yiiunit\framework\db\ActiveRecordTest;
class SqliteActiveRecordTest extends ActiveRecordTest
{
protected function setUp()
{
......
<?php
namespace yiiunit\framework\db\sqlite;
class SqliteCommandTest extends \yiiunit\framework\db\CommandTest
use yiiunit\framework\db\CommandTest;
class SqliteCommandTest extends CommandTest
{
protected function setUp()
{
......
<?php
namespace yiiunit\framework\db\sqlite;
class SqliteConnectionTest extends \yiiunit\framework\db\ConnectionTest
use yiiunit\framework\db\ConnectionTest;
class SqliteConnectionTest extends ConnectionTest
{
protected function setUp()
{
......
<?php
/**
* Created by JetBrains PhpStorm.
* User: RusMaxim
* Date: 09.05.13
* Time: 21:41
* To change this template use File | Settings | File Templates.
*/
namespace yiiunit\framework\db\sqlite;
use yiiunit\framework\db\QueryTest;
class SqliteQueryTest extends \yiiunit\framework\db\QueryTest
class SqliteQueryTest extends QueryTest
{
protected function setUp()
{
......
......@@ -3,10 +3,10 @@
namespace yiiunit\framework\helpers;
use yii\helpers\ArrayHelper;
use yii\helpers\VarDumper;
use yii\test\TestCase;
use yii\web\Sort;
class ArrayHelperTest extends \yii\test\TestCase
class ArrayHelperTest extends TestCase
{
public function testMerge()
{
......
......@@ -4,9 +4,10 @@
namespace yiiunit\framework\helpers;
use yii\helpers\Json;
use yii\test\TestCase;
use yii\web\JsExpression;
class JsonTest extends \yii\test\TestCase
class JsonTest extends TestCase
{
public function testEncode()
{
......
<?php
namespace yiiunit\framework\helpers;
use \yii\helpers\StringHelper as StringHelper;
use yii\test\TestCase;
/**
* StringHelperTest
*/
class StringHelperTest extends \yii\test\TestCase
class StringHelperTest extends TestCase
{
public function testStrlen()
{
......
<?php
namespace yiiunit\framework\helpers;
use \yii\helpers\VarDumper;
use yii\test\TestCase;
class VarDumperTest extends \yii\test\TestCase
class VarDumperTest extends TestCase
{
public function testDumpObject()
{
......
......@@ -6,7 +6,7 @@ use yii\rbac\Assignment;
use yii\rbac\Item;
use yiiunit\TestCase;
abstract class ManagerTestBase extends TestCase
abstract class ManagerTestCase extends TestCase
{
/** @var \yii\rbac\PhpManager|\yii\rbac\DbManager */
protected $auth;
......
......@@ -5,9 +5,7 @@ namespace yiiunit\framework\rbac;
use Yii;
use yii\rbac\PhpManager;
//require_once(__DIR__ . '/ManagerTestBase.php');
class PhpManagerTest extends ManagerTestBase
class PhpManagerTest extends ManagerTestCase
{
protected function setUp()
{
......
......@@ -3,8 +3,9 @@ namespace yiiunit\framework\web;
use yii\web\Request;
use yii\web\UrlManager;
use yiiunit\TestCase;
class UrlManagerTest extends \yiiunit\TestCase
class UrlManagerTest extends TestCase
{
public function testCreateUrl()
{
......
......@@ -5,8 +5,9 @@ namespace yiiunit\framework\web;
use yii\web\UrlManager;
use yii\web\UrlRule;
use yii\web\Request;
use yiiunit\TestCase;
class UrlRuleTest extends \yiiunit\TestCase
class UrlRuleTest extends TestCase
{
public function testCreateUrl()
{
......
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