public function setUp() { parent::setUp(); $this->session = $this->prophesize('PHPCR\\SessionInterface'); $this->workspace = $this->prophesize('PHPCR\\WorkspaceInterface'); $this->nsRegistry = $this->prophesize('PHPCR\\NamespaceRegistryInterface'); $this->ntManager = $this->prophesize('PHPCR\\NodeType\\NodeTypeManagerInterface'); $this->ntTemplate = $this->prophesize('PHPCR\\NodeType\\NodeTypeTemplateInterface'); $this->ndTemplate = $this->prophesize('PHPCR\\NodeType\\NodeDefinitionTemplateInterface'); $this->pdTemplate = $this->prophesize('PHPCR\\NodeType\\PropertyDefinitionTemplateInterface'); $this->ndTemplates = new \ArrayObject(); $this->pdTemplates = new \ArrayObject(); $this->parser = new YAMLDeserializer($this->session->reveal()); $this->session->getWorkspace()->willReturn($this->workspace); $this->workspace->getNamespaceRegistry()->willReturn($this->nsRegistry); $this->workspace->getNodeTypeManager()->willReturn($this->ntManager); // setup $this->ntManager->createNodeTypeTemplate()->willReturn($this->ntTemplate); $this->ntManager->createNodeDefinitionTemplate()->willReturn($this->ndTemplate); $this->ntManager->createPropertyDefinitionTemplate()->willReturn($this->pdTemplate); $this->ntTemplate->getNodeDefinitionTemplates()->willReturn($this->ndTemplates); $this->ntTemplate->getPropertyDefinitionTemplates()->willReturn($this->pdTemplates); }
public function setUp() { parent::setUp(); $this->serializer = new YAMLSerializer(); $this->nodeType = $this->prophesize('PHPCR\\NodeType\\NodeTypeInterface'); $this->nodeDefinition = $this->prophesize('PHPCR\\NodeType\\NodeDefinitionInterface'); $this->propertyDefinition = $this->prophesize('PHPCR\\NodeType\\PropertyDefinitionInterface'); $this->nodeType->getName()->willReturn('test:article'); $this->nodeType->isAbstract()->willReturn(true); $this->nodeType->isMixin()->willReturn(true); $this->nodeType->hasOrderableChildNodes()->willReturn(true); $this->nodeType->getPrimaryItemName()->willReturn('comment'); $this->nodeType->isQueryable()->willReturn(true); $this->nodeType->getDeclaredSupertypeNames()->willReturn(array('nt:unstructured')); $this->propertyDefinition->getName()->willReturn('test:title'); $this->propertyDefinition->isAutoCreated()->willReturn(true); $this->propertyDefinition->isMandatory()->willReturn(true); $this->propertyDefinition->getOnParentVersion()->willReturn(1); $this->propertyDefinition->isProtected()->willReturn(true); $this->propertyDefinition->getRequiredType()->willReturn('STRING'); $this->propertyDefinition->getValueConstraints()->willReturn('.*'); $this->propertyDefinition->getDefaultValues()->willReturn(array('default_value')); $this->propertyDefinition->isMultiple()->willReturn(true); $this->propertyDefinition->getAvailableQueryOperators()->willReturn(array()); $this->propertyDefinition->isFullTextSearchable()->willReturn(true); $this->propertyDefinition->isQueryOrderable()->willReturn(true); $this->nodeDefinition->getName()->willReturn('test:comment'); $this->nodeDefinition->isAutoCreated()->willReturn(true); $this->nodeDefinition->isMandatory()->willReturn(true); $this->nodeDefinition->getOnParentVersion()->willReturn(1); $this->nodeDefinition->isProtected()->willReturn(true); $this->nodeDefinition->getRequiredPrimaryTypeNames()->willReturn(array('nt:unstructured', 'nt:base')); $this->nodeDefinition->getDefaultPrimaryTypeName()->willReturn('nt:unstructured'); $this->nodeDefinition->allowsSameNameSiblings()->willReturn(false); $this->nodeType->getDeclaredPropertyDefinitions()->willReturn(array($this->propertyDefinition)); $this->nodeType->getDeclaredChildNodeDefinitions()->willReturn(array($this->nodeDefinition)); }