Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing container in controllers #509

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DependencyInjection/PayumExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function load(array $configs, ContainerBuilder $container)
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('payum.xml');
$loader->load('commands.xml');
$loader->load('controller.xml');
$loader->load('form.xml');

if ($container->getParameter('kernel.debug')) {
Expand Down
50 changes: 50 additions & 0 deletions Resources/config/controller.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="Payum\Bundle\PayumBundle\Controller\AuthorizeController" class="Payum\Bundle\PayumBundle\Controller\AuthorizeController" public="true">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>

<service id="Payum\Bundle\PayumBundle\Controller\CancelController" class="Payum\Bundle\PayumBundle\Controller\CancelController" public="true">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>

<service id="Payum\Bundle\PayumBundle\Controller\CaptureController" class="Payum\Bundle\PayumBundle\Controller\CaptureController" public="true">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>

<service id="Payum\Bundle\PayumBundle\Controller\NotifyController" class="Payum\Bundle\PayumBundle\Controller\NotifyController" public="true">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>

<service id="Payum\Bundle\PayumBundle\Controller\PayoutController" class="Payum\Bundle\PayumBundle\Controller\PayoutController" public="true">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>

<service id="Payum\Bundle\PayumBundle\Controller\RefundController" class="Payum\Bundle\PayumBundle\Controller\RefundController" public="true">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>

<service id="Payum\Bundle\PayumBundle\Controller\SyncController" class="Payum\Bundle\PayumBundle\Controller\SyncController" public="true">
<call method="setContainer">
<argument type="service" id="service_container" />
</call>
</service>
</services>
</container>
20 changes: 20 additions & 0 deletions Tests/Functional/Controller/AuthorizeControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Payum\Bundle\PayumBundle\Tests\Functional\Controller;

use Payum\Bundle\PayumBundle\Tests\Functional\WebTestCase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class AuthorizeControllerTest extends WebTestCase
{
/**
* @ticket 507
*/
public function testCanBeAccessed()
{
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('A token with hash `payum_token` could not be found.');

$this->client->request('GET', '/payment/authorize/payum_token');
}
}
20 changes: 20 additions & 0 deletions Tests/Functional/Controller/CancelControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Payum\Bundle\PayumBundle\Tests\Functional\Controller;

use Payum\Bundle\PayumBundle\Tests\Functional\WebTestCase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class CancelControllerTest extends WebTestCase
{
/**
* @ticket 507
*/
public function testCanBeAccessed()
{
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('A token with hash `payum_token` could not be found.');

$this->client->request('GET', '/payment/cancel/payum_token');
}
}
20 changes: 20 additions & 0 deletions Tests/Functional/Controller/CaptureControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Payum\Bundle\PayumBundle\Tests\Functional\Controller;

use Payum\Bundle\PayumBundle\Tests\Functional\WebTestCase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class CaptureControllerTest extends WebTestCase
{
/**
* @ticket 507
*/
public function testCanBeAccessed()
{
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('A token with hash `payum_token` could not be found.');

$this->client->request('GET', '/payment/capture/payum_token');
}
}
20 changes: 20 additions & 0 deletions Tests/Functional/Controller/NotifyControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Payum\Bundle\PayumBundle\Tests\Functional\Controller;

use Payum\Bundle\PayumBundle\Tests\Functional\WebTestCase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class NotifyControllerTest extends WebTestCase
{
/**
* @ticket 507
*/
public function testCanBeAccessed()
{
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('A token with hash `payum_token` could not be found.');

$this->client->request('GET', '/payment/notify/payum_token');
}
}
20 changes: 20 additions & 0 deletions Tests/Functional/Controller/PayoutControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Payum\Bundle\PayumBundle\Tests\Functional\Controller;

use Payum\Bundle\PayumBundle\Tests\Functional\WebTestCase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class PayoutControllerTest extends WebTestCase
{
/**
* @ticket 507
*/
public function testCanBeAccessed()
{
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('A token with hash `payum_token` could not be found.');

$this->client->request('GET', '/payment/payout/payum_token');
}
}
20 changes: 20 additions & 0 deletions Tests/Functional/Controller/RefundControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Payum\Bundle\PayumBundle\Tests\Functional\Controller;

use Payum\Bundle\PayumBundle\Tests\Functional\WebTestCase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class RefundControllerTest extends WebTestCase
{
/**
* @ticket 507
*/
public function testCanBeAccessed()
{
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('A token with hash `payum_token` could not be found.');

$this->client->request('GET', '/payment/refund/payum_token');
}
}
20 changes: 20 additions & 0 deletions Tests/Functional/Controller/SyncControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Payum\Bundle\PayumBundle\Tests\Functional\Controller;

use Payum\Bundle\PayumBundle\Tests\Functional\WebTestCase;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class SyncControllerTest extends WebTestCase
{
/**
* @ticket 507
*/
public function testCanBeAccessed()
{
$this->expectException(NotFoundHttpException::class);
$this->expectExceptionMessage('A token with hash `payum_token` could not be found.');

$this->client->request('GET', '/payment/sync/payum_token');
}
}
4 changes: 2 additions & 2 deletions Tests/Functional/WebTestCase.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
namespace Payum\Bundle\PayumBundle\Tests\Functional;

use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;

abstract class WebTestCase extends BaseWebTestCase
{
/**
* @var Client
* @var KernelBrowser
*/
protected $client;

Expand Down