/** * @test */ public function it_returns_the_correct_property_values() { $expectedId = 'someid'; $xml = new SizeLimitedEventXmlString(file_get_contents(__DIR__ . '/samples/Valid.xml')); $expectedXmlString = $xml; $updateEventFromCdbXml = new AddEventFromCdbXml(new String('someid'), $xml); $this->assertEquals($expectedId, $updateEventFromCdbXml->getEventId()); $this->assertEquals($expectedXmlString, $updateEventFromCdbXml->getXml()); }
/** * @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); }