Пример #1
0
 /**
  * Expect a {@link Association} annotation to map correctly.
  *
  * @test
  */
 public function validateAssociationAnnotationMapsCorrectly()
 {
     $annotations = new ArrayCollection();
     $field = new Field();
     $annotations->add($field);
     $association = new Association();
     $association->target = static::class;
     $annotations->add($association);
     $mapping = $this->parser->processFieldAnnotationsForResourceMapping(new ResourceMapping(), $this->property, $annotations);
     $this->assertNull($mapping->getPrimary(), 'There no @Field marked with the primary flag');
     $this->assertCount(0, $mapping->getFields(), 'There was a single @Field annotation given but it accompanies @Association');
     $this->assertCount(1, $mapping->getAssociations(), 'There was a single @association annotation given');
     $associations = $mapping->getAssociations();
     $this->assertEquals($association->target, $associations[0]->getAssociation()->target);
 }