From 89c3570ff2451dac021268cf93a9b6f5d9053b97 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 10 Jun 2018 13:45:55 +0900 Subject: [PATCH 01/12] update .gitignore --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9512970..91a1cef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,16 @@ +/.buildpath /.composer/ +/.idea/ +/.php_cs.cache +/.project +/.settings/ /composer.lock /composer.phar /docker-compose.yml -/docker/php.ini /php-cs-fixer.phar /vendor/ /tests/Feature/app/cache/* /tests/Feature/app/logs/* !/tests/Feature/app/cache/.gitkeep !/tests/Feature/app/logs/.gitkeep +*.iml From c3c08a7a924731b6bb417de3c40939bb853ff49e Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 10 Jun 2018 13:46:30 +0900 Subject: [PATCH 02/12] remove Eclipse project files --- .buildpath | 7 ----- .project | 28 ------------------- .../com.piece_framework.makegood.core.prefs | 6 ---- .settings/org.eclipse.php.core.prefs | 2 -- ....eclipse.wst.common.project.facet.core.xml | 7 ----- 5 files changed, 50 deletions(-) delete mode 100644 .buildpath delete mode 100644 .project delete mode 100644 .settings/com.piece_framework.makegood.core.prefs delete mode 100644 .settings/org.eclipse.php.core.prefs delete mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml diff --git a/.buildpath b/.buildpath deleted file mode 100644 index cec864d..0000000 --- a/.buildpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index 536f5c5..0000000 --- a/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - proxy-url-rewrite-bundle - - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.dltk.core.scriptbuilder - - - - - - org.eclipse.php.core.PHPNature - org.eclipse.wst.common.project.facet.core.nature - - diff --git a/.settings/com.piece_framework.makegood.core.prefs b/.settings/com.piece_framework.makegood.core.prefs deleted file mode 100644 index 5e68a39..0000000 --- a/.settings/com.piece_framework.makegood.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -phpunit_config_file= -preload_script=/proxy-url-rewrite-bundle/tests/bootstrap.php -test_file_pattern= -test_folders=/proxy-url-rewrite-bundle/tests -testing_framework=PHPUnit diff --git a/.settings/org.eclipse.php.core.prefs b/.settings/org.eclipse.php.core.prefs deleted file mode 100644 index 5f7d896..0000000 --- a/.settings/org.eclipse.php.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -include_path= diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml deleted file mode 100644 index ad32966..0000000 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From 747c2966a79401f1b496d5bf1e76f008bc04bd95 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 10 Jun 2018 13:47:27 +0900 Subject: [PATCH 03/12] update docker-compose.yml.dist --- docker-compose.yml.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml.dist b/docker-compose.yml.dist index 894ad47..3a6582b 100644 --- a/docker-compose.yml.dist +++ b/docker-compose.yml.dist @@ -2,11 +2,11 @@ version: '2' services: app: container_name: "phpmentors.proxy-url-rewrite-bundle.app" - image: "phpmentors/php-app:php55" + image: "phpmentors/php-app:php53" volumes: - ".:/var/app" environment: TERM: "xterm" TZ: "Asia/Tokyo" LANG: "ja_JP.UTF-8" - PHP_INI: "docker/php.ini" +# PHP_INI: "docker/php.ini" From af529bb855ed5063687d56ae9da6076b0d854daf Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 10 Jun 2018 13:49:51 +0900 Subject: [PATCH 04/12] update the pull request template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 12ddb65..daa8684 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | `master` for new features / `1.1` for fixes +| Branch? | master for new features / 1.2 for fixes | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | yes/no From 17c0c9421ccfe67ffb46a4ae5595df15432f7a24 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 10 Jun 2018 13:52:32 +0900 Subject: [PATCH 05/12] update dependency versions - symfony/*: >= 2.8.0 --- composer.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 0deaf1c..95f1158 100644 --- a/composer.json +++ b/composer.json @@ -13,20 +13,20 @@ "require": { "php": ">=5.3.9", "phpmentors/domain-kata": "~1.4", - "symfony/config": "~2.8", - "symfony/dependency-injection": "~2.8", - "symfony/framework-bundle": "~2.8", - "symfony/http-kernel": "~2.8", - "symfony/routing": "~2.8" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/framework-bundle": "~2.8|~3.0|~4.0", + "symfony/http-kernel": "~2.8|~3.0|~4.0", + "symfony/routing": "~2.8|~3.0|~4.0" }, "require-dev": { "phpunit/phpunit": "~4.0", - "symfony/asset": "~2.8", - "symfony/browser-kit": "~2.8", - "symfony/filesystem": "~2.8", - "symfony/http-foundation": "~2.8", - "symfony/twig-bridge": "~2.8", - "symfony/twig-bundle": "~2.8" + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/twig-bridge": "~2.8|~3.0|~4.0", + "symfony/twig-bundle": "~2.8|~3.0|~4.0" }, "autoload": { "psr-4": { From 42f595f55dee0fbb57998ed4269f16ca4a9c52dc Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 29 Jul 2018 19:37:55 +0900 Subject: [PATCH 06/12] update docker/php.ini.dist --- docker/php.ini.dist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/php.ini.dist b/docker/php.ini.dist index 438e687..258e69a 100644 --- a/docker/php.ini.dist +++ b/docker/php.ini.dist @@ -1,3 +1,4 @@ +;memory_limit=256M ;xdebug.remote_autostart=on -;xdebug.remote_port=9100 +;xdebug.remote_port=9000 ;xdebug.remote_host=172.17.0.1 From fde19960e0fcae535aac050195627ad8eb15cbc6 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 29 Jul 2018 19:38:58 +0900 Subject: [PATCH 07/12] remove docker/php.ini from the Git repository --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 91a1cef..fba26e3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /composer.lock /composer.phar /docker-compose.yml +/docker/php.ini /php-cs-fixer.phar /vendor/ /tests/Feature/app/cache/* From 85c1ac75b42c593a68a53be04200d2e0d39502ea Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 29 Jul 2018 19:57:44 +0900 Subject: [PATCH 08/12] add missing dependency `symfony/templating` --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 95f1158..0cace9e 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "symfony/dependency-injection": "~2.8|~3.0|~4.0", "symfony/framework-bundle": "~2.8|~3.0|~4.0", "symfony/http-kernel": "~2.8|~3.0|~4.0", - "symfony/routing": "~2.8|~3.0|~4.0" + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0" }, "require-dev": { "phpunit/phpunit": "~4.0", From b4ad0f47fc597ca20df28bcc6c94ce1c30686db6 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 29 Jul 2018 20:02:21 +0900 Subject: [PATCH 09/12] update code to work with Symfony >= 3 --- .../PHPMentorsProxyURLRewriteExtension.php | 9 ++++++++- tests/Functional/HostFilterTest.php | 8 ++++++-- tests/Functional/UrlRewritingInControllersTest.php | 6 +++++- tests/Functional/UrlRewritingInTemplatesTest.php | 6 +++++- tests/Functional/app/config/config.yml | 1 - 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php b/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php index 826f0a6..3f17f4c 100644 --- a/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php +++ b/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php @@ -13,6 +13,7 @@ namespace PHPMentors\ProxyURLRewriteBundle\DependencyInjection; use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; @@ -50,7 +51,13 @@ private function transformConfigToContainer(array $config, ContainerBuilder $con { if ($config['enabled']) { foreach ($config['proxy_urls'] as $id => $proxyUrl) { - $definition = new DefinitionDecorator('phpmentors_proxy_url_rewrite.proxy_url'); + if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) { + $definitionClass = 'Symfony\Component\DependencyInjection\ChildDefinition'; + } else { + $definitionClass = 'Symfony\Component\DependencyInjection\DefinitionDecorator'; + } + + $definition = new $definitionClass('phpmentors_proxy_url_rewrite.proxy_url'); $definition->setArguments(array($id, $proxyUrl['path'], $proxyUrl['proxy_url'], $proxyUrl['proxy_host_filter_service'] === null ? null : new Reference($proxyUrl['proxy_host_filter_service']))); $serviceId = 'phpmentors_proxy_url_rewrite.proxy_url.'.sha1($id); diff --git a/tests/Functional/HostFilterTest.php b/tests/Functional/HostFilterTest.php index 950df21..4e12c6d 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,10 +101,13 @@ 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, - ), )); + ))); })); $client->request('GET', sprintf('http://backend1.example.com:8080/url-rewriting-in-controllers/?referenceType=%s', UrlGeneratorInterface::ABSOLUTE_URL)); diff --git a/tests/Functional/UrlRewritingInControllersTest.php b/tests/Functional/UrlRewritingInControllersTest.php index 721cf35..ca06cef 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(); } @@ -90,6 +91,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..b01dbb8 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(); } @@ -88,6 +89,9 @@ public function rewriteUrlInAssetData() public function rewriteUrlInAsset($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/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: From 2b509d96d1dcae5767b76702dc241e8fc2275284 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Sun, 29 Jul 2018 20:12:20 +0900 Subject: [PATCH 10/12] remove replacing `twig.extension.assets` with `ProxyAssetExtension` --- ...ssetExtensionAndPakcagesDefinitionPass.php | 3 -- src/Resources/config/services.xml | 2 -- src/Templating/ProxyAssetExtension.php | 29 ------------------- .../UrlRewritingInTemplates/index.html.twig | 2 +- .../UrlRewritingInControllersTest.php | 5 ---- .../UrlRewritingInTemplatesTest.php | 21 +++++--------- 6 files changed, 9 insertions(+), 53 deletions(-) delete mode 100644 src/Templating/ProxyAssetExtension.php diff --git a/src/DependencyInjection/Compiler/ReplaceAssetExtensionAndPakcagesDefinitionPass.php b/src/DependencyInjection/Compiler/ReplaceAssetExtensionAndPakcagesDefinitionPass.php index 2b204eb..11b9078 100644 --- a/src/DependencyInjection/Compiler/ReplaceAssetExtensionAndPakcagesDefinitionPass.php +++ b/src/DependencyInjection/Compiler/ReplaceAssetExtensionAndPakcagesDefinitionPass.php @@ -23,9 +23,6 @@ class ReplaceAssetExtensionAndPakcagesDefinitionPass implements CompilerPassInte public function process(ContainerBuilder $container) { if ($container->hasDefinition('twig.extension.assets') && $container->hasDefinition('assets.packages')) { - $container->getDefinition('phpmentors_proxy_url_rewrite.proxy_asset_extension')->setArguments($container->getDefinition('twig.extension.assets')->getArguments()); - $container->setAlias('twig.extension.assets', 'phpmentors_proxy_url_rewrite.proxy_asset_extension'); - $container->getDefinition('phpmentors_proxy_url_rewrite.proxy_packages')->setArguments($container->getDefinition('assets.packages')->getArguments()); $container->setAlias('assets.packages', 'phpmentors_proxy_url_rewrite.proxy_packages'); } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 0da468e..fd0ab31 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -1,7 +1,6 @@ - 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/UrlRewritingInControllersTest.php b/tests/Functional/UrlRewritingInControllersTest.php index ca06cef..0f10867 100644 --- a/tests/Functional/UrlRewritingInControllersTest.php +++ b/tests/Functional/UrlRewritingInControllersTest.php @@ -67,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/'), ); } diff --git a/tests/Functional/UrlRewritingInTemplatesTest.php b/tests/Functional/UrlRewritingInTemplatesTest.php index b01dbb8..22efad6 100644 --- a/tests/Functional/UrlRewritingInTemplatesTest.php +++ b/tests/Functional/UrlRewritingInTemplatesTest.php @@ -68,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'), ); } @@ -86,7 +81,7 @@ 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( @@ -102,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)); From e531002a9d85dde896421d466e27d67c2229fec5 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Tue, 31 Jul 2018 07:55:52 +0900 Subject: [PATCH 11/12] fix CS --- src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php | 2 -- tests/Functional/HostFilterTest.php | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php b/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php index 3f17f4c..fdfc83e 100644 --- a/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php +++ b/src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php @@ -13,9 +13,7 @@ namespace PHPMentors\ProxyURLRewriteBundle\DependencyInjection; use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\Extension; diff --git a/tests/Functional/HostFilterTest.php b/tests/Functional/HostFilterTest.php index 4e12c6d..47f5ece 100644 --- a/tests/Functional/HostFilterTest.php +++ b/tests/Functional/HostFilterTest.php @@ -107,7 +107,7 @@ public function filter($proxyUrl, $proxyHostFilterService, $rewroteUrl) $container->loadFromExtension('phpmentors_proxy_url_rewrite', array( 'proxy_urls' => array( 'foo' => $config, - ))); + ), )); })); $client->request('GET', sprintf('http://backend1.example.com:8080/url-rewriting-in-controllers/?referenceType=%s', UrlGeneratorInterface::ABSOLUTE_URL)); From fad590e6c7fe0f5ff5a4940c329403e3117c22b6 Mon Sep 17 00:00:00 2001 From: Atsuhiro Kubo Date: Tue, 31 Jul 2018 08:10:26 +0900 Subject: [PATCH 12/12] update .travis.yml - add 7.1 and 7.2 - remove 5.3 and hhvm --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3385399..2bd4887 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,16 +7,14 @@ cache: - $HOME/.composer/cache php: - - 5.3 - 5.4 - 5.5 - 5.6 - 7.0 - - hhvm + - 7.1 + - 7.2 matrix: - allow_failures: - - php: hhvm fast_finish: true before_script: