From 2c611dc3db769c899cbe806a93a3e54e1cd1ef56 Mon Sep 17 00:00:00 2001 From: Anton Grebnev Date: Tue, 6 Dec 2011 16:53:16 +0400 Subject: [PATCH] added Mongo group for tests --- tests/model/MongoDbCommandTest.php | 42 ++++++++++++++++++++++++++++++++++++++ tests/model/MongoDriverTest.php | 23 +++++++++++++++++++++ tests/model/MongoModelTest.php | 9 ++++++++ tests/model/MongoStatementTest.php | 17 +++++++++++++++ 4 files changed, 91 insertions(+) diff --git a/tests/model/MongoDbCommandTest.php b/tests/model/MongoDbCommandTest.php index 2d08e61..8302b42 100644 --- a/tests/model/MongoDbCommandTest.php +++ b/tests/model/MongoDbCommandTest.php @@ -44,6 +44,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->collection = $db->selectCollection($collection); } + /** + * @group Mongo + */ public function testCommandFactory() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND); @@ -60,6 +63,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->assertInstanceOf('RemoveMongoCommand', $cmd); } + /** + * @group Mongo + */ public function testFindCommand() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->collection); @@ -90,6 +96,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->assertEquals('insert', $result['name']); } + /** + * @group Mongo + */ public function testFindCommandNotAllParamsBinded() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->collection); @@ -98,6 +107,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $cmd->execute(); } + /** + * @group Mongo + */ public function testInsertCommand() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); @@ -117,6 +129,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->assertEquals(1, $result->count()); } + /** + * @group Mongo + */ public function testInsertCommandNotAllParamsBinded() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); @@ -124,6 +139,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $cmd->execute(); } + /** + * @group Mongo + */ public function testUpdateCommand() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); @@ -149,6 +167,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->assertEquals(1, $result->count()); } + /** + * @group Mongo + */ public function testUpdateCommandNotAllParamsBinded() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::UPDATE, $this->collection); @@ -157,6 +178,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $cmd->execute(); } + /** + * @group Mongo + */ public function testRemoveCommand() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); @@ -182,6 +206,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->assertEquals(0, $result->count()); } + /** + * @group Mongo + */ public function testRemoveCommandNotAllParamsBinded() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::REMOVE, $this->collection); @@ -189,6 +216,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $cmd->execute(); } + /** + * @group Mongo + */ public function testCommandCommandNotAllParamsBinded() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, $this->collection); @@ -196,6 +226,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $cmd->execute(); } + /** + * @group Mongo + */ public function testCommandCommandNotMongoDb() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock()); @@ -203,6 +236,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->assertFalse($cmd->execute()); } + /** + * @group Mongo + */ public function testCommandCommand() { $col = new CollectionMock(); @@ -216,12 +252,18 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase $this->assertTrue($cmd->execute()); } + /** + * @group Mongo + */ public function testToStringParamsNotSet() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock()); $this->assertSame('Command properties not set', $cmd->__toString()); } + /** + * @group Mongo + */ public function testToString() { $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock()); diff --git a/tests/model/MongoDriverTest.php b/tests/model/MongoDriverTest.php index 4a102e7..b673d4f 100644 --- a/tests/model/MongoDriverTest.php +++ b/tests/model/MongoDriverTest.php @@ -72,6 +72,9 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase } } + /** + * @group Mongo + */ public function testGetConnectionNoHostname() { unset($this->conf['hostname']); @@ -79,6 +82,9 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase $mongo = new MongoDriver($this->conf); } + /** + * @group Mongo + */ public function testGetConnectionWrongPassword() { $this->conf['password'] = 'nopass'; @@ -87,6 +93,9 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase $this->assertInstanceOf('MongoDB', $mongo->getConnection()); } + /** + * @group Mongo + */ public function testGetConnection() { $mongo = new MongoDriver($this->conf); @@ -101,6 +110,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFind() { @@ -131,6 +141,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testOrderSkipLimit() { @@ -169,6 +180,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testCount() { @@ -183,6 +195,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testGet() { @@ -200,6 +213,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testRemove() { @@ -217,6 +231,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testInsert() { @@ -233,6 +248,10 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase $this->assertEquals(230, $mongo->get('items', array('name' => 'meat'))->fetch()->weight); } + /** + * @runInSeparateProcess + * @group Mongo + */ public function testGetInsertId() { if (!defined('DEBUG')) { @@ -255,6 +274,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testUpdate() { @@ -274,6 +294,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testUpsert() { @@ -290,6 +311,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFindAndModify() { @@ -307,6 +329,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testCommand() { diff --git a/tests/model/MongoModelTest.php b/tests/model/MongoModelTest.php index cc3d8a6..c9cc58c 100644 --- a/tests/model/MongoModelTest.php +++ b/tests/model/MongoModelTest.php @@ -50,6 +50,9 @@ class MongoModelTest extends PHPUnit_Framework_TestCase set_new_overload(array($this, 'newCallback')); } + /** + * @group Mongo + */ public function testModel() { $this->assertInstanceOf('MongoMockModel', $this->model); @@ -57,6 +60,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFind() { @@ -71,6 +75,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testGet() { @@ -86,6 +91,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testDelete() { @@ -100,6 +106,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testDeleteAll() { @@ -114,6 +121,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testCount() { @@ -126,6 +134,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFetch() { diff --git a/tests/model/MongoStatementTest.php b/tests/model/MongoStatementTest.php index e18c5d6..c945925 100644 --- a/tests/model/MongoStatementTest.php +++ b/tests/model/MongoStatementTest.php @@ -57,6 +57,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testAffectedNumRowsNoResult() { @@ -77,6 +78,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testAffectedNumRows() { @@ -94,6 +96,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testGetInsertId() { @@ -124,6 +127,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testExecute() { @@ -137,6 +141,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testExecuteNoResult() { @@ -154,6 +159,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testExecuteNoConnection() { @@ -170,6 +176,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testExecuteWithDebug() { @@ -183,6 +190,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testBindParam() { @@ -205,6 +213,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFetch() { @@ -223,6 +232,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFetchWithInitialArray() { @@ -243,6 +253,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFetchAssocFromCursor() { @@ -261,6 +272,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFetchAssocFromArray() { @@ -282,6 +294,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testFetchWrongMode() { @@ -303,6 +316,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testSkipOrderLimit() { @@ -322,6 +336,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testOrderException() { @@ -341,6 +356,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testSkipException() { @@ -360,6 +376,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase /** * @runInSeparateProcess + * @group Mongo */ public function testLimitException() {