Skip to content

Commit

Permalink
Merge pull request #14 from iteman/new-dependency-versions
Browse files Browse the repository at this point in the history
New dependency versions
  • Loading branch information
iteman authored Jul 30, 2018
2 parents 4d91856 + fad590e commit e67caff
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 128 deletions.
7 changes: 0 additions & 7 deletions .buildpath

This file was deleted.

2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/.buildpath
/.composer/
/.idea/
/.php_cs.cache
/.project
/.settings/
/composer.lock
/composer.phar
/docker-compose.yml
Expand All @@ -9,3 +14,4 @@
/tests/Feature/app/logs/*
!/tests/Feature/app/cache/.gitkeep
!/tests/Feature/app/logs/.gitkeep
*.iml
28 changes: 0 additions & 28 deletions .project

This file was deleted.

6 changes: 0 additions & 6 deletions .settings/com.piece_framework.makegood.core.prefs

This file was deleted.

2 changes: 0 additions & 2 deletions .settings/org.eclipse.php.core.prefs

This file was deleted.

7 changes: 0 additions & 7 deletions .settings/org.eclipse.wst.common.project.facet.core.xml

This file was deleted.

6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
23 changes: 12 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@
"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",
"symfony/templating": "~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": {
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 2 additions & 1 deletion docker/php.ini.dist
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use Symfony\Component\Config\FileLocator;
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;
Expand Down Expand Up @@ -50,7 +49,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);
Expand Down
2 changes: 0 additions & 2 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?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">
<parameters>
<parameter key="phpmentors_proxy_url_rewrite.proxy_asset_extension.class">PHPMentors\ProxyURLRewriteBundle\Templating\ProxyAssetExtension</parameter>
<parameter key="phpmentors_proxy_url_rewrite.proxy_packages.class">PHPMentors\ProxyURLRewriteBundle\Asset\ProxyPackages</parameter>
<parameter key="phpmentors_proxy_url_rewrite.proxy_url.class">PHPMentors\ProxyURLRewriteBundle\ProxyUrl\ProxyUrl</parameter>
<parameter key="phpmentors_proxy_url_rewrite.proxy_url_collection.class">PHPMentors\ProxyURLRewriteBundle\ProxyUrl\ProxyUrlCollection</parameter>
Expand All @@ -15,7 +14,6 @@
<argument type="service" id="phpmentors_proxy_url_rewrite.proxy_url_matcher"/>
</call>
</service>
<service id="phpmentors_proxy_url_rewrite.proxy_asset_extension" class="%phpmentors_proxy_url_rewrite.proxy_asset_extension.class%" public="false"/>
<service id="phpmentors_proxy_url_rewrite.proxy_url" class="%phpmentors_proxy_url_rewrite.proxy_url.class%" abstract="true">
<factory service="phpmentors_proxy_url_rewrite.proxy_url_factory" method="create"/>
</service>
Expand Down
29 changes: 0 additions & 29 deletions src/Templating/ProxyAssetExtension.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

{% block body %}
<div>{{ referenceType }}</div>
<div id="asset">{{ asset('/bundles/test/foo.png', null, referenceType) }}</div>
<div id="asset">{{ asset('/bundles/test/foo.png') }}</div>
{% endblock %}
6 changes: 5 additions & 1 deletion tests/Functional/HostFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions tests/Functional/UrlRewritingInControllersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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/'),
);
}
Expand All @@ -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(
Expand Down
27 changes: 13 additions & 14 deletions tests/Functional/UrlRewritingInTemplatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -67,27 +68,25 @@ 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'),
);
}

/**
* @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(
Expand All @@ -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));
Expand Down
1 change: 0 additions & 1 deletion tests/Functional/app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ imports:
- { resource: services.yml }

framework:
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
templating:
Expand Down

0 comments on commit e67caff

Please sign in to comment.