Skip to content
Merged

5.1.0 #143

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
50 changes: 25 additions & 25 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,39 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.0, 8.1, 8.2]
laravel: ['8.*', '9.*', '10.*', '11.*', '12.*']
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
laravel: ['10.*', '11.*', '12.*', '13.*']
stability: [prefer-stable]
exclude:
- php: 8.0
laravel: 10.*
- php: 8.2
laravel: 8.*
- laravel: 11.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 12.*
php: 8.0
- laravel: 12.*
php: 8.1
- laravel: '10.*'
php: '8.4'
- laravel: '10.*'
php: '8.5'
- laravel: '11.*'
php: '8.1'
- laravel: '11.*'
php: '8.5'
- laravel: '12.*'
php: '8.1'
- laravel: '13.*'
php: '8.1'
- laravel: '13.*'
php: '8.2'
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 8.*
testbench: 6.23
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: 10.*
- laravel: '10.*'
testbench: '8.*'
- laravel: '11.*'
testbench: '9.*'
- laravel: '12.*'
testbench: '10.*'
- laravel: '13.*'
testbench: '11.*'

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ The email service organizes emails into distinct inboxes for each application, e

![image](https://github.com/user-attachments/assets/6417907c-119d-43ac-9cf6-5638bafae24f)

## Testing

### Testing
Inbound messages are parsed with [zbateson/mail-mime-parser](https://mail-mime-parser.org) (see the docs on [handling inbound email](https://docs.beyondco.de/laravel-mailbox/basic-usage/handling)). Run the package test suite with:

``` bash
```bash
composer test
```

### Changelog
## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Expand Down
19 changes: 9 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,19 @@
}
],
"require": {
"php": "^8.0",
"illuminate/container": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/log": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"php": "^8.1",
"illuminate/container": "^10.0|^11.0|^12.0|^13.0",
"illuminate/database": "^10.0|^11.0|^12.0|^13.0",
"illuminate/log": "^10.0|^11.0|^12.0|^13.0",
"illuminate/routing": "^10.0|^11.0|^12.0|^13.0",
"illuminate/support": "^10.0|^11.0|^12.0|^13.0",
"willdurand/email-reply-parser": "^2.8",
"zbateson/mail-mime-parser": "^1.1|^2.4|^3.0"
"zbateson/mail-mime-parser": "^2.4|^3.0|^4.0"
},
"require-dev": {
"laminas/laminas-mail": "^2.13",
"mockery/mockery": "^1.2",
"orchestra/testbench": "^4.0|^5.0|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^7.0|^8.0|^9.3|^10.5|^11.5.3"
"orchestra/testbench": "^8.0|^9.0|^10.0|^11.0",
"phpunit/phpunit": "^10.5|^11.0|^12.0"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 3 additions & 2 deletions tests/Console/CleanEmailsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use PHPUnit\Framework\Attributes\Test;

class CleanEmailsTest extends TestCase
{
Expand All @@ -20,7 +21,7 @@ public function setUp(): void
$this->app['config']->set('mailbox.store_incoming_emails_for_days', 31);
}

/** @test */
#[Test]
public function it_can_clean_the_statistics()
{
Collection::times(200)->each(function (int $index) {
Expand All @@ -41,7 +42,7 @@ public function it_can_clean_the_statistics()
$this->assertCount(0, InboundEmail::where('created_at', '<', $cutOffDate)->get());
}

/** @test */
#[Test]
public function it_errors_if_max_age_inf()
{
$this->app['config']->set('mailbox.store_incoming_emails_for_days', INF);
Expand Down
5 changes: 3 additions & 2 deletions tests/Controllers/MailgunTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace BeyondCode\Mailbox\Tests\Controllers;

use BeyondCode\Mailbox\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class MailgunTest extends TestCase
{
Expand All @@ -13,7 +14,7 @@ protected function getEnvironmentSetUp($app)
$app['config']['mailbox.driver'] = 'mailgun';
}

/** @test */
#[Test]
public function it_verifies_mailgun_signatures()
{
$this->post('/laravel-mailbox/mailgun/mime', [
Expand All @@ -38,7 +39,7 @@ public function it_verifies_mailgun_signatures()
])->assertStatus(200);
}

/** @test */
#[Test]
public function it_verifies_fresh_timestamps()
{
$timestamp = now()->subMinutes(5)->timestamp;
Expand Down
3 changes: 2 additions & 1 deletion tests/Controllers/PostmarkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace BeyondCode\Mailbox\Tests\Controllers;

use BeyondCode\Mailbox\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class PostmarkTest extends TestCase
{
Expand All @@ -13,7 +14,7 @@ protected function getEnvironmentSetUp($app)
$app['config']['mailbox.driver'] = 'postmark';
}

/** @test */
#[Test]
public function it_expects_to_receive_raw_email_field()
{
$this->withoutMiddleware();
Expand Down
3 changes: 2 additions & 1 deletion tests/Drivers/LogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use BeyondCode\Mailbox\Tests\TestCase;
use Illuminate\Mail\Mailable;
use Illuminate\Support\Facades\Mail;
use PHPUnit\Framework\Attributes\Test;

class LogTest extends TestCase
{
Expand All @@ -18,7 +19,7 @@ protected function getEnvironmentSetUp($app)
$app['config']['mailbox.driver'] = 'log';
}

/** @test */
#[Test]
public function it_catches_logged_mails()
{
Mailbox::from('{name}@beyondco.de', function (InboundEmail $email, $name) {
Expand Down
21 changes: 11 additions & 10 deletions tests/InboundEmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use BeyondCode\Mailbox\InboundEmail;
use Illuminate\Mail\Mailable;
use Illuminate\Support\Facades\Mail;
use PHPUnit\Framework\Attributes\Test;

class InboundEmailTest extends TestCase
{
Expand All @@ -17,7 +18,7 @@ protected function getEnvironmentSetUp($app)
$app['config']['mailbox.driver'] = 'log';
}

/** @test */
#[Test]
public function it_stores_inbound_emails()
{
Mailbox::to('someone@beyondco.de', function ($email) {
Expand All @@ -29,7 +30,7 @@ public function it_stores_inbound_emails()
$this->assertSame(1, InboundEmail::query()->count());
}

/** @test */
#[Test]
public function it_stores_all_inbound_emails()
{
$this->app['config']['mailbox.only_store_matching_emails'] = false;
Expand All @@ -43,7 +44,7 @@ public function it_stores_all_inbound_emails()
$this->assertSame(2, InboundEmail::query()->count());
}

/** @test */
#[Test]
public function it_can_use_fallbacks()
{
Mailbox::fallback(function (InboundEmail $email) {
Expand All @@ -57,7 +58,7 @@ public function it_can_use_fallbacks()
Mail::assertSent(ReplyMail::class);
}

/** @test */
#[Test]
public function it_can_use_catchall()
{
Mailbox::to('someone@beyondco.de', function ($email) {
Expand All @@ -74,7 +75,7 @@ public function it_can_use_catchall()
Mail::assertSent(ReplyMail::class);
}

/** @test */
#[Test]
public function it_stores_inbound_emails_with_catchall()
{
Mailbox::catchAll(function ($email) {
Expand All @@ -86,7 +87,7 @@ public function it_stores_inbound_emails_with_catchall()
$this->assertSame(2, InboundEmail::query()->count());
}

/** @test */
#[Test]
public function it_stores_inbound_emails_with_fallback()
{
Mailbox::fallback(function ($email) {
Expand All @@ -98,7 +99,7 @@ public function it_stores_inbound_emails_with_fallback()
$this->assertSame(2, InboundEmail::query()->count());
}

/** @test */
#[Test]
public function it_stores_inbound_emails_with_fallback_and_catchall_only_once()
{
Mailbox::fallback(function ($email) {
Expand All @@ -113,7 +114,7 @@ public function it_stores_inbound_emails_with_fallback_and_catchall_only_once()
$this->assertSame(2, InboundEmail::query()->count());
}

/** @test */
#[Test]
public function it_does_not_store_inbound_emails_if_configured()
{
$this->app['config']['mailbox.store_incoming_emails_for_days'] = 0;
Expand All @@ -127,7 +128,7 @@ public function it_does_not_store_inbound_emails_if_configured()
$this->assertSame(0, InboundEmail::query()->count());
}

/** @test */
#[Test]
public function it_can_reply_to_mails()
{
Mailbox::from('example@beyondco.de', function (InboundEmail $email) {
Expand All @@ -141,7 +142,7 @@ public function it_can_reply_to_mails()
Mail::assertSent(ReplyMail::class);
}

/** @test */
#[Test]
public function it_uses_the_configured_model()
{
$this->app['config']['mailbox.model'] = ExtendedInboundEmail::class;
Expand Down
6 changes: 3 additions & 3 deletions tests/MailboxRouteCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
use BeyondCode\Mailbox\InboundEmail;
use BeyondCode\Mailbox\Routing\Route;
use BeyondCode\Mailbox\Routing\RouteCollection;
use Laminas\Mail\Message as TestMail;
use PHPUnit\Framework\Attributes\Test;

class MailboxRouteCollectionTest extends TestCase
{
/** @test */
#[Test]
public function it_returns_all_matching_mailbox_routes()
{
$collection = new RouteCollection();
Expand All @@ -18,7 +18,7 @@ public function it_returns_all_matching_mailbox_routes()
$collection->add(new Route(Route::FROM, '{from}@beyondco.de', ''));
$collection->add(new Route(Route::FROM, 'different@laravel.com', ''));

$testMail = (new TestMail())
$testMail = (new TestMimeMessage())
->setFrom('hello@beyondco.de');

$message = new InboundEmail(['message' => $testMail->toString()]);
Expand Down
Loading
Loading