getNodeTypesFromXml() публичный Метод

public getNodeTypesFromXml ( DOMDocument $dom )
$dom DOMDocument
Пример #1
0
 protected function getNodeTypeManager()
 {
     $factory = new Factory();
     $dom = new \DOMDocument();
     $dom->load(__DIR__ . '/../fixtures/nodetypes.xml');
     $converter = new NodeTypeXmlConverter($factory);
     $om = $this->getObjectManagerMock();
     $om->expects($this->any())->method('getNodeTypes')->will($this->returnValue($converter->getNodeTypesFromXml($dom)));
     return new NodeTypeManager($factory, $om);
 }
Пример #2
0
 /**
  * Get the (real) node type manager with a mock object manager that returns
  * real node type data for getNodeTypes.
  *
  * @return NodeTypeManager
  */
 protected function getNodeTypeManager()
 {
     $factory = new Factory();
     $dom = new \DOMDocument();
     $dom->load(__DIR__ . '/../fixtures/nodetypes.xml');
     $converter = new NodeTypeXmlConverter($factory);
     $om = $this->getObjectManagerMock();
     $om->expects($this->any())->method('getNodeTypes')->will($this->returnValue($converter->getNodeTypesFromXml($dom)));
     $ns = $this->getMockBuilder('Jackalope\\NamespaceRegistry')->disableOriginalConstructor()->getMock();
     $ntm = new NodeTypeManager($factory, $om, $ns);
     // we need to initialize as getting a single node type calls a different method on the om.
     $ntm->getAllNodeTypes();
     return $ntm;
 }
Пример #3
0
 /**
  * {@inheritDoc}
  */
 public function getNodeTypes($nodeTypes = array())
 {
     $request = $this->getRequest(Request::REPORT, $this->workspaceUriRoot);
     $request->setBody($this->buildNodeTypesRequest($nodeTypes));
     $dom = $request->executeDom();
     if ($dom->firstChild->localName != 'nodeTypes') {
         throw new RepositoryException('Error talking to the backend. ' . $dom->saveXML());
     }
     if ($this->typeXmlConverter === null) {
         $this->typeXmlConverter = $this->factory->get('NodeType\\NodeTypeXmlConverter');
     }
     return $this->typeXmlConverter->getNodeTypesFromXml($dom);
 }