private MockObject&EventDispatcherInterface
$dispatcher;
protected function setUp(): void
{ $this->repository =
$this->
createMock(EntityRepository::
class);
$this->dispatcher =
$this->
createMock(EventDispatcherInterface::
class);
$this->storer =
new ProductStorer($this->repository,
$this->dispatcher
);
} public function testStoreWithAware(): void
{ $event =
new ReviewFormEvent(Context::
createDefaultContext(), '',
new MailRecipientStruct([]),
new DataBag(), '', ''
);
$stored =
[];
$stored =
$this->storer->
store($event,
$stored);
static::
assertArrayHasKey(ProductAware::PRODUCT_ID,
$stored);
} public function testStoreWithNotAware(): void
{ $event =
$this->
createMock(CustomerRegisterEvent::
class);
$stored =
[];
$stored =
$this->storer->
store($event,
$stored);
static::
assertArrayNotHasKey(ProductAware::PRODUCT_ID,
$stored);
}