コード例 #1
0
ファイル: TestCase.php プロジェクト: ruflin/jackalope
 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
 /**
  * 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));
 }
コード例 #3
0
ファイル: TestCase.php プロジェクト: nikophil/cmf-tests
 /**
  * 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;
 }
コード例 #4
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);
 }