Slide 12
Slide 12 text
© 2012-2025 BASE, Inc.
unittestの対象クラス
12
/**
* 新機能利用可能ショップの判定を行うサービスクラス
*/
class DecideNewFeatureAvailableShopService
{
public function __construct(
private ShopRepositoryInterface $shopRepository,
private NewFeatureAvailableShopRepositoryInterface $newFeatureAvailableShopRepository,
) {
}
/**
* 指定されたユーザーIDと機能名で、機能利用可能か判定する
*/
public function handle(UserId $userId, NewFeatureAvailableShop $featureName): bool
{
$shop = $this->shopRepository->findOrFail($userId->toInt());
return $this->newFeatureAvailableShopRepository->haveShop($shop->getShopId()->toString(), $featureName->value);
}
}