public function setUp() { parent::setUp(); $this->_bob = My_ShantyMongo_User::find('4c04516a1f5f5e21361e3ab0'); $this->_cherry = My_ShantyMongo_User::find('4c04516f1f5f5e21361e3ab1'); $this->_roger = My_ShantyMongo_User::find('4c0451791f5f5e21361e3ab2'); $this->_articleRegular = My_ShantyMongo_Article::find('4c04516f1f5f5e21361e3ac1'); $this->_articleBroken = My_ShantyMongo_Article::find('4c04516f1f5f5e21361e3ac2'); }
/** * @depends testFind */ public function testRemove() { My_ShantyMongo_User::remove(array('name.first' => 'Bob'), array('safe' => true)); $bob = My_ShantyMongo_User::find('4c04516a1f5f5e21361e3ab0'); $this->assertNull($bob); $users = My_ShantyMongo_User::all(); $this->assertEquals(2, $users->count()); }
public function setUp() { parent::setUp(); $this->_document = My_ShantyMongo_User::find('4c04516a1f5f5e21361e3ab0'); $this->_iterator = $this->_document->getIterator(); }
public function testGetPropertyNewDocument() { $address = $this->_bob->addresses->new(); $address->street = '45 Burrow St'; $address->suburb = 'The Shire'; $address->state = 'Middle Earth'; $address->postcode = '21342'; $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_OBJECT, $address); $this->assertEquals('Shanty_Mongo_Document', get_class($address)); $this->assertTrue($address->isNewDocument()); $this->assertFalse($address->hasId()); $this->assertTrue($address->getConfigAttribute('parentIsDocumentSet')); $this->assertEquals('default', $address->getConfigAttribute('connectionGroup')); $this->assertEquals(TESTS_SHANTY_MONGO_DB, $address->getConfigAttribute('db')); $this->assertEquals('user', $address->getConfigAttribute('collection')); $this->assertEquals('addresses', $address->getPathToDocument()); $criteria = $address->getCriteria(); $this->assertTrue(isset($criteria['_id'])); $this->assertEquals('4c04516a1f5f5e21361e3ab0', $criteria['_id']->__toString()); $address->save(); $bob = My_ShantyMongo_User::find('4c04516a1f5f5e21361e3ab0'); $this->assertEquals(3, count($bob->addresses)); $this->assertEquals('45 Burrow St', $bob->addresses[2]->street); }