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 @@ -49,6 +49,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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Documentation is available at: https://docs.dotkernel.org/dot-controller/.
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-controller)](https://github.com/dotkernel/dot-controller/stargazers)
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-controller)](https://github.com/dotkernel/dot-controller/blob/4.0/LICENSE.md)

[![Build Static](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml)
[![Build Static](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml/badge.svg?branch=4.x)](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml)
[![codecov](https://codecov.io/gh/dotkernel/dot-controller/graph/badge.svg?token=VUBG5LM4CK)](https://codecov.io/gh/dotkernel/dot-controller)
[![PHPStan](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml)
[![PHPStan](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml/badge.svg?branch=4.x)](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml)

## Installation

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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-event": "^4.0.0",
"laminas/laminas-servicemanager": "^4.0",
"mezzio/mezzio-helpers": "^5.8.0",
Expand All @@ -30,7 +30,7 @@
"laminas/laminas-diactoros": "^3.0",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^10.2"
"phpunit/phpunit": "^12.5.22"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions docs/book/v4/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ It is more lightweight, though, but supports controller plugins and event listen
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-controller)](https://github.com/dotkernel/dot-controller/stargazers)
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-controller)](https://github.com/dotkernel/dot-controller/blob/4.0/LICENSE.md)

[![Build Static](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml)
[![Build Static](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml/badge.svg?branch=4.x)](https://github.com/dotkernel/dot-controller/actions/workflows/continuous-integration.yml)
[![codecov](https://codecov.io/gh/dotkernel/dot-controller/graph/badge.svg?token=VUBG5LM4CK)](https://codecov.io/gh/dotkernel/dot-controller)
[![PHPStan](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml)
[![PHPStan](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml/badge.svg?branch=4.x)](https://github.com/dotkernel/dot-controller/actions/workflows/static-analysis.yml)
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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" bootstrap="./vendor/autoload.php" colors="true">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd" bootstrap="./vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="dot-controller Test Suite">
<directory>./test</directory>
Expand Down
4 changes: 2 additions & 2 deletions test/AbstractActionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AbstractActionControllerTest extends TestCase
public function testNonExistingActionWillReturnResponse(): void
{
$request = $this->createMock(ServerRequestInterface::class);
$handler = $this->createMock(RequestHandlerInterface::class);
$handler = $this->createStub(RequestHandlerInterface::class);

$request->expects($this->any())->method('getAttribute')->withAnyParameters()->willReturn('test');

Expand All @@ -37,7 +37,7 @@ public function testNonExistingActionWillReturnResponse(): void
public function testExistingActionWillReturnResponse(): void
{
$request = $this->createMock(ServerRequestInterface::class);
$handler = $this->createMock(RequestHandlerInterface::class);
$handler = $this->createStub(RequestHandlerInterface::class);

$request->expects($this->any())->method('getAttribute')->withAnyParameters()->willReturn('index');

Expand Down
8 changes: 5 additions & 3 deletions test/AbstractControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
use Dot\Controller\Plugin\PluginInterface;
use Dot\Controller\Plugin\PluginManager;
use Laminas\Diactoros\Response;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

#[AllowMockObjectsWithoutExpectations]
class AbstractControllerTest extends TestCase
{
private PluginManager|MockObject $pluginManager;
Expand All @@ -30,9 +32,9 @@ class AbstractControllerTest extends TestCase
public function setUp(): void
{
$this->pluginManager = $this->createMock(PluginManager::class);
$this->plugin = $this->createMock(PluginInterface::class);
$this->request = $this->createMock(ServerRequestInterface::class);
$this->handler = $this->createMock(RequestHandlerInterface::class);
$this->plugin = $this->createStub(PluginInterface::class);
$this->request = $this->createStub(ServerRequestInterface::class);
$this->handler = $this->createStub(RequestHandlerInterface::class);
$this->subject = new class extends Subject {
public function dispatch(): ResponseInterface
{
Expand Down
10 changes: 5 additions & 5 deletions test/Factory/ControllerEventListenersInitializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Laminas\EventManager\EventManager;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Stub;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
Expand All @@ -18,7 +19,7 @@
class ControllerEventListenersInitializerTest extends TestCase
{
private ContainerInterface|MockObject $container;
private AbstractController|MockObject $controller;
private AbstractController|Stub $controller;
private EventManager|MockObject $eventManager;
private Subject $subject;

Expand All @@ -28,7 +29,7 @@ class ControllerEventListenersInitializerTest extends TestCase
public function setUp(): void
{
$this->container = $this->createMock(ContainerInterface::class);
$this->controller = $this->createMock(AbstractController::class);
$this->controller = $this->createStub(AbstractController::class);
$this->eventManager = $this->createMock(EventManager::class);
$this->subject = new Subject();
}
Expand Down Expand Up @@ -61,8 +62,8 @@ public function testAttachControllerListeners(): void
]);

$this->container->method('get')->willReturnMap([
['ListenerClass1', $this->createMock(ControllerEventListenerInterface::class)],
['ListenerClass2', $this->createMock(ControllerEventListenerInterface::class)],
['ListenerClass1', $this->createStub(ControllerEventListenerInterface::class)],
['ListenerClass2', $this->createStub(ControllerEventListenerInterface::class)],
]);

$this->controller->method('getEventManager')->willReturn($this->eventManager);
Expand All @@ -72,7 +73,6 @@ public function testAttachControllerListeners(): void
$this->eventManager->expects($this->any())->method('attach')
->with($this->isInstanceOf(ControllerEventListenerInterface::class), 1);

$this->expectNotToPerformAssertions();
$this->subject->attachControllerListeners($this->container, $this->controller);
}
}
4 changes: 3 additions & 1 deletion test/Factory/PluginManagerAwareInitializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Dot\Controller\Plugin\PluginManager;
use Dot\Controller\Plugin\PluginManagerAwareInterface;
use Laminas\Diactoros\Response;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -30,7 +31,7 @@ public function setUp(): void
{
$this->subject = new Subject();
$this->container = $this->createMock(ContainerInterface::class);
$this->pluginManager = $this->createMock(PluginManager::class);
$this->pluginManager = $this->createStub(PluginManager::class);
}

/**
Expand Down Expand Up @@ -58,6 +59,7 @@ public function testInvokeSetsPluginManagerWhenInstanceIsPluginManagerAwareInter
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[AllowMockObjectsWithoutExpectations]
public function testInvokeSetsDebugFlagWhenInstanceIsAbstractController(): void
{
$this->container->method('get')
Expand Down
6 changes: 3 additions & 3 deletions test/Factory/PluginManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class PluginManagerFactoryTest extends TestCase
public function setUp(): void
{
$this->subject = new Subject();
$this->container = $this->createMock(ContainerInterface::class);
$this->templateRenderer = $this->createMock(TemplateRendererInterface::class);
$this->urlHelper = $this->createMock(UrlHelper::class);
$this->container = $this->createStub(ContainerInterface::class);
$this->templateRenderer = $this->createStub(TemplateRendererInterface::class);
$this->urlHelper = $this->createStub(UrlHelper::class);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/Plugin/PluginManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PluginManagerTest extends TestCase
*/
protected function setup(): void
{
$this->container = $this->createMock(ContainerInterface::class);
$this->container = $this->createStub(ContainerInterface::class);
$this->subject = new Subject($this->container);
}

Expand All @@ -33,7 +33,7 @@ protected function setup(): void
*/
public function testInstanceOf(): void
{
$plugin = $this->createMock(PluginInterface::class);
$plugin = $this->createStub(PluginInterface::class);
$this->expectNotToPerformAssertions();
$this->subject->validate($plugin);
}
Expand Down
2 changes: 2 additions & 0 deletions test/Plugin/TemplatePluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Dot\Controller\Plugin\TemplatePlugin as Subject;
use Mezzio\Template\TemplateRendererInterface;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -24,6 +25,7 @@ protected function setup(): void
$this->subject = new Subject($this->templateRenderer);
}

#[AllowMockObjectsWithoutExpectations]
public function testInvokeWithoutArguments(): void
{
$result = $this->subject->__invoke();
Expand Down
2 changes: 2 additions & 0 deletions test/Plugin/UrlHelperPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Dot\Controller\Plugin\UrlHelperPlugin as Subject;
use Mezzio\Helper\UrlHelper;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -24,6 +25,7 @@ public function setUp(): void
$this->subject = new Subject($this->urlHelper);
}

#[AllowMockObjectsWithoutExpectations]
public function testInvokeWithoutArguments(): void
{
$result = $this->subject->__invoke();
Expand Down
Loading