From 9de974d5dee4af79cc9821b55c33576bdea1233f Mon Sep 17 00:00:00 2001 From: OStefan2001 Date: Fri, 27 Nov 2026 11:32:14 +0200 Subject: [PATCH 1/2] updated codebase, composer, workflow and tests --- .github/workflows/codecov.yml | 8 ++++---- .github/workflows/static-analysis.yml | 6 +++--- composer.json | 4 ++-- phpunit.xml | 2 +- test/Event/MailEventListenerTest.php | 4 ++-- test/Event/MailEventTest.php | 8 ++++---- test/Factory/AbstractMailFactoryTest.php | 2 +- test/Factory/LogServiceFactoryTest.php | 2 +- test/Factory/MailServiceAbstractFactoryTest.php | 12 +++++++----- test/Service/MailServiceTest.php | 8 +++++--- 10 files changed, 30 insertions(+), 26 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index c0fbc53..9652006 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -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 @@ -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') }} @@ -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 }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 9976515..2763b9c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -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 @@ -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') }} diff --git a/composer.json b/composer.json index 033d71b..eeb26c1 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,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", "ext-fileinfo": "*", "ext-json": "*", "dotkernel/dot-event": "^4.0", @@ -39,7 +39,7 @@ "mikey179/vfsstream": "^v1.6.11", "phpstan/phpstan": "^2.1", "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^10.2" + "phpunit/phpunit": "^12.5.22" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index dfd062d..e420dd2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ diff --git a/test/Event/MailEventListenerTest.php b/test/Event/MailEventListenerTest.php index 3c357e8..48156f4 100644 --- a/test/Event/MailEventListenerTest.php +++ b/test/Event/MailEventListenerTest.php @@ -22,8 +22,8 @@ public function testListenerDetachingAndClearing(): void $trait = new class { use MailEventListenerAwareTrait; }; - $listener1 = $this->createMock(MailEventListenerInterface::class); - $listener2 = $this->createMock(MailEventListenerInterface::class); + $listener1 = $this->createStub(MailEventListenerInterface::class); + $listener2 = $this->createStub(MailEventListenerInterface::class); $trait->attachListener($listener1, 10); $trait->attachListener($listener2); diff --git a/test/Event/MailEventTest.php b/test/Event/MailEventTest.php index d6323be..f2a19f9 100644 --- a/test/Event/MailEventTest.php +++ b/test/Event/MailEventTest.php @@ -7,19 +7,19 @@ use Dot\Mail\Event\MailEvent; use Dot\Mail\Service\MailServiceInterface; use PHPUnit\Framework\MockObject\Exception; -use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\MockObject\Stub; use PHPUnit\Framework\TestCase; class MailEventTest extends TestCase { - private MailServiceInterface|MockObject $mailService; + private MailServiceInterface|Stub $mailService; /** * @throws Exception */ public function setUp(): void { - $this->mailService = $this->createMock(MailServiceInterface::class); + $this->mailService = $this->createStub(MailServiceInterface::class); } /** @@ -33,7 +33,7 @@ public function testMailEventCanBeCreated(): void $this->assertContainsOnlyInstancesOf(MailServiceInterface::class, [$defaultMailEvent->getMailService()]); $customMailEvent = new MailEvent($this->mailService, MailEvent::EVENT_MAIL_SEND_ERROR); - $mailServiceInterface = $this->createMock(MailServiceInterface::class); + $mailServiceInterface = $this->createStub(MailServiceInterface::class); $customMailEvent->setMailService($mailServiceInterface); $this->assertContainsOnlyInstancesOf(MailEvent::class, [$customMailEvent]); diff --git a/test/Factory/AbstractMailFactoryTest.php b/test/Factory/AbstractMailFactoryTest.php index 40bc367..3e4e9ad 100644 --- a/test/Factory/AbstractMailFactoryTest.php +++ b/test/Factory/AbstractMailFactoryTest.php @@ -71,7 +71,7 @@ public function testCanCreateRequestedService(): void */ public function testWillNotCreateRequestedNameFromWrongParts(): void { - $container = $this->createMock(ContainerInterface::class); + $container = $this->createStub(ContainerInterface::class); $requestedName = 'dot-mail.testPart.default.test'; $result = $this->subject->canCreate($container, $requestedName); diff --git a/test/Factory/LogServiceFactoryTest.php b/test/Factory/LogServiceFactoryTest.php index 279a524..d38f455 100644 --- a/test/Factory/LogServiceFactoryTest.php +++ b/test/Factory/LogServiceFactoryTest.php @@ -22,7 +22,7 @@ class LogServiceFactoryTest extends TestCase */ public function testServiceCreatedWithoutValidConfig(): void { - $message = $this->createMock(Email::class); + $message = $this->createStub(Email::class); $container = $this->createMock(ContainerInterface::class); $logService = (new LogServiceFactory())($container); diff --git a/test/Factory/MailServiceAbstractFactoryTest.php b/test/Factory/MailServiceAbstractFactoryTest.php index 34177f2..e281149 100644 --- a/test/Factory/MailServiceAbstractFactoryTest.php +++ b/test/Factory/MailServiceAbstractFactoryTest.php @@ -17,6 +17,7 @@ use Dot\Mail\Service\MailService; use DotTest\Mail\CommonTrait; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations; use PHPUnit\Framework\MockObject\Exception; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -25,6 +26,7 @@ use Psr\Container\NotFoundExceptionInterface; use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport; +#[AllowMockObjectsWithoutExpectations] class MailServiceAbstractFactoryTest extends TestCase { use CommonTrait; @@ -91,7 +93,7 @@ public function testGenerateServiceWithProvidedAdapter(): void ->willReturn($this->messageOptions); $this->mailOptions->expects($this->any()) ->method('getTransport') - ->willReturn($this->createMock(EsmtpTransport::class)); + ->willReturn($this->createStub(EsmtpTransport::class)); $this->mailOptions->expects($this->any()) ->method('getEventListeners') ->willReturn([AbstractMailEventListener::class]); @@ -100,7 +102,7 @@ public function testGenerateServiceWithProvidedAdapter(): void ->method('get') ->willReturnMap([ ['dot-mail.options.default', $this->mailOptions], - [LogServiceInterface::class, $this->createMock(LogService::class)], + [LogServiceInterface::class, $this->createStub(LogService::class)], [ AbstractMailEventListener::class, new class extends AbstractMailEventListener { @@ -168,7 +170,7 @@ public function testGenerateServiceWithoutProvidedAdapter(): void ->method('get') ->willReturnMap([ ['dot-mail.options.default', $this->mailOptions], - [LogServiceInterface::class, $this->createMock(LogService::class)], + [LogServiceInterface::class, $this->createStub(LogService::class)], [EsmtpTransport::class, new EsmtpTransport()], ['Invalid Listener Test', 'Invalid Listener provided'], ]); @@ -221,7 +223,7 @@ public function testGenerateServiceInvalidAdapter(): void ->method('get') ->willReturnMap([ ['dot-mail.options.default', $this->mailOptions], - [LogServiceInterface::class, $this->createMock(LogService::class)], + [LogServiceInterface::class, $this->createStub(LogService::class)], ['Invalid Listener Test', 'Invalid Listener provided'], ]); @@ -246,7 +248,7 @@ public function testGenerateServiceThrowException(): void ->method('get') ->willReturnMap([ ['dot-mail.options.default', $this->mailOptions], - [LogServiceInterface::class, $this->createMock(LogService::class)], + [LogServiceInterface::class, $this->createStub(LogService::class)], [EsmtpTransport::class, new EsmtpTransport()], ['Invalid Listener Test', 'Invalid Listener provided'], ]); diff --git a/test/Service/MailServiceTest.php b/test/Service/MailServiceTest.php index 685711f..9950b14 100644 --- a/test/Service/MailServiceTest.php +++ b/test/Service/MailServiceTest.php @@ -14,6 +14,7 @@ use Dot\Mail\Service\MailService; use DotTest\Mail\CommonTrait; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations; use PHPUnit\Framework\MockObject\Exception; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -26,6 +27,7 @@ use Symfony\Component\Mime\Part\Multipart\MixedPart; use Symfony\Component\Mime\Part\TextPart; +#[AllowMockObjectsWithoutExpectations] class MailServiceTest extends TestCase { use CommonTrait; @@ -41,8 +43,8 @@ public function setUp(): void { $this->message = new Email(); $this->transportInterface = $this->createMock(TransportInterface::class); - $mailOptions = $this->createMock(MailOptions::class); - $logServiceInterface = $this->createMock(LogServiceInterface::class); + $mailOptions = $this->createStub(MailOptions::class); + $logServiceInterface = $this->createStub(LogServiceInterface::class); $this->mailService = new MailService( $logServiceInterface, @@ -73,7 +75,7 @@ public function setUp(): void public function testGettersAndSetters(): void { $attachments = ['/testAttachment.pdf', '/testDirectory/testAttachment2.xls']; - $transport = $this->createMock(EsmtpTransport::class); + $transport = $this->createStub(EsmtpTransport::class); $this->mailService->setAttachments($attachments); $this->mailService->setTransport($transport); From d7fba8878af8c41e9782fd6b781a15c3de0b8178 Mon Sep 17 00:00:00 2001 From: OStefan2001 Date: Fri, 27 Nov 2026 15:14:59 +0200 Subject: [PATCH 2/2] updated overview and readme, --- README.md | 4 ++-- docs/book/v5/overview.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f3913d7..d104c78 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ Documentation is available at: https://docs.dotkernel.org/dot-mail/. [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/stargazers) [![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/5.2/LICENSE.md) -[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.2)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.x)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-mail/branch/5.2/graph/badge.svg?token=G51NEHYKD3)](https://codecov.io/gh/dotkernel/dot-mail) -[![PHPStan](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml/badge.svg?branch=5.2)](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml) +[![PHPStan](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml/badge.svg?branch=5.x)](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml) ## Installation diff --git a/docs/book/v5/overview.md b/docs/book/v5/overview.md index 4722792..115b154 100644 --- a/docs/book/v5/overview.md +++ b/docs/book/v5/overview.md @@ -23,9 +23,9 @@ Dotkernel's mail service. [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/stargazers) [![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/5.2/LICENSE.md) -[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.2)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.x)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-mail/branch/5.2/graph/badge.svg?token=G51NEHYKD3)](https://codecov.io/gh/dotkernel/dot-mail) -[![PHPStan](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml/badge.svg?branch=5.2)](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml) +[![PHPStan](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml/badge.svg?branch=5.x)](https://github.com/dotkernel/dot-mail/actions/workflows/static-analysis.yml) ## Extra features