/**
  * @test
  */
 public function shouldAddPayumActionTagNotifyAction()
 {
     $factory = new KlarnaCheckoutPaymentFactory();
     $container = new ContainerBuilder();
     $factory->create($container, 'aContextName', array('obtain_credit_card' => false, 'secret' => 'aSecret', 'merchant_id' => 'aMerchantId', 'sandbox' => true, 'actions' => array(), 'apis' => array(), 'extensions' => array()));
     $actionDefinition = $container->getDefinition('payum.klarna.checkout.action.notify');
     $tagAttributes = $actionDefinition->getTag('payum.action');
     $this->assertCount(1, $tagAttributes);
     $this->assertEquals($factory->getName(), $tagAttributes[0]['factory']);
 }
    /**
     * @test
     */
    public function shouldCallParentsCreateMethod()
    {
        $factory = new KlarnaCheckoutPaymentFactory;

        $container = new ContainerBuilder;

        $paymentId = $factory->create($container, 'aPaymentName', array(
            'secret' => 'aSecret',
            'merchant_id' => 'aMerchantId',
            'sandbox' => true,
            'actions' => array('payum.action.foo'),
            'apis' => array('payum.api.bar'),
            'extensions' => array('payum.extension.ololo'),
        ));

        $this->assertDefinitionContainsMethodCall(
            $container->getDefinition($paymentId), 
            'addAction', 
            new Reference('payum.action.foo')
        );
        $this->assertDefinitionContainsMethodCall(
            $container->getDefinition($paymentId),
            'addApi',
            new Reference('payum.api.bar')
        );
        $this->assertDefinitionContainsMethodCall(
            $container->getDefinition($paymentId),
            'addExtension',
            new Reference('payum.extension.ololo')
        );
    }