Skip to content

Commit 6b9ae4c

Browse files
committed
Merge pull request #332 from hacfi/symfony3
Symfony3 compatibility
2 parents 827703c + 13e401f commit 6b9ae4c

File tree

9 files changed

+22
-16
lines changed

9 files changed

+22
-16
lines changed

.travis.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ sudo: false
1313
cache:
1414
directories:
1515
- $HOME/.composer/cache/files
16-
16+
1717
env:
1818
global:
1919
- SYMFONY_DEPRECATIONS_HELPER=322
2020

2121
matrix:
2222
include:
2323
- php: 5.6
24-
env: DEPS=dev
24+
env: DEPS=dev SYMFONY_VERSION=2.8.*
2525
- php: 5.3
26-
env: COMPOSER_FLAGS="--prefer-lowest"
27-
- php: 5.6
28-
env: SYMFONY_VERSION=2.3.*
26+
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=2.7.*
2927
- php: 5.6
3028
env: SYMFONY_VERSION=2.7.*
3129
fast_finish: true
@@ -36,7 +34,7 @@ before_install:
3634
- composer self-update
3735
- if [ "$DEPS" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi
3836
- if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi
39-
37+
4038
install: composer update --prefer-dist $COMPOSER_FLAGS
4139

4240
before_script: vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh

Admin/RedirectRouteAdmin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function configureFormFields(FormMapper $formMapper)
4040
{
4141
$formMapper
4242
->with('form.group_general')
43-
->add('parent', Sf2CompatUtil::getFormTypeName('doctrine_phpcr_odm_tree'), array('choice_list' => array(), 'select_root_node' => true, 'root_node' => $this->routeRoot))
43+
->add('parentDocument', Sf2CompatUtil::getFormTypeName('doctrine_phpcr_odm_tree'), array('choice_list' => array(), 'select_root_node' => true, 'root_node' => $this->routeRoot))
4444
->add('name', Sf2CompatUtil::getFormTypeName('text'))
4545
->add('routeName', Sf2CompatUtil::getFormTypeName('text'), array('required' => false))
4646
->add('uri', Sf2CompatUtil::getFormTypeName('text'), array('required' => false))

Admin/RouteAdmin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function configureFormFields(FormMapper $formMapper)
6666
'translation_domain' => 'CmfRoutingBundle',
6767
))
6868
->add(
69-
'parent',
69+
'parentDocument',
7070
Sf2CompatUtil::getFormTypeName('doctrine_phpcr_odm_tree'),
7171
array('choice_list' => array(), 'select_root_node' => true, 'root_node' => $this->routeRoot)
7272
)
@@ -146,7 +146,7 @@ protected function configureFieldsForDefaults($dynamicDefaults)
146146
'_controller' => array('_controller', Sf2CompatUtil::getFormTypeName('text'), array('required' => false)),
147147
'_template' => array('_template', Sf2CompatUtil::getFormTypeName('text'), array('required' => false)),
148148
'type' => array('type', Sf2CompatUtil::getFormTypeName('cmf_routing_route_type'), array(
149-
'empty_value' => '',
149+
'placeholder' => '',
150150
'required' => false,
151151
)),
152152
);

Model/Route.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function getOption($name)
181181
return 'Symfony\\Component\\Routing\\RouteCompiler';
182182
}
183183
if ($this->isBooleanOption($name)) {
184-
return (boolean) $option;
184+
return (bool) $option;
185185
}
186186

187187
return $option;
@@ -202,7 +202,7 @@ public function getOptions()
202202
}
203203
foreach ($options as $key => $value) {
204204
if ($this->isBooleanOption($key)) {
205-
$options[$key] = (boolean) $value;
205+
$options[$key] = (bool) $value;
206206
}
207207
}
208208

Tests/Resources/app/config/cmf_routing.phpcr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ cmf_routing:
33
persistence:
44
phpcr:
55
enabled: true
6-
route_basepath: /test/routing
6+
route_basepaths: /test/routing

Tests/Unit/Routing/DynamicRouterTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ private function assertRequestAttributes($request)
5858
$this->assertEquals('template', $request->attributes->get(DynamicRouter::CONTENT_TEMPLATE));
5959
}
6060

61+
/**
62+
* @group legacy
63+
*/
6164
public function testMatch()
6265
{
6366
$this->eventDispatcher->expects($this->once())
@@ -86,6 +89,8 @@ public function testMatchRequest()
8689

8790
/**
8891
* @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
92+
*
93+
* @group legacy
8994
*/
9095
public function testMatchNoRequest()
9196
{

Tests/WebTest/RedirectRouteAdminTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testRedirectRouteCreate()
6464
$actionUrl = $node->getAttribute('action');
6565
$uniqId = substr(strstr($actionUrl, '='), 1);
6666

67-
$form[$uniqId.'[parent]'] = '/test/routing';
67+
$form[$uniqId.'[parentDocument]'] = '/test/routing';
6868
$form[$uniqId.'[name]'] = 'foo-test';
6969

7070
$this->client->submit($form);

Tests/WebTest/RouteAdminTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testRouteCreate()
6464
$actionUrl = $node->getAttribute('action');
6565
$uniqId = substr(strstr($actionUrl, '='), 1);
6666

67-
$form[$uniqId.'[parent]'] = '/test/routing';
67+
$form[$uniqId.'[parentDocument]'] = '/test/routing';
6868
$form[$uniqId.'[name]'] = 'foo-test';
6969

7070
$this->client->submit($form);

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"require": {
1515
"php": "^5.3.9|^7.0",
1616
"symfony-cmf/routing": "~1.2",
17-
"symfony/framework-bundle": "~2.3"
17+
"symfony/framework-bundle": "~2.7|~3.0"
1818
},
1919
"require-dev": {
2020
"symfony-cmf/core-bundle": "~1.1",
@@ -23,7 +23,10 @@
2323
"matthiasnoback/symfony-dependency-injection-test": "~0.6",
2424
"matthiasnoback/symfony-config-test": "^1.3.1",
2525
"phpunit/php-code-coverage": "@stable",
26-
"sonata-project/doctrine-phpcr-admin-bundle": "^1.1",
26+
"sonata-project/admin-bundle": "^2.2.12",
27+
"sonata-project/core-bundle": "^2.2.3",
28+
"sonata-project/block-bundle": "^2.2.8",
29+
"sonata-project/doctrine-phpcr-admin-bundle": "^1.2.3",
2730
"symfony/monolog-bundle": "~2.3",
2831
"doctrine/orm": "~2.3",
2932
"doctrine/data-fixtures": "^1.0.0-alpha3"

0 commit comments

Comments
 (0)