/** * @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); }
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))); }
/** * {@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); }
public function onPreSetData(TablePreSetDataEvent $event) { $this->session->store($event->getTable()->getType(), $event->getData(), $event->getOptions()); }