- PHPMentors\ProxyURLRewriteBundle\Templating\ProxyAssetExtension
PHPMentors\ProxyURLRewriteBundle\Asset\ProxyPackages
PHPMentors\ProxyURLRewriteBundle\ProxyUrl\ProxyUrl
PHPMentors\ProxyURLRewriteBundle\ProxyUrl\ProxyUrlCollection
@@ -15,7 +14,6 @@
-
diff --git a/src/Templating/ProxyAssetExtension.php b/src/Templating/ProxyAssetExtension.php
deleted file mode 100644
index b093265..0000000
--- a/src/Templating/ProxyAssetExtension.php
+++ /dev/null
@@ -1,29 +0,0 @@
-,
- * All rights reserved.
- *
- * This file is part of PHPMentorsProxyURLRewriteBundle.
- *
- * This program and the accompanying materials are made available under
- * the terms of the BSD 2-Clause License which accompanies this
- * distribution, and is available at http://opensource.org/licenses/BSD-2-Clause
- */
-
-namespace PHPMentors\ProxyURLRewriteBundle\Templating;
-
-use Symfony\Bridge\Twig\Extension\AssetExtension;
-
-/**
- * @since Class available since Release 1.1.0
- */
-class ProxyAssetExtension extends AssetExtension
-{
- /**
- * {@inheritdoc}
- */
- public function getAssetUrl($path, $packageName = null, $absolute = false, $version = null)
- {
- return parent::getAssetUrl(sprintf('absolute=%s'.$path, $absolute ? '1' : '0'), $packageName, $absolute, $version);
- }
-}
diff --git a/tests/Functional/Bundle/TestBundle/Resources/views/UrlRewritingInTemplates/index.html.twig b/tests/Functional/Bundle/TestBundle/Resources/views/UrlRewritingInTemplates/index.html.twig
index 4d4013a..af0e90f 100644
--- a/tests/Functional/Bundle/TestBundle/Resources/views/UrlRewritingInTemplates/index.html.twig
+++ b/tests/Functional/Bundle/TestBundle/Resources/views/UrlRewritingInTemplates/index.html.twig
@@ -4,5 +4,5 @@
{% block body %}
{{ referenceType }}
-{{ asset('/bundles/test/foo.png', null, referenceType) }}
+{{ asset('/bundles/test/foo.png') }}
{% endblock %}
diff --git a/tests/Functional/HostFilterTest.php b/tests/Functional/HostFilterTest.php
index 950df21..47f5ece 100644
--- a/tests/Functional/HostFilterTest.php
+++ b/tests/Functional/HostFilterTest.php
@@ -31,7 +31,8 @@ protected function setUp()
parent::setUp();
$_SERVER['KERNEL_DIR'] = __DIR__.'/app';
- $_SERVER['SYMFONY__SECRET'] = hash('sha1', uniqid(mt_rand()));
+ require_once $_SERVER['KERNEL_DIR'].'/AppKernel.php';
+ $_SERVER['KERNEL_CLASS'] = 'AppKernel';
$this->removeCacheDir();
}
@@ -100,6 +101,9 @@ public function filter($proxyUrl, $proxyHostFilterService, $rewroteUrl)
$config['proxy_host_filter_service'] = 'phpmentors_proxy_url_rewrite_test.proxy_host_filter';
}
+ $container->loadFromExtension('framework', array(
+ 'secret' => '$ecret',
+ ));
$container->loadFromExtension('phpmentors_proxy_url_rewrite', array(
'proxy_urls' => array(
'foo' => $config,
diff --git a/tests/Functional/UrlRewritingInControllersTest.php b/tests/Functional/UrlRewritingInControllersTest.php
index 721cf35..0f10867 100644
--- a/tests/Functional/UrlRewritingInControllersTest.php
+++ b/tests/Functional/UrlRewritingInControllersTest.php
@@ -28,7 +28,8 @@ protected function setUp()
parent::setUp();
$_SERVER['KERNEL_DIR'] = __DIR__.'/app';
- $_SERVER['SYMFONY__SECRET'] = hash('sha1', uniqid(mt_rand()));
+ require_once $_SERVER['KERNEL_DIR'].'/AppKernel.php';
+ $_SERVER['KERNEL_CLASS'] = 'AppKernel';
$this->removeCacheDir();
}
@@ -66,19 +67,14 @@ public function rewriteUrlInGenerateUrlData()
{
return array(
array('/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
- array('/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://backend1.example.com/foo/bar/url-rewriting-in-controllers/'),
array('/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//backend1.example.com/foo/bar/url-rewriting-in-controllers/'),
array('//example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
- array('//example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://example.com/foo/bar/url-rewriting-in-controllers/'),
array('//example.com/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com/foo/bar/url-rewriting-in-controllers/'),
array('http://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
- array('http://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://example.com/foo/bar/url-rewriting-in-controllers/'),
array('http://example.com/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com/foo/bar/url-rewriting-in-controllers/'),
array('https://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
- array('https://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'https://example.com/foo/bar/url-rewriting-in-controllers/'),
array('https://example.com/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com/foo/bar/url-rewriting-in-controllers/'),
array('http://example.com:8180/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
- array('http://example.com:8180/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://example.com:8180/foo/bar/url-rewriting-in-controllers/'),
array('http://example.com:8180/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com:8180/foo/bar/url-rewriting-in-controllers/'),
);
}
@@ -90,6 +86,9 @@ public function rewriteUrlInGenerateUrlData()
public function rewriteUrlInGenerateUrl($proxyUrl, $referenceType, $rewroteUrl)
{
$client = $this->createClient(array('config' => function (ContainerBuilder $container) use ($proxyUrl) {
+ $container->loadFromExtension('framework', array(
+ 'secret' => '$ecret',
+ ));
$container->loadFromExtension('phpmentors_proxy_url_rewrite', array(
'proxy_urls' => array(
'foo' => array(
diff --git a/tests/Functional/UrlRewritingInTemplatesTest.php b/tests/Functional/UrlRewritingInTemplatesTest.php
index d92d858..22efad6 100644
--- a/tests/Functional/UrlRewritingInTemplatesTest.php
+++ b/tests/Functional/UrlRewritingInTemplatesTest.php
@@ -27,7 +27,8 @@ protected function setUp()
parent::setUp();
$_SERVER['KERNEL_DIR'] = __DIR__.'/app';
- $_SERVER['SYMFONY__SECRET'] = hash('sha1', uniqid(mt_rand()));
+ require_once $_SERVER['KERNEL_DIR'].'/AppKernel.php';
+ $_SERVER['KERNEL_CLASS'] = 'AppKernel';
$this->removeCacheDir();
}
@@ -67,17 +68,12 @@ protected function removeCacheDir()
public function rewriteUrlInAssetData()
{
return array(
- array('/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
- array('//example.com/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
- array('//example.com/foo/bar/', true, 'http://example.com/foo/bar/bundles/test/foo.png'),
- array('http://example.com/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
- array('http://example.com/foo/bar/', true, 'http://example.com/foo/bar/bundles/test/foo.png'),
- array('https://example.com/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
- array('https://example.com/foo/bar/', true, 'https://example.com/foo/bar/bundles/test/foo.png'),
- array('http://example.com:8180/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
- array('http://example.com:8180/foo/bar/', true, 'http://example.com:8180/foo/bar/bundles/test/foo.png'),
- array('https://example.com:8180/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
- array('https://example.com:8180/foo/bar/', true, 'https://example.com:8180/foo/bar/bundles/test/foo.png'),
+ array('/foo/bar/', '/foo/bar/bundles/test/foo.png'),
+ array('//example.com/foo/bar/', '/foo/bar/bundles/test/foo.png'),
+ array('http://example.com/foo/bar/', '/foo/bar/bundles/test/foo.png'),
+ array('https://example.com/foo/bar/', '/foo/bar/bundles/test/foo.png'),
+ array('http://example.com:8180/foo/bar/', '/foo/bar/bundles/test/foo.png'),
+ array('https://example.com:8180/foo/bar/', '/foo/bar/bundles/test/foo.png'),
);
}
@@ -85,9 +81,12 @@ public function rewriteUrlInAssetData()
* @test
* @dataProvider rewriteUrlInAssetData
*/
- public function rewriteUrlInAsset($proxyUrl, $referenceType, $rewroteUrl)
+ public function rewriteUrlInAsset($proxyUrl, $rewroteUrl)
{
$client = $this->createClient(array('config' => function (ContainerBuilder $container) use ($proxyUrl) {
+ $container->loadFromExtension('framework', array(
+ 'secret' => '$ecret',
+ ));
$container->loadFromExtension('phpmentors_proxy_url_rewrite', array(
'proxy_urls' => array(
'foo' => array(
@@ -98,7 +97,7 @@ public function rewriteUrlInAsset($proxyUrl, $referenceType, $rewroteUrl)
));
}));
- $client->request('GET', sprintf('http://backend1.example.com:8080/url-rewriting-in-templates/?referenceType=%s', $referenceType));
+ $client->request('GET', 'http://backend1.example.com:8080/url-rewriting-in-templates/');
$this->assertThat($client->getResponse()->getStatusCode(), $this->equalTo(200), $client->getResponse()->getContent());
$this->assertThat($client->getCrawler()->filterXpath("//*[@id='asset']")->text(), $this->equalTo($rewroteUrl));
diff --git a/tests/Functional/app/config/config.yml b/tests/Functional/app/config/config.yml
index b0b39d0..355acbd 100644
--- a/tests/Functional/app/config/config.yml
+++ b/tests/Functional/app/config/config.yml
@@ -2,7 +2,6 @@ imports:
- { resource: services.yml }
framework:
- secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
templating: