6 declare(strict_types=1);
11 use Magento\SalesRule\Api\Data\CouponGenerationSpecInterfaceFactory;
25 private $couponGenerator;
30 private $couponManagementServiceMock;
35 private $generationSpecFactoryMock;
40 private $generationSpecMock;
49 $this->generationSpecFactoryMock = $this->getMockBuilder(CouponGenerationSpecInterfaceFactory::class)
50 ->disableOriginalConstructor()->setMethods([
'create'])->getMock();
51 $this->couponManagementServiceMock = $this->createMock(CouponManagementService::class);
52 $this->generationSpecMock = $this->createMock(CouponGenerationSpecInterface::class);
54 $this->couponManagementServiceMock,
55 $this->generationSpecFactoryMock
67 $this->generationSpecFactoryMock->expects($this->once())->method(
'create')
68 ->willReturn($this->generationSpecMock);
69 $this->couponManagementServiceMock->expects($this->once())->method(
'generate')
70 ->with($this->generationSpecMock)->willReturn($expected);
71 $actual = $this->couponGenerator->generateCodes([]);
72 self::assertEquals($expected, $actual);