public function testLoadCouponCode()
 {
     $this->coupon->expects($this->once())->method('loadPrimaryByRule')->with(1);
     $this->coupon->expects($this->once())->method('setRule')->with($this->model)->willReturnSelf();
     $this->coupon->expects($this->once())->method('setIsPrimary')->with(true)->willReturnSelf();
     $this->coupon->expects($this->once())->method('getCode')->willReturn('test_code');
     $this->coupon->expects($this->once())->method('getUsageLimit')->willReturn(1);
     $this->model->setId(1);
     $this->model->setUsesPerCoupon(null);
     $this->model->setUseAutoGeneration(false);
     $this->model->loadCouponCode();
     $this->assertEquals(1, $this->model->getUsesPerCoupon());
 }
 /**
  * {@inheritdoc}
  */
 public function loadCouponCode()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'loadCouponCode');
     if (!$pluginInfo) {
         return parent::loadCouponCode();
     } else {
         return $this->___callPlugins('loadCouponCode', func_get_args(), $pluginInfo);
     }
 }