Skip to content

Commit 43d6188

Browse files
committed
bump dependencies
1 parent ab7a0c9 commit 43d6188

8 files changed

Lines changed: 97 additions & 125 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
include:
13-
- php: 7.4
13+
- php: 8.1
1414
composer-flags: --prefer-lowest
15-
- php: 7.4
16-
SYMFONY_REQUIRE: 5.4.*
17-
- php: 8.0
1815
- php: 8.1
1916
SYMFONY_REQUIRE: 6.4.*
20-
- php: 8.2
21-
SYMFONY_REQUIRE: 7.1.*
22-
- php: 8.3
23-
SYMFONY_REQUIRE: 7.1.*
17+
- php: 8.4
18+
SYMFONY_REQUIRE: 7.3.*
2419
stability: dev
2520

2621
steps:
@@ -62,7 +57,7 @@ jobs:
6257
- name: Setup PHP
6358
uses: shivammathur/setup-php@v2
6459
with:
65-
php-version: "8.2"
60+
php-version: "8.4"
6661

6762
- name: Install dependencies
6863
run: composer update --prefer-dist
@@ -80,7 +75,7 @@ jobs:
8075
- name: Setup PHP
8176
uses: shivammathur/setup-php@v2
8277
with:
83-
php-version: "8.2"
78+
php-version: "8.4"
8479

8580
- name: Install dependencies
8681
run: composer update --prefer-dist

composer.json

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@
1212
}
1313
],
1414
"require": {
15-
"php": "^7.4 || ^8.0",
16-
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.1",
17-
"symfony/twig-bundle": "^5.4 || ^6.4 || ^7.1",
18-
"twig/twig": "^1.35 || ^2.4.4 || ^3.0"
15+
"php": ">=8.1",
16+
"symfony/framework-bundle": "^6.4 || ^7.3",
17+
"symfony/twig-bundle": "^6.4 || ^7.3",
18+
"twig/twig": "^2.4.4 || ^3.0"
1919
},
2020
"require-dev": {
21-
"friendsofphp/php-cs-fixer": "^3.27",
22-
"phpstan/extension-installer": "^1.1",
23-
"phpstan/phpstan": "^1.5",
24-
"phpstan/phpstan-symfony": "^1.0",
25-
"phpunit/phpunit": "^8.5 || ^9.5",
26-
"symfony/browser-kit": "^5.4 || ^6.4 || ^7.1",
27-
"symfony/css-selector": "^5.4 || ^6.4 || ^7.1",
28-
"symfony/expression-language": "^5.4 || ^6.4 || ^7.1",
29-
"symfony/phpunit-bridge": "^7.1",
30-
"symfony/security-bundle": "^5.4 || ^6.4 || ^7.1",
31-
"symfony/yaml": "5.4 || ^6.4 || ^7.1"
21+
"friendsofphp/php-cs-fixer": "^v3.88.2",
22+
"phpstan/extension-installer": "^1.4.3",
23+
"phpstan/phpstan": "^2.1.30",
24+
"phpstan/phpstan-symfony": "^2.0.8",
25+
"phpunit/phpunit": "^10.5.58",
26+
"symfony/browser-kit": "^6.4 || ^7.3",
27+
"symfony/css-selector": "^6.4 || ^7.3",
28+
"symfony/expression-language": "^6.4 || ^7.3",
29+
"symfony/security-bundle": "^6.4 || ^7.3",
30+
"symfony/yaml": "^6.4 || ^7.3"
3231
},
3332
"autoload": {
3433
"psr-4": {

src/NodeVisitor/NodeFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class NodeFilter implements NodeVisitorInterface
2424

2525
public function __construct(
2626
TokenStorageInterface $tokenStorage,
27-
AuthorizationCheckerInterface $authChecker
27+
AuthorizationCheckerInterface $authChecker,
2828
) {
2929
$this->tokenStorage = $tokenStorage;
3030
$this->authChecker = $authChecker;

tests/Functional/AppKernel.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22

33
namespace Tests\Functional;
44

5+
use DAMA\MenuBundle\DAMAMenuBundle;
6+
use Psr\Log\NullLogger;
7+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
8+
use Symfony\Bundle\SecurityBundle\SecurityBundle;
9+
use Symfony\Bundle\TwigBundle\TwigBundle;
510
use Symfony\Component\Config\Loader\LoaderInterface;
11+
use Symfony\Component\DependencyInjection\ContainerBuilder;
612
use Symfony\Component\HttpKernel\Kernel;
713

814
class AppKernel extends Kernel
915
{
1016
public function registerBundles(): iterable
1117
{
1218
return [
13-
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
14-
new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
15-
new \Symfony\Bundle\TwigBundle\TwigBundle(),
16-
new \DAMA\MenuBundle\DAMAMenuBundle(),
19+
new FrameworkBundle(),
20+
new SecurityBundle(),
21+
new TwigBundle(),
22+
new DAMAMenuBundle(),
1723
];
1824
}
1925

@@ -27,4 +33,9 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
2733
$loader->load(__DIR__.'/config.yml');
2834
$loader->load(__DIR__.'/config.php');
2935
}
36+
37+
protected function build(ContainerBuilder $container): void
38+
{
39+
$container->register('logger', NullLogger::class);
40+
}
3041
}

tests/NodeVisitor/NodeActivatorTest.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Tests\NodeVisitor;
46

57
use DAMA\MenuBundle\Node\Node;
68
use DAMA\MenuBundle\NodeVisitor\NodeActivator;
9+
use PHPUnit\Framework\Attributes\DataProvider;
710
use PHPUnit\Framework\TestCase;
11+
use Symfony\Component\HttpFoundation\RequestStack;
812

913
class NodeActivatorTest extends TestCase
1014
{
11-
/**
12-
* @var Node
13-
*/
14-
protected $node;
15+
protected Node $node;
1516

1617
public function setUp(): void
1718
{
1819
$this->node = new Node();
1920
}
2021

21-
/**
22-
* @dataProvider getTestData
23-
*
24-
* @param string $route
25-
*/
26-
public function testVisit($route, array $routes, $requestRoute, $expectedIsActive): void
22+
#[DataProvider('getTestData')]
23+
public function testVisit(?string $route, array $routes, $requestRoute, $expectedIsActive): void
2724
{
2825
$this->node->setRoute($route);
2926
$this->node->setAdditionalActiveRoutes($routes);
@@ -35,7 +32,7 @@ public function testVisit($route, array $routes, $requestRoute, $expectedIsActiv
3532
$this->assertEquals($expectedIsActive, $this->node->isActive());
3633
}
3734

38-
public function getTestData()
35+
public static function getTestData(): array
3936
{
4037
return [
4138
[null, [], 'some_route', false],
@@ -45,13 +42,13 @@ public function getTestData()
4542
];
4643
}
4744

48-
private function getRequestStackMock($requestRoute)
45+
private function getRequestStackMock($requestRoute): RequestStack
4946
{
5047
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
51-
$request->expects($this->any())->method('get')->with('_route')->will($this->returnValue($requestRoute));
48+
$request->expects($this->any())->method('get')->with('_route')->willReturn($requestRoute);
5249

53-
$requestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')->getMock();
54-
$requestStack->expects($this->any())->method('getCurrentRequest')->will($this->returnValue($request));
50+
$requestStack = $this->createMock(RequestStack::class);
51+
$requestStack->expects($this->any())->method('getCurrentRequest')->willReturn($request);
5552

5653
return $requestStack;
5754
}
Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Tests\NodeVisitor;
46

57
use DAMA\MenuBundle\MenuTree\MenuTreeTraverserInterface;
68
use DAMA\MenuBundle\Node\Node;
79
use DAMA\MenuBundle\Node\NodeFactory;
810
use DAMA\MenuBundle\NodeVisitor\NodeFilter;
11+
use PHPUnit\Framework\Attributes\DataProvider;
12+
use PHPUnit\Framework\Attributes\TestWith;
913
use PHPUnit\Framework\MockObject\MockObject;
1014
use PHPUnit\Framework\TestCase;
1115
use Symfony\Component\ExpressionLanguage\Expression;
@@ -15,58 +19,39 @@
1519

1620
class NodeFilterTest extends TestCase
1721
{
18-
/**
19-
* @var NodeFilter
20-
*/
21-
private $filter;
22-
23-
/**
24-
* @var TokenStorageInterface|MockObject
25-
*/
26-
private $tokenStorage;
27-
28-
/**
29-
* @var AuthorizationCheckerInterface|MockObject
30-
*/
31-
private $authChecker;
32-
33-
/**
34-
* @var Node
35-
*/
36-
private $node;
37-
38-
/**
39-
* @var Node|MockObject
40-
*/
41-
private $parent;
22+
private NodeFilter $filter;
23+
private TokenStorageInterface&MockObject $tokenStorage;
24+
private AuthorizationCheckerInterface&MockObject $authChecker;
25+
private Node $node;
26+
private Node&MockObject $parent;
27+
private TokenInterface&MockObject $token;
4228

4329
public function setUp(): void
4430
{
4531
$this->tokenStorage = $this->createMock(TokenStorageInterface::class);
4632
$this->authChecker = $this->createMock(AuthorizationCheckerInterface::class);
4733
$this->filter = new NodeFilter($this->tokenStorage, $this->authChecker);
4834
$this->node = new Node();
49-
$this->parent = $this->getMockBuilder(Node::class)->getMock();
35+
$this->parent = $this->createMock(Node::class);
5036
$this->node->setParent($this->parent);
37+
$this->token = $this->createMock(TokenInterface::class);
5138
}
5239

53-
/**
54-
* @dataProvider getTestData
55-
*/
56-
public function testVisit(array $permissions, $getTokenReturn, $isGrantedReturn, $expectsFiltered): void
40+
#[DataProvider('getTestData')]
41+
public function testVisit(array $permissions, bool $hasToken, $isGrantedReturn, $expectsFiltered): void
5742
{
5843
$this->node->setRequiredPermissions($permissions);
5944

6045
$this->tokenStorage
6146
->expects($this->any())
6247
->method('getToken')
63-
->will($this->returnValue($getTokenReturn))
48+
->willReturn($hasToken ? $this->token : null)
6449
;
6550

6651
$this->authChecker
6752
->expects($this->any())
6853
->method('isGranted')
69-
->will($this->returnValue($isGrantedReturn))
54+
->willReturn($isGrantedReturn)
7055
;
7156

7257
if ($expectsFiltered) {
@@ -84,10 +69,8 @@ public function testVisit(array $permissions, $getTokenReturn, $isGrantedReturn,
8469
}
8570
}
8671

87-
/**
88-
* @testWith [true]
89-
* [false]
90-
*/
72+
#[TestWith([true])]
73+
#[TestWith([false])]
9174
public function testRemoveParentIfNoActiveChildren(bool $remove): void
9275
{
9376
$tree = (new NodeFactory())->create();
@@ -117,14 +100,14 @@ public function testRemoveParentIfNoActiveChildren(bool $remove): void
117100
$this->assertCount($remove ? 0 : 1, $tree->getChildren());
118101
}
119102

120-
public function getTestData()
103+
public static function getTestData(): array
121104
{
122105
return [
123-
[[], $this->createMock(TokenInterface::class), true, false],
124-
[['FOO'], $this->createMock(TokenInterface::class), true, false],
125-
[['FOO'], $this->createMock(TokenInterface::class), false, true],
126-
[['FOO'], null, true, true],
127-
[[new Expression('something')], null, true, true],
106+
[[], true, true, false],
107+
[['FOO'], true, true, false],
108+
[['FOO'], true, false, true],
109+
[['FOO'], false, true, true],
110+
[[new Expression('something')], false, true, true],
128111
];
129112
}
130113
}

tests/NodeVisitor/NodeRoutePropagatorTest.php

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Tests\NodeVisitor;
46

57
use DAMA\MenuBundle\Node\Node;
6-
use DAMA\MenuBundle\NodeVisitor\NodeActivator;
78
use DAMA\MenuBundle\NodeVisitor\NodeRoutePropagator;
9+
use PHPUnit\Framework\Attributes\DataProvider;
810
use PHPUnit\Framework\TestCase;
911

1012
class NodeRoutePropagatorTest extends TestCase
1113
{
12-
/**
13-
* @var NodeActivator
14-
*/
15-
protected $propagator;
16-
17-
/**
18-
* @var Node
19-
*/
20-
protected $node;
21-
22-
/**
23-
* @var Node
24-
*/
25-
protected $parent;
14+
private NodeRoutePropagator $propagator;
15+
private Node $node;
16+
private Node $parent;
2617

2718
public function setUp(): void
2819
{
@@ -32,9 +23,7 @@ public function setUp(): void
3223
$this->parent->addChild($this->node);
3324
}
3425

35-
/**
36-
* @dataProvider getTestData
37-
*/
26+
#[DataProvider('getTestData')]
3827
public function testVisit($childRoute, $parentRoute, $expectedParentRoute): void
3928
{
4029
$this->node->setRoute($childRoute);
@@ -45,7 +34,7 @@ public function testVisit($childRoute, $parentRoute, $expectedParentRoute): void
4534
$this->assertEquals($expectedParentRoute, $this->parent->getRoute());
4635
}
4736

48-
public function getTestData()
37+
public static function getTestData(): array
4938
{
5039
return [
5140
[null, 'some_route', 'some_route'],

0 commit comments

Comments
 (0)