Ejemplo n.º 1
0
 /**
  * @test
  */
 public function shouldCallObjectManagerPersistAndFlushOnUpdateModel()
 {
     $objectManagerMock = $this->createObjectManagerMock();
     $objectManagerMock->expects($this->once())->method('persist')->with($this->isInstanceOf('Payum\\Examples\\Model\\TestModel'));
     $objectManagerMock->expects($this->once())->method('flush');
     $storage = new DoctrineStorage($objectManagerMock, 'Payum\\Examples\\Model\\TestModel');
     $model = $storage->createModel();
     $storage->updateModel($model);
 }
 /**
  * @test
  */
 public function shouldFindModelByIdentificator()
 {
     $storage = new DoctrineStorage($this->dm, 'Payum\\Examples\\Document\\TestModel');
     $model = $storage->createModel();
     $storage->updateModel($model);
     $requestId = $model->getId();
     $this->dm->clear();
     $identificator = $storage->getIdentificator($model);
     $foundModel = $storage->findModelByIdentificator($identificator);
     $this->assertInstanceOf('Payum\\Examples\\Document\\TestModel', $foundModel);
     $this->assertEquals($requestId, $foundModel->getId());
 }