$criteria =
new Criteria([$this->rule
[0
]['shippingMethods'
][0
]['id'
]]);
$criteria->
addAssociation('availabilityRule'
);
$searchResult =
$this->
getContainer()->
get('shipping_method.repository'
)->
search($criteria,
$defaultContext);
static::
assertSame($this->ruleId,
$searchResult->
first()->
getAvailabilityRule()->
getId());
} public function testRuleAssociationsStayLikeLinked(): void
{ $defaultContext = Context::
createDefaultContext();
$rules =
$this->
createComplicatedTestData();
$this->ruleRepository->
create($rules,
$defaultContext);
$criteria1 =
new Criteria(['id' =>
$this->ruleId
]);
$criteria1->
addAssociation('shippingMethods'
);
$criteria2 =
new Criteria(['id' =>
$rules[1
]['id'
]]);
$criteria2->
addAssociation('shippingMethods'
);
$rule1 =
$this->ruleRepository->
search($criteria1,
$defaultContext);
$rule2 =
$this->ruleRepository->
search($criteria2,
$defaultContext);