public function setUp() { $this->eventRepository = $this->getMock(RepositoryInterface::class); $this->id = new String('test123'); $xml = new SizeLimitedEventXmlString(file_get_contents(__DIR__ . '/CommandHandler/ValidWithCdbid.xml')); $namespaceUri = new String('http://www.cultuurdatabank.com/XMLSchema/CdbXSD/3.3/FINAL'); $event = Event::createFromCdbXml($this->id, $xml, $namespaceUri); $cdbid = '004aea08-e13d-48c9-b9eb-a18f20e6d44e'; $this->eventRepository->expects($this->any())->method('load')->with($cdbid)->willReturn($event); $this->entryapiLinkBaseUrl = 'http://www.uitdatabank.be/api/v3/event/'; $this->controller = new EventController($this->eventRepository, $this->entryapiLinkBaseUrl); }
/** * @param AddEventFromCdbXml $addEventFromCdbXml * @throws UnexpectedNamespaceException * @throws UnexpectedRootElementException * @throws SchemaValidationException * @throws ElementNotFoundException * @throws SuspiciousContentException */ public function handleAddEventFromCdbXml(AddEventFromCdbXml $addEventFromCdbXml) { libxml_use_internal_errors(true); $xml = $addEventFromCdbXml->getXml(); $dom = $this->loadDOM($xml); $namespaceURI = $dom->documentElement->namespaceURI; $this->getEventElement($dom); $this->guardDescriptions($dom); $cdbXmlNamespaceUri = new String($namespaceURI); $event = Event::createFromCdbXml($addEventFromCdbXml->getEventId(), $xml, $cdbXmlNamespaceUri); $this->eventRepository->save($event); }
public function createFromCdbXml(StringLiteral $id, StringLiteral $cdbXml, StringLiteral $cdbXmlNamespaceUri) { return Event::importFromUDB2((string) $id, (string) $cdbXml, (string) $cdbXmlNamespaceUri); }