Skip to content

Commit 739965f

Browse files
committed
add support for symfony 5
1 parent 6efb102 commit 739965f

File tree

10 files changed

+34
-35
lines changed

10 files changed

+34
-35
lines changed

.github/workflows/test-application.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- php-version: '7.4'
2828
symfony-version: 4.4.*
2929
test-installation: true
30+
- php-version: '7.4'
31+
symfony-version: 5.0.*
32+
test-installation: true
3033

3134
steps:
3235
- name: Checkout project

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
tests/Fixtures/App/var/
22
composer.lock
33
vendor
4+
.phpunit.result.cache

composer.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,36 @@
1515
],
1616
"require": {
1717
"php": "^7.4",
18-
"symfony/framework-bundle": "^4.4",
19-
"symfony/security-core": "^4.4"
18+
"symfony/framework-bundle": "^4.4 || ^5.0",
19+
"symfony/security-core": "^4.4 || ^5.0"
2020
},
2121
"require-dev": {
2222
"jackalope/jackalope-doctrine-dbal": "^1.3",
23-
"symfony/security-bundle": "^4.4",
24-
"symfony/phpunit-bridge": "^4.4.34",
23+
"symfony/security-bundle": "^4.4 || ^5.0",
24+
"symfony/phpunit-bridge": "^4.4.34 || ^5.0",
2525
"mockery/mockery": "^0.9.4",
2626
"symfony-cmf/routing-bundle": "^2.1.0",
2727
"symfony-cmf/testing": "^4.0.0",
2828
"doctrine/dbal": "^2.5",
2929
"doctrine/doctrine-bundle": "^2.0",
3030
"doctrine/phpcr-odm": "^1.4|^2.0 ",
3131
"doctrine/phpcr-bundle": "^2.3.0",
32-
"symfony/browser-kit": "^4.4",
33-
"symfony/form": "^4.4",
34-
"symfony/monolog-bridge": "^4.4",
32+
"symfony/browser-kit": "^4.4 || ^5.0",
33+
"symfony/form": "^4.4 || ^5.0",
34+
"symfony/monolog-bridge": "^4.4 || ^5.0",
3535
"symfony/monolog-bundle": "^3.0",
36-
"symfony/templating": "^4.4",
37-
"symfony/translation": "^4.4",
38-
"symfony/twig-bundle": "^4.4",
39-
"symfony/validator": "^4.4",
40-
"symfony/yaml": "^4.4",
41-
"symfony/asset": "^4.4"
36+
"symfony/templating": "^4.4 || ^5.0",
37+
"symfony/translation": "^4.4 || ^5.0",
38+
"symfony/twig-bundle": "^4.4 || ^5.0",
39+
"symfony/validator": "^4.4 || ^5.0",
40+
"symfony/yaml": "^4.4 || ^5.0",
41+
"symfony/asset": "^4.4 || ^5.0"
4242
},
4343
"suggest": {
44-
"symfony/twig-bundle": "To get access to the CMF twig extension (^3.3 || ^4.4)",
44+
"symfony/twig-bundle": "To get access to the CMF twig extension (^4.4 || ^5.0)",
4545
"doctrine/phpcr-bundle": "To be able to use the CMF twig extension (^1.0)",
4646
"doctrine/phpcr-odm": "To be able to use the CMF twig extension (^1.0)",
47-
"symfony/security-bundle": "To be able to use the publish workflow system (^3.3 || ^4.4)",
47+
"symfony/security-bundle": "To be able to use the publish workflow system (^4.4 || ^5.0)",
4848
"symfony-cmf/routing": "To be able to use the CMF twig extension functions cmf_prev_linkable/cmf_next_linkable (^2.1)",
4949
"symfony-cmf/routing-bundle": "To be able to enable the publish_workflow_listener (^2.1)",
5050
"symfony-cmf/sonata-admin-integration-bundle": "To provide an admin interface for the PHPCR ODM documents."

src/DependencyInjection/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Configuration implements ConfigurationInterface
2121
*/
2222
public function getConfigTreeBuilder()
2323
{
24-
$treeBuilder = new TreeBuilder();
25-
$rootNode = $treeBuilder->root('cmf_core');
24+
$treeBuilder = new TreeBuilder('cmf_core');
25+
$rootNode = $treeBuilder->getRootNode();
2626

2727
$rootNode
2828
->children()

src/EventListener/PublishWorkflowListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowChecker;
1515
use Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter;
1616
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
17+
use Symfony\Component\HttpKernel\Event\RequestEvent;
1818
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1919
use Symfony\Component\HttpKernel\KernelEvents;
2020

@@ -66,7 +66,7 @@ public function setPublishWorkflowPermission($attribute)
6666
/**
6767
* Handling the request event.
6868
*/
69-
public function onKernelRequest(GetResponseEvent $event)
69+
public function onKernelRequest(RequestEvent $event)
7070
{
7171
$request = $event->getRequest();
7272

src/Form/Type/CheckboxUrlLabelFormType.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Form\FormInterface;
1717
use Symfony\Component\Form\FormView;
1818
use Symfony\Component\OptionsResolver\OptionsResolver;
19-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
2019
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2120
use Symfony\Component\Routing\RouterInterface;
2221

@@ -53,7 +52,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
5352
$routes = $options['routes'];
5453
$paths = [];
5554
foreach ($routes as $key => $route) {
56-
$name = isset($route['name']) ? $route['name'] : null;
55+
$name = isset($route['name']) ? $route['name'] : '';
5756
$parameters = isset($route['parameters']) ? $route['parameters'] : [];
5857
$referenceType = isset($route['referenceType']) ? $route['referenceType'] : UrlGeneratorInterface::ABSOLUTE_PATH;
5958
$paths[$key] = $this->router->generate($name, $parameters, $referenceType);
@@ -62,14 +61,6 @@ public function buildView(FormView $view, FormInterface $form, array $options)
6261
parent::buildView($view, $form, $options);
6362
}
6463

65-
/**
66-
* {@inheritdoc}
67-
*/
68-
public function setDefaultOptions(OptionsResolverInterface $resolver)
69-
{
70-
$this->configureOptions($resolver);
71-
}
72-
7364
public function configureOptions(OptionsResolver $resolver)
7465
{
7566
$resolver->setDefaults([

tests/Fixtures/App/config/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
$loader->import(CMF_TEST_CONFIG_DIR.'/phpcr_odm.php');
1515
$loader->import(__DIR__.'/cmf_core.yml');
1616
$loader->import(__DIR__.'/cmf_routing.yml');
17+
$loader->import(__DIR__.'/config.yml');
1718

1819
$container->loadFromExtension('framework', [
1920
'csrf_protection' => true,

tests/Fixtures/App/config/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# for cmf routing bundle
2+
framework:
3+
property_access: ~
4+
annotations: ~

tests/Functional/PublishWorkflow/PublishWorkflowTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
use Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowChecker;
1717
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase;
1818
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
19-
use Symfony\Component\Security\Core\Role\Role;
20-
use Symfony\Component\Security\Core\SecurityContextInterface;
19+
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
2120

2221
class PublishWorkflowTest extends BaseTestCase
2322
{
2423
/**
25-
* @var SecurityContextInterface
24+
* @var AuthorizationCheckerInterface
2625
*/
2726
private $publishWorkflowChecker;
2827

@@ -67,7 +66,7 @@ public function testIgnoreRoleHas()
6766
->will($this->returnValue(false))
6867
;
6968
$roles = [
70-
new Role('ROLE_CAN_VIEW_NON_PUBLISHED'),
69+
'ROLE_CAN_VIEW_NON_PUBLISHED',
7170
];
7271
$token = new UsernamePasswordToken('test', 'pass', 'testprovider', $roles);
7372
$tokenStorage = $this->getContainer()->get('security.token_storage');
@@ -85,7 +84,7 @@ public function testIgnoreRoleNotHas()
8584
->will($this->returnValue(false))
8685
;
8786
$roles = [
88-
new Role('OTHER_ROLE'),
87+
'OTHER_ROLE',
8988
];
9089
$token = new UsernamePasswordToken('test', 'pass', 'testprovider', $roles);
9190
$tokenStorage = $this->getContainer()->get('security.token_storage');

tests/Functional/Twig/ServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ServiceTest extends BaseTestCase
1818
{
1919
public function testContainer()
2020
{
21-
/** @var \Twig_Environment $twig */
21+
/** @var \Twig\Environment $twig */
2222
$twig = $this->getContainer()->get('twig');
2323
$ext = $twig->getExtension(method_exists($twig, 'getRuntime') ? CmfExtension::class : 'cmf');
2424
$this->assertNotEmpty($ext);

0 commit comments

Comments
 (0)