예제 #1
0
 public function testIfWillSetUpdateScenarioOnFoundObject()
 {
     $model = new DocumentBaseAttributes();
     $model->save();
     $found = $model->findByPk($model->_id);
     $this->assertSame(ScenarioManager::getScenario($found), ScenariosInterface::Update);
 }
예제 #2
0
 public function testIfWillFindActiveDocumentByPk()
 {
     $model = new DocumentBaseAttributes();
     $model->_id = new MongoId();
     $model->string = 'foo';
     $model->insert();
     $found = $model->findByPk($model->_id);
     $this->assertNotNull($found);
     $this->assertTrue($found instanceof DocumentBaseAttributes);
     $this->assertSame($model->string, $found->string);
 }