$this->repository =
$this->
getContainer()->
get('product_stream.repository'
);
$this->context = Context::
createDefaultContext();
} public function testCreateEntity(): void
{ $id = Uuid::
randomHex();
$this->repository->
upsert([['id' =>
$id, 'name' => 'Test stream'
]],
$this->context
);
/** @var ProductStreamEntity $entity */
$entity =
$this->repository->
search(new Criteria([$id]),
$this->context
)->
get($id);
static::
assertTrue($entity->
isInvalid());
static::
assertNull($entity->
getApiFilter());
static::
assertSame('Test stream',
$entity->
getName());
static::
assertSame($id,
$entity->
getId());
} public function testUpdateEntity(): void
{ $id = Uuid::
randomHex();
$this->repository->
upsert([['id' =>
$id, 'name' => 'Test stream'
]],
$this->context
);
$this->repository->
upsert([['id' =>
$id, 'name' => 'New Name'
]],
$this->context
);