Skip to content

Commit e67caff

Browse files
authored
Merge pull request #14 from iteman/new-dependency-versions
New dependency versions
2 parents 4d91856 + fad590e commit e67caff

20 files changed

+56
-128
lines changed

.buildpath

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | `master` for new features / `1.1` for fixes
3+
| Branch? | master for new features / 1.2 for fixes
44
| Bug fix? | yes/no
55
| New feature? | yes/no
66
| BC breaks? | yes/no

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
/.buildpath
12
/.composer/
3+
/.idea/
4+
/.php_cs.cache
5+
/.project
6+
/.settings/
27
/composer.lock
38
/composer.phar
49
/docker-compose.yml
@@ -9,3 +14,4 @@
914
/tests/Feature/app/logs/*
1015
!/tests/Feature/app/cache/.gitkeep
1116
!/tests/Feature/app/logs/.gitkeep
17+
*.iml

.project

Lines changed: 0 additions & 28 deletions
This file was deleted.

.settings/com.piece_framework.makegood.core.prefs

Lines changed: 0 additions & 6 deletions
This file was deleted.

.settings/org.eclipse.php.core.prefs

Lines changed: 0 additions & 2 deletions
This file was deleted.

.settings/org.eclipse.wst.common.project.facet.core.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ cache:
77
- $HOME/.composer/cache
88

99
php:
10-
- 5.3
1110
- 5.4
1211
- 5.5
1312
- 5.6
1413
- 7.0
15-
- hhvm
14+
- 7.1
15+
- 7.2
1616

1717
matrix:
18-
allow_failures:
19-
- php: hhvm
2018
fast_finish: true
2119

2220
before_script:

composer.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,21 @@
1313
"require": {
1414
"php": ">=5.3.9",
1515
"phpmentors/domain-kata": "~1.4",
16-
"symfony/config": "~2.8",
17-
"symfony/dependency-injection": "~2.8",
18-
"symfony/framework-bundle": "~2.8",
19-
"symfony/http-kernel": "~2.8",
20-
"symfony/routing": "~2.8"
16+
"symfony/config": "~2.8|~3.0|~4.0",
17+
"symfony/dependency-injection": "~2.8|~3.0|~4.0",
18+
"symfony/framework-bundle": "~2.8|~3.0|~4.0",
19+
"symfony/http-kernel": "~2.8|~3.0|~4.0",
20+
"symfony/routing": "~2.8|~3.0|~4.0",
21+
"symfony/templating": "~2.8|~3.0|~4.0"
2122
},
2223
"require-dev": {
2324
"phpunit/phpunit": "~4.0",
24-
"symfony/asset": "~2.8",
25-
"symfony/browser-kit": "~2.8",
26-
"symfony/filesystem": "~2.8",
27-
"symfony/http-foundation": "~2.8",
28-
"symfony/twig-bridge": "~2.8",
29-
"symfony/twig-bundle": "~2.8"
25+
"symfony/asset": "~2.8|~3.0|~4.0",
26+
"symfony/browser-kit": "~2.8|~3.0|~4.0",
27+
"symfony/filesystem": "~2.8|~3.0|~4.0",
28+
"symfony/http-foundation": "~2.8|~3.0|~4.0",
29+
"symfony/twig-bridge": "~2.8|~3.0|~4.0",
30+
"symfony/twig-bundle": "~2.8|~3.0|~4.0"
3031
},
3132
"autoload": {
3233
"psr-4": {

docker-compose.yml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ version: '2'
22
services:
33
app:
44
container_name: "phpmentors.proxy-url-rewrite-bundle.app"
5-
image: "phpmentors/php-app:php55"
5+
image: "phpmentors/php-app:php53"
66
volumes:
77
- ".:/var/app"
88
environment:
99
TERM: "xterm"
1010
TZ: "Asia/Tokyo"
1111
LANG: "ja_JP.UTF-8"
12-
PHP_INI: "docker/php.ini"
12+
# PHP_INI: "docker/php.ini"

docker/php.ini.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
;memory_limit=256M
12
;xdebug.remote_autostart=on
2-
;xdebug.remote_port=9100
3+
;xdebug.remote_port=9000
34
;xdebug.remote_host=172.17.0.1

src/DependencyInjection/Compiler/ReplaceAssetExtensionAndPakcagesDefinitionPass.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class ReplaceAssetExtensionAndPakcagesDefinitionPass implements CompilerPassInte
2323
public function process(ContainerBuilder $container)
2424
{
2525
if ($container->hasDefinition('twig.extension.assets') && $container->hasDefinition('assets.packages')) {
26-
$container->getDefinition('phpmentors_proxy_url_rewrite.proxy_asset_extension')->setArguments($container->getDefinition('twig.extension.assets')->getArguments());
27-
$container->setAlias('twig.extension.assets', 'phpmentors_proxy_url_rewrite.proxy_asset_extension');
28-
2926
$container->getDefinition('phpmentors_proxy_url_rewrite.proxy_packages')->setArguments($container->getDefinition('assets.packages')->getArguments());
3027
$container->setAlias('assets.packages', 'phpmentors_proxy_url_rewrite.proxy_packages');
3128
}

src/DependencyInjection/PHPMentorsProxyURLRewriteExtension.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
use Symfony\Component\Config\FileLocator;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
17-
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1817
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1918
use Symfony\Component\DependencyInjection\Reference;
2019
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
@@ -50,7 +49,13 @@ private function transformConfigToContainer(array $config, ContainerBuilder $con
5049
{
5150
if ($config['enabled']) {
5251
foreach ($config['proxy_urls'] as $id => $proxyUrl) {
53-
$definition = new DefinitionDecorator('phpmentors_proxy_url_rewrite.proxy_url');
52+
if (class_exists('Symfony\Component\DependencyInjection\ChildDefinition')) {
53+
$definitionClass = 'Symfony\Component\DependencyInjection\ChildDefinition';
54+
} else {
55+
$definitionClass = 'Symfony\Component\DependencyInjection\DefinitionDecorator';
56+
}
57+
58+
$definition = new $definitionClass('phpmentors_proxy_url_rewrite.proxy_url');
5459
$definition->setArguments(array($id, $proxyUrl['path'], $proxyUrl['proxy_url'], $proxyUrl['proxy_host_filter_service'] === null ? null : new Reference($proxyUrl['proxy_host_filter_service'])));
5560

5661
$serviceId = 'phpmentors_proxy_url_rewrite.proxy_url.'.sha1($id);

src/Resources/config/services.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<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">
33
<parameters>
4-
<parameter key="phpmentors_proxy_url_rewrite.proxy_asset_extension.class">PHPMentors\ProxyURLRewriteBundle\Templating\ProxyAssetExtension</parameter>
54
<parameter key="phpmentors_proxy_url_rewrite.proxy_packages.class">PHPMentors\ProxyURLRewriteBundle\Asset\ProxyPackages</parameter>
65
<parameter key="phpmentors_proxy_url_rewrite.proxy_url.class">PHPMentors\ProxyURLRewriteBundle\ProxyUrl\ProxyUrl</parameter>
76
<parameter key="phpmentors_proxy_url_rewrite.proxy_url_collection.class">PHPMentors\ProxyURLRewriteBundle\ProxyUrl\ProxyUrlCollection</parameter>
@@ -15,7 +14,6 @@
1514
<argument type="service" id="phpmentors_proxy_url_rewrite.proxy_url_matcher"/>
1615
</call>
1716
</service>
18-
<service id="phpmentors_proxy_url_rewrite.proxy_asset_extension" class="%phpmentors_proxy_url_rewrite.proxy_asset_extension.class%" public="false"/>
1917
<service id="phpmentors_proxy_url_rewrite.proxy_url" class="%phpmentors_proxy_url_rewrite.proxy_url.class%" abstract="true">
2018
<factory service="phpmentors_proxy_url_rewrite.proxy_url_factory" method="create"/>
2119
</service>

src/Templating/ProxyAssetExtension.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/Functional/Bundle/TestBundle/Resources/views/UrlRewritingInTemplates/index.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
{% block body %}
66
<div>{{ referenceType }}</div>
7-
<div id="asset">{{ asset('/bundles/test/foo.png', null, referenceType) }}</div>
7+
<div id="asset">{{ asset('/bundles/test/foo.png') }}</div>
88
{% endblock %}

tests/Functional/HostFilterTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ protected function setUp()
3131
parent::setUp();
3232

3333
$_SERVER['KERNEL_DIR'] = __DIR__.'/app';
34-
$_SERVER['SYMFONY__SECRET'] = hash('sha1', uniqid(mt_rand()));
34+
require_once $_SERVER['KERNEL_DIR'].'/AppKernel.php';
35+
$_SERVER['KERNEL_CLASS'] = 'AppKernel';
3536

3637
$this->removeCacheDir();
3738
}
@@ -100,6 +101,9 @@ public function filter($proxyUrl, $proxyHostFilterService, $rewroteUrl)
100101
$config['proxy_host_filter_service'] = 'phpmentors_proxy_url_rewrite_test.proxy_host_filter';
101102
}
102103

104+
$container->loadFromExtension('framework', array(
105+
'secret' => '$ecret',
106+
));
103107
$container->loadFromExtension('phpmentors_proxy_url_rewrite', array(
104108
'proxy_urls' => array(
105109
'foo' => $config,

tests/Functional/UrlRewritingInControllersTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ protected function setUp()
2828
parent::setUp();
2929

3030
$_SERVER['KERNEL_DIR'] = __DIR__.'/app';
31-
$_SERVER['SYMFONY__SECRET'] = hash('sha1', uniqid(mt_rand()));
31+
require_once $_SERVER['KERNEL_DIR'].'/AppKernel.php';
32+
$_SERVER['KERNEL_CLASS'] = 'AppKernel';
3233

3334
$this->removeCacheDir();
3435
}
@@ -66,19 +67,14 @@ public function rewriteUrlInGenerateUrlData()
6667
{
6768
return array(
6869
array('/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
69-
array('/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://backend1.example.com/foo/bar/url-rewriting-in-controllers/'),
7070
array('/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//backend1.example.com/foo/bar/url-rewriting-in-controllers/'),
7171
array('//example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
72-
array('//example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://example.com/foo/bar/url-rewriting-in-controllers/'),
7372
array('//example.com/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com/foo/bar/url-rewriting-in-controllers/'),
7473
array('http://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
75-
array('http://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://example.com/foo/bar/url-rewriting-in-controllers/'),
7674
array('http://example.com/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com/foo/bar/url-rewriting-in-controllers/'),
7775
array('https://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
78-
array('https://example.com/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'https://example.com/foo/bar/url-rewriting-in-controllers/'),
7976
array('https://example.com/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com/foo/bar/url-rewriting-in-controllers/'),
8077
array('http://example.com:8180/foo/bar/', UrlGeneratorInterface::ABSOLUTE_PATH, '/foo/bar/url-rewriting-in-controllers/'),
81-
array('http://example.com:8180/foo/bar/', UrlGeneratorInterface::ABSOLUTE_URL, 'http://example.com:8180/foo/bar/url-rewriting-in-controllers/'),
8278
array('http://example.com:8180/foo/bar/', UrlGeneratorInterface::NETWORK_PATH, '//example.com:8180/foo/bar/url-rewriting-in-controllers/'),
8379
);
8480
}
@@ -90,6 +86,9 @@ public function rewriteUrlInGenerateUrlData()
9086
public function rewriteUrlInGenerateUrl($proxyUrl, $referenceType, $rewroteUrl)
9187
{
9288
$client = $this->createClient(array('config' => function (ContainerBuilder $container) use ($proxyUrl) {
89+
$container->loadFromExtension('framework', array(
90+
'secret' => '$ecret',
91+
));
9392
$container->loadFromExtension('phpmentors_proxy_url_rewrite', array(
9493
'proxy_urls' => array(
9594
'foo' => array(

tests/Functional/UrlRewritingInTemplatesTest.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ protected function setUp()
2727
parent::setUp();
2828

2929
$_SERVER['KERNEL_DIR'] = __DIR__.'/app';
30-
$_SERVER['SYMFONY__SECRET'] = hash('sha1', uniqid(mt_rand()));
30+
require_once $_SERVER['KERNEL_DIR'].'/AppKernel.php';
31+
$_SERVER['KERNEL_CLASS'] = 'AppKernel';
3132

3233
$this->removeCacheDir();
3334
}
@@ -67,27 +68,25 @@ protected function removeCacheDir()
6768
public function rewriteUrlInAssetData()
6869
{
6970
return array(
70-
array('/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
71-
array('//example.com/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
72-
array('//example.com/foo/bar/', true, 'http://example.com/foo/bar/bundles/test/foo.png'),
73-
array('http://example.com/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
74-
array('http://example.com/foo/bar/', true, 'http://example.com/foo/bar/bundles/test/foo.png'),
75-
array('https://example.com/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
76-
array('https://example.com/foo/bar/', true, 'https://example.com/foo/bar/bundles/test/foo.png'),
77-
array('http://example.com:8180/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
78-
array('http://example.com:8180/foo/bar/', true, 'http://example.com:8180/foo/bar/bundles/test/foo.png'),
79-
array('https://example.com:8180/foo/bar/', false, '/foo/bar/bundles/test/foo.png'),
80-
array('https://example.com:8180/foo/bar/', true, 'https://example.com:8180/foo/bar/bundles/test/foo.png'),
71+
array('/foo/bar/', '/foo/bar/bundles/test/foo.png'),
72+
array('//example.com/foo/bar/', '/foo/bar/bundles/test/foo.png'),
73+
array('http://example.com/foo/bar/', '/foo/bar/bundles/test/foo.png'),
74+
array('https://example.com/foo/bar/', '/foo/bar/bundles/test/foo.png'),
75+
array('http://example.com:8180/foo/bar/', '/foo/bar/bundles/test/foo.png'),
76+
array('https://example.com:8180/foo/bar/', '/foo/bar/bundles/test/foo.png'),
8177
);
8278
}
8379

8480
/**
8581
* @test
8682
* @dataProvider rewriteUrlInAssetData
8783
*/
88-
public function rewriteUrlInAsset($proxyUrl, $referenceType, $rewroteUrl)
84+
public function rewriteUrlInAsset($proxyUrl, $rewroteUrl)
8985
{
9086
$client = $this->createClient(array('config' => function (ContainerBuilder $container) use ($proxyUrl) {
87+
$container->loadFromExtension('framework', array(
88+
'secret' => '$ecret',
89+
));
9190
$container->loadFromExtension('phpmentors_proxy_url_rewrite', array(
9291
'proxy_urls' => array(
9392
'foo' => array(
@@ -98,7 +97,7 @@ public function rewriteUrlInAsset($proxyUrl, $referenceType, $rewroteUrl)
9897
));
9998
}));
10099

101-
$client->request('GET', sprintf('http://backend1.example.com:8080/url-rewriting-in-templates/?referenceType=%s', $referenceType));
100+
$client->request('GET', 'http://backend1.example.com:8080/url-rewriting-in-templates/');
102101

103102
$this->assertThat($client->getResponse()->getStatusCode(), $this->equalTo(200), $client->getResponse()->getContent());
104103
$this->assertThat($client->getCrawler()->filterXpath("//*[@id='asset']")->text(), $this->equalTo($rewroteUrl));

tests/Functional/app/config/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ imports:
22
- { resource: services.yml }
33

44
framework:
5-
secret: "%secret%"
65
router:
76
resource: "%kernel.root_dir%/config/routing.yml"
87
templating:

0 commit comments

Comments
 (0)