diff --git a/tests/model/DbTest.php b/tests/model/DbTest.php index cb44679..a06dbca 100644 --- a/tests/model/DbTest.php +++ b/tests/model/DbTest.php @@ -30,6 +30,9 @@ class DbTest extends PHPUnit_Framework_TestCase Db::connect('name', 'config'); } + /** + * @group MySQL + */ public function testConnectGlobalConfig() { $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); } + /** + * @group MySQL + */ public function testConnectWithConfigParam() { $conf = array('hostname' => 'localhost', 'driver' => 'MySQLiDriverMock', 'database' => 'db', 'username' => 'test', 'password' => '1234'); diff --git a/tests/model/MySQLiDriverTest.php b/tests/model/MySQLiDriverTest.php index 6ba16bd..c2c12a6 100644 --- a/tests/model/MySQLiDriverTest.php +++ b/tests/model/MySQLiDriverTest.php @@ -25,6 +25,8 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase private $conf = array(); + + protected function getConnection() { if ($this->conn === null) { @@ -49,7 +51,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase $this->setPreserveGlobalState(false); return parent::run($result); } - + /** + * @group MySQL + */ public function testDriver() { 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(3, $this->getConnection()->getRowCount('table')); } - + /** + * @group MySQL + */ public function testGetConnection() { if (!defined('DEBUG')) { @@ -79,7 +85,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase $this->assertInstanceOf('mysqli', $driver->getConnection()); $this->assertTrue($driver->isConnected()); } - + /** + * @group MySQL + */ public function testGetConnectionWrongConfig() { if (!defined('DEBUG')) { @@ -92,7 +100,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase $this->assertNull('mysqli', $driver->getConnection()); } - + /** + * @group MySQL + */ public function testDisconnect() { if (!defined('DEBUG')) { @@ -109,7 +119,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase $driver->disconnect(); $this->assertAttributeEquals(null, 'connection', $driver); } - + /** + * @group MySQL + */ public function testInsert() { if (!defined('DEBUG')) { @@ -130,6 +142,7 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase /** * @TODO: DbDriver::getInsertId($table = null, $key = null) - params not used + * @group MySQL */ 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(3, $driver->getInsertId()); } - + /** + * @group MySQL + */ public function testTransaction() { if (!defined('DEBUG')) { @@ -173,7 +188,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase ->getTable("table"); $this->assertTablesEqual($expectedTable, $queryTable); } - + /** + * @group MySQL + */ public function testRollback() { if (!defined('DEBUG')) { diff --git a/tests/model/MySQLiStatementTest.php b/tests/model/MySQLiStatementTest.php index 518d27b..79e02e0 100644 --- a/tests/model/MySQLiStatementTest.php +++ b/tests/model/MySQLiStatementTest.php @@ -53,6 +53,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group MySQL */ public function testFetchNoResult() { @@ -64,6 +65,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group MySQL */ public function testDriverExecuteNoResult() { @@ -77,6 +79,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group MySQL */ public function testFetch() { @@ -93,6 +96,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group MySQL */ public function testFetchObject() { @@ -106,6 +110,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group MySQL */ public function testFetchWithDebug() { @@ -119,6 +124,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group MySQL */ public function testClose() { @@ -133,6 +139,9 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase $this->assertAttributeEquals(null, 'result', $this->stmt); } + /** + * @group MySQL + */ public function testAffectedRows() { $mysqliMock = $this->getMockBuilder('MysqliDrvr'); @@ -146,6 +155,9 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase $this->assertSame('AFFECTED_ROWS', $this->stmt->affectedRows()); } + /** + * @group MySQL + */ public function testNumRowsNoResult() { $this->assertFalse($this->stmt->numRows()); @@ -154,6 +166,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess * @TODO: exception just for code coverage - could not mock mysqli properties + * @group MySQL */ public function testNumRows() { @@ -168,6 +181,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group MySQL */ public function testFetchInvalidMode() {