|
@@ 80-117 (lines=38) @@
|
| 77 |
|
return $expected; |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public static function createObjectNormalizerClassMetadata() |
| 81 |
|
{ |
| 82 |
|
$expected = new ClassMetadata('RonteLtd\JsonApiBundle\Tests\Fixtures\ObjectNormalizerDummy'); |
| 83 |
|
|
| 84 |
|
$objectNormalizer = new ObjectNormalizer(); |
| 85 |
|
$objectNormalizer->setName("jsonApiEntityType"); |
| 86 |
|
$objectNormalizer->setMeta([ |
| 87 |
|
'copyright' => 'copyright', |
| 88 |
|
'authors' => ['a'] |
| 89 |
|
]); |
| 90 |
|
|
| 91 |
|
$expected->addClassAnnotation($objectNormalizer); |
| 92 |
|
|
| 93 |
|
$nameAttributeAnnotation = new Attribute(); |
| 94 |
|
$nameAttributeAnnotation->setName("name"); |
| 95 |
|
|
| 96 |
|
$name = new AttributeMetadata('name'); |
| 97 |
|
$name->setAttribute($nameAttributeAnnotation); |
| 98 |
|
$expected->addAttributeMetadata($name); |
| 99 |
|
|
| 100 |
|
$enabledAnnotation = new Attribute(); |
| 101 |
|
$enabledAnnotation->setName('isEnabled'); |
| 102 |
|
|
| 103 |
|
$enabled = new AttributeMetadata('enabled'); |
| 104 |
|
$enabled->setAttribute($enabledAnnotation); |
| 105 |
|
$expected->addAttributeMetadata($enabled); |
| 106 |
|
|
| 107 |
|
$categoryRelationshipAnnotation = new Relationship(); |
| 108 |
|
|
| 109 |
|
$category = new AttributeMetadata('category'); |
| 110 |
|
$category->setRelationship($categoryRelationshipAnnotation); |
| 111 |
|
$expected->addAttributeMetadata($category); |
| 112 |
|
|
| 113 |
|
// load reflection class so that the comparison passes |
| 114 |
|
$expected->getReflectionClass(); |
| 115 |
|
|
| 116 |
|
return $expected; |
| 117 |
|
} |
| 118 |
|
|
| 119 |
|
public static function createMergedClassMetadata() |
| 120 |
|
{ |
|
@@ 119-156 (lines=38) @@
|
| 116 |
|
return $expected; |
| 117 |
|
} |
| 118 |
|
|
| 119 |
|
public static function createMergedClassMetadata() |
| 120 |
|
{ |
| 121 |
|
$expected = self::createAttributeClassMetadata(); |
| 122 |
|
|
| 123 |
|
$objectNormalizer = new ObjectNormalizer(); |
| 124 |
|
$objectNormalizer->setName("jsonApiEntityType"); |
| 125 |
|
$objectNormalizer->setMeta([ |
| 126 |
|
'copyright' => 'copyright', |
| 127 |
|
'authors' => ['a'] |
| 128 |
|
]); |
| 129 |
|
|
| 130 |
|
$expected->addClassAnnotation($objectNormalizer); |
| 131 |
|
|
| 132 |
|
$nameAttributeAnnotation = new Attribute(); |
| 133 |
|
$nameAttributeAnnotation->setName("name"); |
| 134 |
|
|
| 135 |
|
$name = new AttributeMetadata('name'); |
| 136 |
|
$name->setAttribute($nameAttributeAnnotation); |
| 137 |
|
$expected->addAttributeMetadata($name); |
| 138 |
|
|
| 139 |
|
$enabledAnnotation = new Attribute(); |
| 140 |
|
$enabledAnnotation->setName('isEnabled'); |
| 141 |
|
|
| 142 |
|
$enabled = new AttributeMetadata('enabled'); |
| 143 |
|
$enabled->setAttribute($enabledAnnotation); |
| 144 |
|
$expected->addAttributeMetadata($enabled); |
| 145 |
|
|
| 146 |
|
$categoryRelationshipAnnotation = new Relationship(); |
| 147 |
|
|
| 148 |
|
$category = new AttributeMetadata('category'); |
| 149 |
|
$category->setRelationship($categoryRelationshipAnnotation); |
| 150 |
|
$expected->addAttributeMetadata($category); |
| 151 |
|
|
| 152 |
|
// load reflection class so that the comparison passes |
| 153 |
|
$expected->getReflectionClass(); |
| 154 |
|
|
| 155 |
|
return $expected; |
| 156 |
|
} |
| 157 |
|
} |