Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
- ubuntu-latest

php:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
- "8.6"

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v7

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -36,7 +36,7 @@ jobs:
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v3
uses: actions/cache@v6
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -50,6 +50,6 @@ jobs:
run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml

- name: Send code coverage report to Codecov.io
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
- ubuntu-latest

php:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
- "8.6"

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -36,7 +36,7 @@ jobs:
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
},
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0",
"dotkernel/dot-authorization": "^3.4.1",
"dotkernel/dot-helpers": "^3.7.0",
"laminas/laminas-escaper": "^2.13.0",
Expand All @@ -37,7 +37,7 @@
"laminas/laminas-coding-standard": "^3.0.0",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10.4.2"
"phpunit/phpunit": "^12.5.22"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
bootstrap="./vendor/autoload.php"
colors="true">
<testsuites>
Expand Down
2 changes: 1 addition & 1 deletion test/Factory/NavigationMiddlewareFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testWillNotCreateMiddlewareWithoutNavigationInterface(): void
public function testWillCreateMiddleware(): void
{
$container = $this->createMock(ContainerInterface::class);
$navigation = $this->createMock(NavigationInterface::class);
$navigation = $this->createStub(NavigationInterface::class);

$container->expects($this->once())
->method('has')
Expand Down
12 changes: 6 additions & 6 deletions test/Factory/NavigationRendererFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testWillNotCreateNavigationRendererWithoutNavigationInterface():
*/
public function testWillNotCreateNavigationRendererWithoutTemplateRendererInterface(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$container->method('has')->willReturnMap([
[NavigationInterface::class, true],
Expand All @@ -60,7 +60,7 @@ public function testWillNotCreateNavigationRendererWithoutTemplateRendererInterf
*/
public function testWillNotCreateNavigationRendererWithoutNavigationOptions(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$container->method('has')->willReturnMap([
[NavigationInterface::class, true],
Expand All @@ -79,10 +79,10 @@ public function testWillNotCreateNavigationRendererWithoutNavigationOptions(): v
*/
public function testWillNotCreateNavigationRenderer(): void
{
$container = $this->createMock(ContainerInterface::class);
$navigation = $this->createMock(NavigationInterface::class);
$renderer = $this->createMock(TemplateRendererInterface::class);
$options = $this->createMock(NavigationOptions::class);
$container = $this->createStub(ContainerInterface::class);
$navigation = $this->createStub(NavigationInterface::class);
$renderer = $this->createStub(TemplateRendererInterface::class);
$options = $this->createStub(NavigationOptions::class);

$container->method('has')->willReturnMap([
[NavigationInterface::class, true],
Expand Down
22 changes: 11 additions & 11 deletions test/Factory/NavigationServiceFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function testWillNotCreateNavigationServiceWithoutRouteHelper(): void
*/
public function testWillNotCreateNavigationServiceWithoutProviderPluginManager(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$container->method('has')->willReturnMap([
[RouteHelper::class, true],
Expand All @@ -62,7 +62,7 @@ public function testWillNotCreateNavigationServiceWithoutProviderPluginManager()
*/
public function testWillNotCreateNavigationServiceWithoutNavigationOptions(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$container->method('has')->willReturnMap([
[RouteHelper::class, true],
Expand All @@ -81,10 +81,10 @@ public function testWillNotCreateNavigationServiceWithoutNavigationOptions(): vo
*/
public function testWillCreateNavigationServiceWithoutAuthorizationInterface(): void
{
$container = $this->createMock(ContainerInterface::class);
$navigation = $this->createMock(RouteHelper::class);
$renderer = $this->createMock(TemplateRendererInterface::class);
$options = $this->createMock(NavigationOptions::class);
$container = $this->createStub(ContainerInterface::class);
$navigation = $this->createStub(RouteHelper::class);
$renderer = $this->createStub(TemplateRendererInterface::class);
$options = $this->createStub(NavigationOptions::class);

$container->method('has')->willReturnMap([
[RouteHelper::class, true],
Expand All @@ -111,11 +111,11 @@ public function testWillCreateNavigationServiceWithoutAuthorizationInterface():
*/
public function testWillCreateNavigationServiceWithAuthorizationInterface(): void
{
$container = $this->createMock(ContainerInterface::class);
$navigation = $this->createMock(RouteHelper::class);
$renderer = $this->createMock(TemplateRendererInterface::class);
$options = $this->createMock(NavigationOptions::class);
$authorization = $this->createMock(AuthorizationInterface::class);
$container = $this->createStub(ContainerInterface::class);
$navigation = $this->createStub(RouteHelper::class);
$renderer = $this->createStub(TemplateRendererInterface::class);
$options = $this->createStub(NavigationOptions::class);
$authorization = $this->createStub(AuthorizationInterface::class);

$container->method('has')->willReturnMap([
[RouteHelper::class, true],
Expand Down
25 changes: 14 additions & 11 deletions test/Filter/IsAllowedFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Dot\Navigation\Provider\FactoryInterface;
use Dot\Navigation\Service\Navigation;
use Dot\Navigation\Service\NavigationInterface;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\TestCase;
use RecursiveIterator;
Expand All @@ -22,12 +23,13 @@ class IsAllowedFilterTest extends TestCase
/**
* @throws Exception
*/
#[AllowMockObjectsWithoutExpectations]
public function testWillAcceptWithoutAuthorization(): void
{
$iterator = $this->createMock(RecursiveIterator::class);
$factory = $this->createMock(FactoryInterface::class);
$route = $this->createMock(RouteHelper::class);
$options = $this->createMock(NavigationOptions::class);
$iterator = $this->createStub(RecursiveIterator::class);
$factory = $this->createStub(FactoryInterface::class);
$route = $this->createStub(RouteHelper::class);
$options = $this->createStub(NavigationOptions::class);

$navigation = new Navigation($factory, $route, $options, null);
$filter = $this->getMockBuilder(IsAllowedFilter::class)
Expand All @@ -42,12 +44,13 @@ public function testWillAcceptWithoutAuthorization(): void
/**
* @throws Exception
*/
#[AllowMockObjectsWithoutExpectations]
public function testWillAcceptWithAuthorization(): void
{
$iterator = $this->createMock(RecursiveIterator::class);
$factory = $this->createMock(FactoryInterface::class);
$route = $this->createMock(RouteHelper::class);
$options = $this->createMock(NavigationOptions::class);
$iterator = $this->createStub(RecursiveIterator::class);
$factory = $this->createStub(FactoryInterface::class);
$route = $this->createStub(RouteHelper::class);
$options = $this->createStub(NavigationOptions::class);
$authorization = $this->createMock(AuthorizationInterface::class);

$authorization->expects($this->once())->method('isGranted')->willReturn(true);
Expand All @@ -71,7 +74,7 @@ public function testWillAcceptWithAuthorization(): void
*/
public function testGetChildren(): void
{
$navigation = $this->createMock(NavigationInterface::class);
$navigation = $this->createStub(NavigationInterface::class);

$filter = new IsAllowedFilter(new NavigationContainer([new Page()]), $navigation);
$this->assertSame(IsAllowedFilter::class, $filter->getChildren()::class);
Expand All @@ -82,8 +85,8 @@ public function testGetChildren(): void
*/
public function testWillCreateFilter(): void
{
$iterator = $this->createMock(RecursiveIterator::class);
$navigation = $this->createMock(NavigationInterface::class);
$iterator = $this->createStub(RecursiveIterator::class);
$navigation = $this->createStub(NavigationInterface::class);

$filter = new IsAllowedFilter($iterator, $navigation);
$this->assertSame(IsAllowedFilter::class, $filter::class);
Expand Down
8 changes: 4 additions & 4 deletions test/NavigationMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class NavigationMiddlewareTest extends TestCase
*/
public function testWillCreateMiddleware(): void
{
$navigation = $this->createMock(NavigationInterface::class);
$navigation = $this->createStub(NavigationInterface::class);

$middleware = new NavigationMiddleware($navigation);
$this->assertSame(NavigationMiddleware::class, $middleware::class);
Expand All @@ -30,9 +30,9 @@ public function testWillCreateMiddleware(): void
*/
public function testWillProcessRequest(): void
{
$navigation = $this->createMock(NavigationInterface::class);
$request = $this->createMock(ServerRequestInterface::class);
$handler = $this->createMock(RequestHandlerInterface::class);
$navigation = $this->createStub(NavigationInterface::class);
$request = $this->createStub(ServerRequestInterface::class);
$handler = $this->createStub(RequestHandlerInterface::class);

$middleware = new NavigationMiddleware($navigation);
$response = $middleware->process($request, $handler);
Expand Down
20 changes: 10 additions & 10 deletions test/Provider/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FactoryTest extends TestCase
*/
public function testWillCreateFactoryWithoutProviderPluginManager(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$factory = new Factory($container);
$this->assertSame(Factory::class, $factory::class);
Expand All @@ -33,8 +33,8 @@ public function testWillCreateFactoryWithoutProviderPluginManager(): void
*/
public function testWillCreateFactoryWithProviderPluginManager(): void
{
$container = $this->createMock(ContainerInterface::class);
$manager = $this->createMock(ProviderPluginManager::class);
$container = $this->createStub(ContainerInterface::class);
$manager = $this->createStub(ProviderPluginManager::class);

$factory = new Factory($container, $manager);
$this->assertSame(Factory::class, $factory::class);
Expand All @@ -46,7 +46,7 @@ public function testWillCreateFactoryWithProviderPluginManager(): void
*/
public function testFactoryWillNotCreateProviderWithoutProviderType(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Undefined navigation provider type');
Expand All @@ -60,7 +60,7 @@ public function testFactoryWillNotCreateProviderWithoutProviderType(): void
*/
public function testFactoryWillNotCreateProviderWithInvalidProviderType(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$this->expectException(ServiceNotFoundException::class);
$this->expectExceptionMessage(
Expand All @@ -78,7 +78,7 @@ public function testFactoryWillNotCreateProviderWithInvalidProviderType(): void
*/
public function testFactoryWillCreateProviderWithValidProviderTypeAndNoOptions(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$factory = new Factory($container);
$provider = $factory->create([
Expand All @@ -93,7 +93,7 @@ public function testFactoryWillCreateProviderWithValidProviderTypeAndNoOptions()
*/
public function testFactoryWillCreateProviderWithValidProviderTypeAndOptions(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$factory = new Factory($container);
$provider = $factory->create([
Expand All @@ -108,7 +108,7 @@ public function testFactoryWillCreateProviderWithValidProviderTypeAndOptions():
*/
public function testFactoryWillGetProviderPluginManagerWithoutInitialProviderPluginManager(): void
{
$container = $this->createMock(ContainerInterface::class);
$container = $this->createStub(ContainerInterface::class);

$factory = new Factory($container);
$this->assertSame(ProviderPluginManager::class, $factory->getProviderPluginManager()::class);
Expand All @@ -119,8 +119,8 @@ public function testFactoryWillGetProviderPluginManagerWithoutInitialProviderPlu
*/
public function testFactoryWillGetProviderPluginManagerWithInitialProviderPluginManager(): void
{
$container = $this->createMock(ContainerInterface::class);
$manager = $this->createMock(ProviderPluginManager::class);
$container = $this->createStub(ContainerInterface::class);
$manager = $this->createStub(ProviderPluginManager::class);

$factory = new Factory($container, $manager);
$this->assertContainsOnlyInstancesOf(ProviderPluginManager::class, [$factory->getProviderPluginManager()]);
Expand Down
Loading
Loading