$manyToOneField =
$fieldCollection->
get('manyToOne'
);
static::
assertInstanceOf(OneToManyAssociationField::
class,
$oneToManyField);
static::
assertInstanceOf(ManyToOneAssociationField::
class,
$manyToOneField);
$event =
new PreWriteValidationEvent(WriteContext::
createFromContext(Context::
createDefaultContext()),
[ new DeleteCommand($oneToManyField->
getReferenceDefinition(),
[],
$this->
createMock(EntityExistence::
class)),
new UpdateCommand($manyToOneField->
getReferenceDefinition(),
[],
[],
$this->
createMock(EntityExistence::
class), ''
),
new UpdateCommand($oneToManyField->
getReferenceDefinition(),
['rule_id' => 'foo'
],
[],
$this->
createMock(EntityExistence::
class), ''
),
]);
$this->areaUpdater->
triggerChangeSet($event);
/** @var DeleteCommand[]|UpdateCommand[] $commands */
$commands =
$event->
getCommands();
static::
assertCount(3,
$commands);
static::
assertTrue($commands[0
]->
requiresChangeSet());
static::
assertFalse($commands[1
]->
requiresChangeSet());
static::
assertTrue($commands[2
]->
requiresChangeSet());
} public function testOnEntityWritten(): void
{