Browse Source

Add association @group from exceptions mysql of the tests

master
Vyacheslav Agafonov 13 years ago
parent
commit
24c2a97f51
  1. 6
      tests/model/DbTest.php
  2. 31
      tests/model/MySQLiDriverTest.php
  3. 14
      tests/model/MySQLiStatementTest.php

6
tests/model/DbTest.php

@ -30,6 +30,9 @@ class DbTest extends PHPUnit_Framework_TestCase
Db::connect('name', 'config'); Db::connect('name', 'config');
} }
/**
* @group MySQL
*/
public function testConnectGlobalConfig() public function testConnectGlobalConfig()
{ {
$conf = array('hostname' => 'localhost', 'driver' => 'MySQLiDriverGlobalConfMock', 'database' => 'db', 'username' => 'test', 'password' => '1234'); $conf = array('hostname' => 'localhost', 'driver' => 'MySQLiDriverGlobalConfMock', 'database' => 'db', 'username' => 'test', 'password' => '1234');
@ -39,6 +42,9 @@ class DbTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('DbDriver', $driver); $this->assertInstanceOf('DbDriver', $driver);
} }
/**
* @group MySQL
*/
public function testConnectWithConfigParam() public function testConnectWithConfigParam()
{ {
$conf = array('hostname' => 'localhost', 'driver' => 'MySQLiDriverMock', 'database' => 'db', 'username' => 'test', 'password' => '1234'); $conf = array('hostname' => 'localhost', 'driver' => 'MySQLiDriverMock', 'database' => 'db', 'username' => 'test', 'password' => '1234');

31
tests/model/MySQLiDriverTest.php

@ -25,6 +25,8 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
private $conf = array(); private $conf = array();
protected function getConnection() protected function getConnection()
{ {
if ($this->conn === null) { if ($this->conn === null) {
@ -49,7 +51,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
$this->setPreserveGlobalState(false); $this->setPreserveGlobalState(false);
return parent::run($result); return parent::run($result);
} }
/**
* @group MySQL
*/
public function testDriver() public function testDriver()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {
@ -68,7 +72,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
$this->assertSame(1, $driver->insert('table', array('id' => 3, 'user' => 'tony', 'content' => 'some test content', 'created' => '2011-11-07 11:35:20'))); $this->assertSame(1, $driver->insert('table', array('id' => 3, 'user' => 'tony', 'content' => 'some test content', 'created' => '2011-11-07 11:35:20')));
$this->assertSame(3, $this->getConnection()->getRowCount('table')); $this->assertSame(3, $this->getConnection()->getRowCount('table'));
} }
/**
* @group MySQL
*/
public function testGetConnection() public function testGetConnection()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {
@ -79,7 +85,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
$this->assertInstanceOf('mysqli', $driver->getConnection()); $this->assertInstanceOf('mysqli', $driver->getConnection());
$this->assertTrue($driver->isConnected()); $this->assertTrue($driver->isConnected());
} }
/**
* @group MySQL
*/
public function testGetConnectionWrongConfig() public function testGetConnectionWrongConfig()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {
@ -92,7 +100,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
$this->assertNull('mysqli', $driver->getConnection()); $this->assertNull('mysqli', $driver->getConnection());
} }
/**
* @group MySQL
*/
public function testDisconnect() public function testDisconnect()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {
@ -109,7 +119,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
$driver->disconnect(); $driver->disconnect();
$this->assertAttributeEquals(null, 'connection', $driver); $this->assertAttributeEquals(null, 'connection', $driver);
} }
/**
* @group MySQL
*/
public function testInsert() public function testInsert()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {
@ -130,6 +142,7 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
/** /**
* @TODO: DbDriver::getInsertId($table = null, $key = null) - params not used * @TODO: DbDriver::getInsertId($table = null, $key = null) - params not used
* @group MySQL
*/ */
public function testGetInsertId() public function testGetInsertId()
{ {
@ -142,7 +155,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
$this->assertSame(1, $driver->insert('table', array('id' => 3, 'user' => 'tony', 'content' => 'some test content', 'created' => '2011-11-07 11:35:20'))); $this->assertSame(1, $driver->insert('table', array('id' => 3, 'user' => 'tony', 'content' => 'some test content', 'created' => '2011-11-07 11:35:20')));
$this->assertSame(3, $driver->getInsertId()); $this->assertSame(3, $driver->getInsertId());
} }
/**
* @group MySQL
*/
public function testTransaction() public function testTransaction()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {
@ -173,7 +188,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
->getTable("table"); ->getTable("table");
$this->assertTablesEqual($expectedTable, $queryTable); $this->assertTablesEqual($expectedTable, $queryTable);
} }
/**
* @group MySQL
*/
public function testRollback() public function testRollback()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {

14
tests/model/MySQLiStatementTest.php

@ -53,6 +53,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group MySQL
*/ */
public function testFetchNoResult() public function testFetchNoResult()
{ {
@ -64,6 +65,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group MySQL
*/ */
public function testDriverExecuteNoResult() public function testDriverExecuteNoResult()
{ {
@ -77,6 +79,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group MySQL
*/ */
public function testFetch() public function testFetch()
{ {
@ -93,6 +96,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group MySQL
*/ */
public function testFetchObject() public function testFetchObject()
{ {
@ -106,6 +110,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group MySQL
*/ */
public function testFetchWithDebug() public function testFetchWithDebug()
{ {
@ -119,6 +124,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group MySQL
*/ */
public function testClose() public function testClose()
{ {
@ -133,6 +139,9 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
$this->assertAttributeEquals(null, 'result', $this->stmt); $this->assertAttributeEquals(null, 'result', $this->stmt);
} }
/**
* @group MySQL
*/
public function testAffectedRows() public function testAffectedRows()
{ {
$mysqliMock = $this->getMockBuilder('MysqliDrvr'); $mysqliMock = $this->getMockBuilder('MysqliDrvr');
@ -146,6 +155,9 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
$this->assertSame('AFFECTED_ROWS', $this->stmt->affectedRows()); $this->assertSame('AFFECTED_ROWS', $this->stmt->affectedRows());
} }
/**
* @group MySQL
*/
public function testNumRowsNoResult() public function testNumRowsNoResult()
{ {
$this->assertFalse($this->stmt->numRows()); $this->assertFalse($this->stmt->numRows());
@ -154,6 +166,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @TODO: exception just for code coverage - could not mock mysqli properties * @TODO: exception just for code coverage - could not mock mysqli properties
* @group MySQL
*/ */
public function testNumRows() public function testNumRows()
{ {
@ -168,6 +181,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group MySQL
*/ */
public function testFetchInvalidMode() public function testFetchInvalidMode()
{ {

Loading…
Cancel
Save