actionTemplateDataStoreService = new ActionTemplateDataStoreService(); } public function testNotValidChoiceSetException(): void { $this->expectException(NoValidChoiceException::class); $this->actionTemplateDataStoreService->setData('1231232N', ' '); } public function testNotCorrectInstanceSetException(): void { $this->expectException(NotCorrectInstanceException::class); $data = new class() { }; $this->actionTemplateDataStoreService->setData(ActionType::READ, $data); } public function testNotValidChoiceGetException(): void { $this->expectException(NoValidChoiceException::class); $this->actionTemplateDataStoreService->getData('1231232N'); } public function testNotSetGetException(): void { $this->expectException(NotSetException::class); $this->actionTemplateDataStoreService->getData(ActionType::READ); } public function testAccessors(): void { foreach (ActionType::getValues() as $actionType) { $instance = ActionTemplateDataStoreService::ACTION_DATA_MAPPING[$actionType]; $data = $this->createMock($instance); $this->assertFalse($this->actionTemplateDataStoreService->isDataStored($actionType)); $this->assertNull($this->actionTemplateDataStoreService->setData($actionType, $data)); $this->assertTrue($this->actionTemplateDataStoreService->isDataStored($actionType)); $this->assertEquals($data, $this->actionTemplateDataStoreService->getData($actionType)); } $this->expectException(AllreadySetException::class); $this->assertNull($this->actionTemplateDataStoreService->setData($actionType, $data)); } }