/** * @test */ public function get_name_should_return_class_name() { $class_ = new ClassForMetadata(); $metadata = new ClassMetadata(new \ReflectionClass($class_)); $this->assertEquals(get_class($class_), $metadata->getName()); }
public function merge(MetadataInterface $object) { if (!$object instanceof self) { throw new InvalidArgumentException('$object must be an instance of ClassMetadata.'); } parent::merge($object); $this->preSerializeMethods = array_merge($object->preSerializeMethods, $this->preSerializeMethods); $this->postSerializeMethods = array_merge($object->postSerializeMethods, $this->postSerializeMethods); $this->postDeserializeMethods = array_merge($object->postDeserializeMethods, $this->postDeserializeMethods); $this->xmlRootName = $this->xmlRootName ?: $object->xmlRootName; $this->xmlRootNamespace = $this->xmlRootNamespace ?: $object->xmlRootNamespace; $this->xmlNamespaces = array_merge($object->xmlNamespaces, $this->xmlNamespaces); // Handler methods are not inherited if (!$this->accessorOrder && $object->accessorOrder) { $this->accessorOrder = $object->accessorOrder; $this->customOrder = $object->customOrder; } if ($this->discriminatorFieldName && $object->discriminatorFieldName && $this->discriminatorFieldName !== $object->discriminatorFieldName) { throw new \LogicException(sprintf('The discriminator of class "%s" would overwrite the discriminator of the parent class "%s". Please define all possible sub-classes in the discriminator of %s.', $this->getName(), $object->discriminatorBaseClass, $object->discriminatorBaseClass)); } $this->mergeDiscriminatorMap($object); $this->sortProperties(); }