Skip to content
Merged
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions docs/book/v5/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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
4 changes: 2 additions & 2 deletions test/Event/MailEventListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/Event/MailEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion test/Factory/AbstractMailFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/Factory/LogServiceFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 7 additions & 5 deletions test/Factory/MailServiceAbstractFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,6 +26,7 @@
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;

#[AllowMockObjectsWithoutExpectations]
class MailServiceAbstractFactoryTest extends TestCase
{
use CommonTrait;
Expand Down Expand Up @@ -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]);
Expand All @@ -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 {
Expand Down Expand Up @@ -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'],
]);
Expand Down Expand Up @@ -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'],
]);

Expand All @@ -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'],
]);
Expand Down
8 changes: 5 additions & 3 deletions test/Service/MailServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,6 +27,7 @@
use Symfony\Component\Mime\Part\Multipart\MixedPart;
use Symfony\Component\Mime\Part\TextPart;

#[AllowMockObjectsWithoutExpectations]
class MailServiceTest extends TestCase
{
use CommonTrait;
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
Loading