$this->categoryIndexer =
$this->
getContainer()->
get(CategoryIndexer::
class);
} public function testRefreshTree(): void
{ /*
Category A
├── Category B
├── Category C
│ └── Category D
*/
$categoryA =
$this->
createCategory();
$categoryB =
$this->
createCategory($categoryA);
$categoryC =
$this->
createCategory($categoryA);
$categoryD =
$this->
createCategory($categoryC);
$categories =
$this->categoryRepository->
search(new Criteria([$categoryA,
$categoryB,
$categoryC,
$categoryD]),
$this->context
);
static::
assertNull($categories->
get($categoryA)->
getPath());
static::
assertEquals("|{
$categoryA}|",
$categories->
get($categoryB)->
getPath());
static::
assertEquals("|{
$categoryA}|",
$categories->
get($categoryC)->
getPath());