/** * @test */ public function convertFromDecodesJsonEncodedArraysAsAssociative() { $contextPath = '/foo/bar@user-demo'; $nodePath = '/foo/bar'; $nodeTypeProperties = array('quux' => array('type' => 'array')); $decodedPropertyValue = array('foo' => 'bar'); $source = array('__contextNodePath' => $contextPath, 'quux' => json_encode($decodedPropertyValue)); $mockNode = $this->setUpNodeWithNodeType($nodePath, $nodeTypeProperties); $mockNode->expects($this->once())->method('setProperty')->with('quux', $decodedPropertyValue); $this->nodeConverter->convertFrom($source, null, array(), $this->mockConverterConfiguration); }
/** * Helper which calls the NodeConverter; with some error-handling built in * * @param $nodePath * @return NodeInterface */ protected function convert($nodePath, PropertyMappingConfiguration $propertyMappingConfiguration = null) { $nodeConverter = new NodeConverter(); $result = $nodeConverter->convertFrom($nodePath, null, array(), $propertyMappingConfiguration); if ($result instanceof Error) { $this->fail('Failed with error: ' . $result->getMessage()); } return $result; }