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); }
/** * Reads the node type definition from an xml element * * @param DOMElement $node The dom element to read information from */ protected function fromXml(DOMElement $node) { $nodeTypeXmlConverter = new NodeTypeXmlConverter($this->factory); $this->fromArray($nodeTypeXmlConverter->getNodeTypeDefinitionFromXml($node)); }
/** * 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; }
/** * {@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); }