예제 #1
0
 /**
  * @expectedException \RuntimeException
  */
 public function testStoreException()
 {
     $type = $this->getMock('EMC\\TableBundle\\Table\\Type\\TableTypeInterface');
     $data = array(array(1), array(2));
     $options = array('x' => 3, 'y' => 'z');
     $this->tableSession->store($type, $data, $options);
 }
예제 #2
0
 protected function setUp()
 {
     $this->entityManagerMock = $this->getMock('Doctrine\\Common\\Persistence\\ObjectManager');
     $this->eventDispatcherMock = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->tableSessionMock = $this->getMock('EMC\\TableBundle\\Session\\TableSessionInterface');
     $this->columnFactoryMock = $this->getMock('EMC\\TableBundle\\Table\\Column\\ColumnFactoryInterface');
     $this->exportRegistryMock = $this->getMock('EMC\\TableBundle\\Table\\Export\\ExportRegistryInterface');
     $this->factory = new TableFactory($this->entityManagerMock, $this->eventDispatcherMock, $this->tableSessionMock, $this->columnFactoryMock, $this->exportRegistryMock, $this->defaultOptions, $this->defaultColumnOptions);
     $this->fooType = new Type\FooType();
     $this->tableSessionMock->expects($this->any())->method('restore')->with($this->fooType->getId())->will($this->returnValue(array('class' => get_class($this->fooType), 'options' => array(), 'data' => null)));
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function restore($tableId, array $params = array(), $mode = self::MODE_NORMAL)
 {
     $config = $this->tableSession->restore($tableId);
     return $this->load($config['class'], $config['data'], $config['options'], $params, $mode);
 }
예제 #4
0
 public function onPreSetData(TablePreSetDataEvent $event)
 {
     $this->session->store($event->getTable()->getType(), $event->getData(), $event->getOptions());
 }