$this->ruleRepository =
$this->
getContainer()->
get('rule.repository'
);
$this->conditionRepository =
$this->
getContainer()->
get('rule_condition.repository'
);
$this->context = Context::
createDefaultContext();
} public function testValidateWithInvalidRulesType(): void
{ try { $this->conditionRepository->
create([ [ 'type'
=> (new MatchAllLineItemsRule())->
getName(),
'ruleId' => Uuid::
randomHex(),
'value' =>
[ 'rules' =>
['Rule'
],
],
],
],
$this->context
);
static::
fail('Exception was not thrown'
);
} catch (WriteException
$stackException) { $exceptions =
iterator_to_array($stackException->
getErrors());
static::
assertCount(1,
$exceptions);
static::
assertSame('/0/value/rules',
$exceptions[0
]['source'
]['pointer'
]);