$this->
addEventListener( $this->
getContainer()->
get('event_dispatcher'
),
PreWriteValidationEvent::
class,
function DPreWriteValidationEvent
$event) use (&
$called): void
{ // we also get a validation event for the version tables
if (!
$event->
getPrimaryKeys('product'
)) { return;
} $called = true;
// some validators depend on that to disable insert/update validation for merge requests
static::
assertTrue($event->
getWriteContext()->
hasState(VersionManager::MERGE_SCOPE
));
} );
$this->
getContainer()->
get('product.repository'
)->
merge($versionId,
$context);
static::
assertTrue($called);
} public function testWhenNotAddingFKThenItShouldNotBeAvailable(): void
{ $product =
(new ProductBuilder($this->ids, self::PRODUCT_ID
))->
stock(1
)