Browse Source

added Mongo group for tests

master
Anton Grebnev 13 years ago
parent
commit
2c611dc3db
  1. 42
      tests/model/MongoDbCommandTest.php
  2. 23
      tests/model/MongoDriverTest.php
  3. 9
      tests/model/MongoModelTest.php
  4. 17
      tests/model/MongoStatementTest.php

42
tests/model/MongoDbCommandTest.php

@ -44,6 +44,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->collection = $db->selectCollection($collection); $this->collection = $db->selectCollection($collection);
} }
/**
* @group Mongo
*/
public function testCommandFactory() public function testCommandFactory()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND);
@ -60,6 +63,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('RemoveMongoCommand', $cmd); $this->assertInstanceOf('RemoveMongoCommand', $cmd);
} }
/**
* @group Mongo
*/
public function testFindCommand() public function testFindCommand()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->collection);
@ -90,6 +96,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertEquals('insert', $result['name']); $this->assertEquals('insert', $result['name']);
} }
/**
* @group Mongo
*/
public function testFindCommandNotAllParamsBinded() public function testFindCommandNotAllParamsBinded()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::FIND, $this->collection);
@ -98,6 +107,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$cmd->execute(); $cmd->execute();
} }
/**
* @group Mongo
*/
public function testInsertCommand() public function testInsertCommand()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection);
@ -117,6 +129,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $result->count()); $this->assertEquals(1, $result->count());
} }
/**
* @group Mongo
*/
public function testInsertCommandNotAllParamsBinded() public function testInsertCommandNotAllParamsBinded()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection);
@ -124,6 +139,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$cmd->execute(); $cmd->execute();
} }
/**
* @group Mongo
*/
public function testUpdateCommand() public function testUpdateCommand()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection);
@ -149,6 +167,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $result->count()); $this->assertEquals(1, $result->count());
} }
/**
* @group Mongo
*/
public function testUpdateCommandNotAllParamsBinded() public function testUpdateCommandNotAllParamsBinded()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::UPDATE, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::UPDATE, $this->collection);
@ -157,6 +178,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$cmd->execute(); $cmd->execute();
} }
/**
* @group Mongo
*/
public function testRemoveCommand() public function testRemoveCommand()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::INSERT, $this->collection);
@ -182,6 +206,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertEquals(0, $result->count()); $this->assertEquals(0, $result->count());
} }
/**
* @group Mongo
*/
public function testRemoveCommandNotAllParamsBinded() public function testRemoveCommandNotAllParamsBinded()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::REMOVE, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::REMOVE, $this->collection);
@ -189,6 +216,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$cmd->execute(); $cmd->execute();
} }
/**
* @group Mongo
*/
public function testCommandCommandNotAllParamsBinded() public function testCommandCommandNotAllParamsBinded()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, $this->collection); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, $this->collection);
@ -196,6 +226,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$cmd->execute(); $cmd->execute();
} }
/**
* @group Mongo
*/
public function testCommandCommandNotMongoDb() public function testCommandCommandNotMongoDb()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock()); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock());
@ -203,6 +236,9 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertFalse($cmd->execute()); $this->assertFalse($cmd->execute());
} }
/**
* @group Mongo
*/
public function testCommandCommand() public function testCommandCommand()
{ {
$col = new CollectionMock(); $col = new CollectionMock();
@ -216,12 +252,18 @@ class MongoDbCommandTest extends PHPUnit_Framework_TestCase
$this->assertTrue($cmd->execute()); $this->assertTrue($cmd->execute());
} }
/**
* @group Mongo
*/
public function testToStringParamsNotSet() public function testToStringParamsNotSet()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock()); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock());
$this->assertSame('Command properties not set', $cmd->__toString()); $this->assertSame('Command properties not set', $cmd->__toString());
} }
/**
* @group Mongo
*/
public function testToString() public function testToString()
{ {
$cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock()); $cmd = MongoCommandBuilder::factory(MongoCommandBuilder::COMMAND, new CollectionMock());

23
tests/model/MongoDriverTest.php

@ -72,6 +72,9 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
} }
} }
/**
* @group Mongo
*/
public function testGetConnectionNoHostname() public function testGetConnectionNoHostname()
{ {
unset($this->conf['hostname']); unset($this->conf['hostname']);
@ -79,6 +82,9 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
$mongo = new MongoDriver($this->conf); $mongo = new MongoDriver($this->conf);
} }
/**
* @group Mongo
*/
public function testGetConnectionWrongPassword() public function testGetConnectionWrongPassword()
{ {
$this->conf['password'] = 'nopass'; $this->conf['password'] = 'nopass';
@ -87,6 +93,9 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('MongoDB', $mongo->getConnection()); $this->assertInstanceOf('MongoDB', $mongo->getConnection());
} }
/**
* @group Mongo
*/
public function testGetConnection() public function testGetConnection()
{ {
$mongo = new MongoDriver($this->conf); $mongo = new MongoDriver($this->conf);
@ -101,6 +110,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFind() public function testFind()
{ {
@ -131,6 +141,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testOrderSkipLimit() public function testOrderSkipLimit()
{ {
@ -169,6 +180,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testCount() public function testCount()
{ {
@ -183,6 +195,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testGet() public function testGet()
{ {
@ -200,6 +213,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testRemove() public function testRemove()
{ {
@ -217,6 +231,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testInsert() public function testInsert()
{ {
@ -233,6 +248,10 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
$this->assertEquals(230, $mongo->get('items', array('name' => 'meat'))->fetch()->weight); $this->assertEquals(230, $mongo->get('items', array('name' => 'meat'))->fetch()->weight);
} }
/**
* @runInSeparateProcess
* @group Mongo
*/
public function testGetInsertId() public function testGetInsertId()
{ {
if (!defined('DEBUG')) { if (!defined('DEBUG')) {
@ -255,6 +274,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testUpdate() public function testUpdate()
{ {
@ -274,6 +294,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testUpsert() public function testUpsert()
{ {
@ -290,6 +311,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFindAndModify() public function testFindAndModify()
{ {
@ -307,6 +329,7 @@ class MongoDriverTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testCommand() public function testCommand()
{ {

9
tests/model/MongoModelTest.php

@ -50,6 +50,9 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
set_new_overload(array($this, 'newCallback')); set_new_overload(array($this, 'newCallback'));
} }
/**
* @group Mongo
*/
public function testModel() public function testModel()
{ {
$this->assertInstanceOf('MongoMockModel', $this->model); $this->assertInstanceOf('MongoMockModel', $this->model);
@ -57,6 +60,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFind() public function testFind()
{ {
@ -71,6 +75,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testGet() public function testGet()
{ {
@ -86,6 +91,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testDelete() public function testDelete()
{ {
@ -100,6 +106,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testDeleteAll() public function testDeleteAll()
{ {
@ -114,6 +121,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testCount() public function testCount()
{ {
@ -126,6 +134,7 @@ class MongoModelTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFetch() public function testFetch()
{ {

17
tests/model/MongoStatementTest.php

@ -57,6 +57,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testAffectedNumRowsNoResult() public function testAffectedNumRowsNoResult()
{ {
@ -77,6 +78,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testAffectedNumRows() public function testAffectedNumRows()
{ {
@ -94,6 +96,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testGetInsertId() public function testGetInsertId()
{ {
@ -124,6 +127,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testExecute() public function testExecute()
{ {
@ -137,6 +141,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testExecuteNoResult() public function testExecuteNoResult()
{ {
@ -154,6 +159,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testExecuteNoConnection() public function testExecuteNoConnection()
{ {
@ -170,6 +176,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testExecuteWithDebug() public function testExecuteWithDebug()
{ {
@ -183,6 +190,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testBindParam() public function testBindParam()
{ {
@ -205,6 +213,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFetch() public function testFetch()
{ {
@ -223,6 +232,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFetchWithInitialArray() public function testFetchWithInitialArray()
{ {
@ -243,6 +253,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFetchAssocFromCursor() public function testFetchAssocFromCursor()
{ {
@ -261,6 +272,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFetchAssocFromArray() public function testFetchAssocFromArray()
{ {
@ -282,6 +294,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testFetchWrongMode() public function testFetchWrongMode()
{ {
@ -303,6 +316,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testSkipOrderLimit() public function testSkipOrderLimit()
{ {
@ -322,6 +336,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testOrderException() public function testOrderException()
{ {
@ -341,6 +356,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testSkipException() public function testSkipException()
{ {
@ -360,6 +376,7 @@ class MongoStatementTest extends PHPUnit_Framework_TestCase
/** /**
* @runInSeparateProcess * @runInSeparateProcess
* @group Mongo
*/ */
public function testLimitException() public function testLimitException()
{ {

Loading…
Cancel
Save