Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 93fa909

Browse files
committed
Add Symfony 3 support
1 parent 61aae04 commit 93fa909

File tree

5 files changed

+49
-38
lines changed

5 files changed

+49
-38
lines changed

.travis.yml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
11
language: php
22

33
php:
4-
- 5.3
5-
- 5.4
6-
- 5.5
7-
- 5.6
8-
- hhvm
4+
- 5.3
5+
- 5.4
6+
- 5.5
7+
- 5.6
8+
- 7.0
9+
- hhvm
910

10-
env:
11-
- SYMFONY_VERSION=2.5.*
11+
sudo: false
12+
13+
cache:
14+
directories:
15+
- $HOME/.composer/cache/files
1216

1317
matrix:
1418
include:
15-
- php: 5.5
19+
- php: 5.6
20+
env: SYMFONY_VERSION="3.0.x-dev as 2.8.x-dev" DEPS=dev
21+
- php: 5.3
22+
env: COMPOSER_FLAGS="--prefer-lowest"
23+
- php: 5.6
1624
env: SYMFONY_VERSION=2.3.*
17-
- php: 5.5
18-
env: SYMFONY_VERSION=2.4.*
19-
- php: 5.5
20-
env: SYMFONY_VERSION=2.6.*
25+
- php: 5.6
26+
env: SYMFONY_VERSION=2.7.*
27+
fast_finish: true
2128

22-
before_script:
29+
before_install:
30+
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi
31+
- phpenv config-rm xdebug.ini || true
2332
- composer self-update
24-
- composer require symfony/symfony:${SYMFONY_VERSION} --prefer-source
25-
- vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh
33+
- if [ "$DEPS" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi
34+
- if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi
35+
36+
install: composer update --prefer-dist $COMPOSER_FLAGS
37+
38+
before_script: vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh
2639

27-
script: phpunit --coverage-text
40+
script: phpunit
2841

2942
notifications:
3043
irc: "irc.freenode.org#symfony-cmf"

Route/TreeControllerRoutesLoader.php

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

33
namespace Symfony\Cmf\Bundle\TreeBrowserBundle\Route;
44

5+
use Symfony\Component\Config\FileLocator;
56
use Symfony\Component\Config\Loader\FileLoader;
67
use Symfony\Component\Routing\RouteCollection;
78
use Symfony\Component\Routing\Route;
@@ -19,6 +20,8 @@ class TreeControllerRoutesLoader extends FileLoader
1920
*/
2021
public function __construct(array $treeControllers)
2122
{
23+
parent::__construct(new FileLocator());
24+
2225
$this->treeControllers = $treeControllers;
2326
}
2427

@@ -36,17 +39,14 @@ public function load($resource, $type = null)
3639
$defaults = array(
3740
'_controller' => $controller['id'].':'.$definition['action']
3841
);
39-
$requirements = array(
40-
'_method' => $definition['method']
41-
);
42-
$pattern = '_cmf_tree/'.$controller['alias'].'/'.$definition['pattern'];
42+
$path = '_cmf_tree/'.$controller['alias'].'/'.$definition['path'];
4343

44-
$route = new Route($pattern, $defaults, $requirements, array('expose' => true));
44+
$route = new Route($path, $defaults, array(), array('expose' => true), '', array(), array($definition['method']));
4545
$collection->add('_cmf_tree_'.$controller['alias'].'_'.$name, $route);
4646
}
4747
}
48-
return $collection;
4948

49+
return $collection;
5050
}
5151

5252
/**
@@ -70,20 +70,20 @@ protected function getRoutesDefinitions()
7070
{
7171
return array(
7272
'children' => array(
73-
'pattern' => 'children',
73+
'path' => 'children',
7474
'method' => 'GET',
7575
'action' => 'childrenAction'
7676
),
7777
'move' => array(
78-
'pattern' => 'move',
78+
'path' => 'move',
7979
'method' => 'POST',
8080
'action' => 'moveAction'
8181
),
8282
'reorder' => array(
83-
'pattern' => 'reorder',
83+
'path' => 'reorder',
8484
'method' => 'POST',
8585
'action' => 'reorderAction'
8686
),
8787
);
8888
}
89-
}
89+
}

Tests/Functional/PHPCR/PHPCRBrowserTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*/
1313
class PHPCRBrowserTest extends BaseTestCase
1414
{
15-
1615
public function testGetChildrenListFromRoot()
1716
{
1817
$this->loadFixtures();
@@ -22,7 +21,7 @@ public function testGetChildrenListFromRoot()
2221
$client->request('GET', '/_cmf_tree/phpcr_tree/children');
2322
$response = $client->getResponse();
2423

25-
$this->assertEquals(200, $response->getStatusCode());
24+
$this->assertResponseSuccess($response);
2625

2726
$this->assertEquals(
2827
'[{"data":"cms","attr":{"id":"\/cms","url_safe_id":"cms","rel":"node"},"state":"closed","children":[{"data":"content","attr":{"id":"\/cms\/content","url_safe_id":"cms\/content","rel":"node"},"state":"closed"}]},{"data":"menus","attr":{"id":"\/menus","url_safe_id":"menus","rel":"node"},"state":"closed","children":[{"data":"test","attr":{"id":"\/menus\/test","url_safe_id":"menus\/test","rel":"node"},"state":null}]}]',
@@ -39,7 +38,7 @@ public function testGetChildrenListFromInnerNode()
3938
$crawler = $client->request('GET', '/_cmf_tree/phpcr_tree/children?root=%2Fcms%2Fcontent');
4039
$response = $client->getResponse();
4140

42-
$this->assertEquals(200, $response->getStatusCode());
41+
$this->assertResponseSuccess($response);
4342

4443
$this->assertEquals(
4544
'[{"data":"static","attr":{"id":"\/cms\/content\/static","url_safe_id":"cms\/content\/static","rel":"node"},"state":"closed","children":[{"data":"test","attr":{"id":"\/cms\/content\/static\/test","url_safe_id":"cms\/content\/static\/test","rel":"node"},"state":null}]}]',

Tests/Resources/app/config/routing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
symfony_route:
2-
pattern: /symfony_route_test
2+
path: /symfony_route_test
33
defaults: { _controller: Test:controller }
44

55
cmf_tree:

composer.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,17 @@
1111
"homepage": "https://github.com/symfony-cmf/TreeBrowserBundle/contributors"
1212
}
1313
],
14-
"minimum-stability": "dev",
1514
"require": {
16-
"php": ">=5.3.3",
17-
"symfony/framework-bundle": "~2.3",
18-
"friendsofsymfony/jsrouting-bundle": "~1.1"
15+
"php": "^5.3.3|^7.0",
16+
"symfony/framework-bundle": "^2.3|^3.0",
17+
"friendsofsymfony/jsrouting-bundle": "^1.1@dev"
1918
},
2019
"require-dev": {
21-
"symfony-cmf/testing": "~1.1"
20+
"symfony-cmf/testing": "^1.3@rc"
2221
},
2322
"suggest": {
24-
"doctrine/phpcr-bundle": "~1.0",
25-
"doctrine/phpcr-odm": "~1.0"
23+
"doctrine/phpcr-bundle": "^1.0",
24+
"doctrine/phpcr-odm": "^1.0"
2625
},
2726
"autoload": {
2827
"psr-4": {
@@ -31,7 +30,7 @@
3130
},
3231
"extra": {
3332
"branch-alias": {
34-
"dev-master": "1.1-dev"
33+
"dev-master": "1.2-dev"
3534
}
3635
}
3736
}

0 commit comments

Comments
 (0)