Esempio n. 1
0
 /**
  * @test
  */
 public function shouldSubExecuteCreateChargeIfTokenSetButNotUsed()
 {
     $model = array('card' => 'notUsedToken');
     $gatewayMock = $this->createGatewayMock();
     $gatewayMock->expects($this->once())->method('execute')->with($this->isInstanceOf(CreateCharge::class));
     $action = new CaptureAction();
     $action->setGateway($gatewayMock);
     $action->execute(new Capture($model));
 }
    /**
     * @test
     */
    public function shouldSubExecuteCreateChargeIfTokenSetButNotUsed()
    {
        $model = array(
            'card' => 'notUsedToken',
        );

        $paymentMock = $this->createPaymentMock();
        $paymentMock
            ->expects($this->once())
            ->method('execute')
            ->with($this->isInstanceOf('Payum\Stripe\Request\Api\CreateCharge'))
        ;

        $action = new CaptureAction();
        $action->setPayment($paymentMock);

        $action->execute(new Capture($model));
    }
Esempio n. 3
0
 /**
  * @test
  */
 public function shouldNotSubExecuteCreateChargeIfCustomerSetButAlreadyCharged()
 {
     $model = ['customer' => 'theCustomerId', 'status' => Constants::STATUS_SUCCEEDED];
     $gatewayMock = $this->createGatewayMock();
     $gatewayMock->expects($this->never())->method('execute');
     $action = new CaptureAction();
     $action->setGateway($gatewayMock);
     $action->execute(new Capture($model));
 }