Пример #1
0
    /**
     * @test
     */
    public function shouldFinishWithFailed()
    {
        $factory = new OffsitePaymentFactory;

        $payment = $factory->create(array('type' => 'Dummy'));

        $date = new \DateTime('now + 2 year');

        $capture = new Capture(array(
            'amount' => '1000.00',
            'card' => array(
                'number' => '4111111111111111', //must be declined,
                'cvv' => 123,
                'expiryMonth' => 6,
                'expiryYear' => $date->format('y'),
                'firstName' => 'foo',
                'lastName' => 'bar',
            )
        ));

        $payment->execute($capture);

        $statusRequest = new GetHumanStatus($capture->getModel());
        $payment->execute($statusRequest);

        $this->assertTrue($statusRequest->isFailed());
    }
    /**
     * @test
     *
     * @expectedException \Payum\Core\Exception\LogicException
     * @expectedExceptionMessage Given type Invalid is not supported. Try one of supported types: Dummy.
     */
    public function shouldThrowIfTypeNotValid()
    {
        $factory = new OffsitePaymentFactory();

        $factory->create(array('type' => 'Invalid'));
    }