From 6999d24ce311809a1c61c7b84d2d1246337b059d Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Fri, 18 Oct 2024 14:16:14 -0700 Subject: [PATCH 01/10] Laravel Pint, removal of cs fixer and devbox --- .editorconfig | 16 -- .envrc | 7 - .gitignore | 2 +- .php-cs-fixer.php | 160 ------------------ composer.json | 13 +- devbox.d/php/php-fpm.conf | 17 -- devbox.d/php/php.ini | 6 - devbox.json | 13 -- devbox.lock | 54 ------ pint.json | 44 +++++ src/AssertableMessage.php | 8 +- src/Assertions/BccAssertions.php | 12 +- src/Assertions/CcAssertions.php | 12 +- src/Assertions/ContentAssertions.php | 12 +- src/Assertions/ContentTypeAssertions.php | 50 ++---- src/Assertions/FromAssertions.php | 12 +- src/Assertions/PriorityAssertions.php | 52 ++---- src/Assertions/ReplyToAssertions.php | 12 +- src/Assertions/ReturnPathAssertions.php | 12 +- src/Assertions/SenderAssertions.php | 12 +- src/Assertions/SubjectAssertions.php | 12 +- src/Assertions/ToAssertions.php | 12 +- .../UnstructuredHeaderAssertions.php | 24 +-- src/WithMailInterceptor.php | 41 ++--- tests/BccAssertionsTest.php | 4 +- tests/CcAssertionsTest.php | 4 +- tests/ContentAssertionsTest.php | 4 +- tests/ContentTypeAssertionsTest.php | 4 +- tests/Fluent/BccAssertionsTest.php | 6 +- tests/Fluent/CcAssertionsTest.php | 6 +- tests/Fluent/ContentAssertionsTest.php | 6 +- tests/Fluent/ContentTypeAssertionsTest.php | 6 +- tests/Fluent/FromAssertionsTest.php | 6 +- tests/Fluent/PriorityAssertionsTest.php | 6 +- tests/Fluent/ReplyToAssertionsTest.php | 6 +- tests/Fluent/ReturnPathAssertionsTest.php | 6 +- tests/Fluent/SenderAssertionsTest.php | 6 +- tests/Fluent/SubjectAssertionsTest.php | 6 +- tests/Fluent/ToAssertionsTest.php | 6 +- .../UnstructuredHeaderAssertionsTest.php | 6 +- tests/FromAssertionsTest.php | 4 +- tests/PriorityAssertionsTest.php | 4 +- tests/ReplyToAssertionsTest.php | 4 +- tests/ReturnPathAssertionsTest.php | 4 +- tests/SenderAssertionsTest.php | 4 +- tests/SubjectAssertionsTest.php | 4 +- tests/TestCase.php | 2 +- tests/ToAssertionsTest.php | 4 +- tests/UnstructuredHeaderAssertionsTest.php | 4 +- 49 files changed, 194 insertions(+), 543 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .envrc delete mode 100644 .php-cs-fixer.php delete mode 100644 devbox.d/php/php-fpm.conf delete mode 100644 devbox.d/php/php.ini delete mode 100644 devbox.json delete mode 100644 devbox.lock create mode 100644 pint.json diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 141ef8b..0000000 --- a/.editorconfig +++ /dev/null @@ -1,16 +0,0 @@ -; This file is for unifying the coding style for different editors and IDEs. -; More information at http://editorconfig.org - -root = true - -[*] -charset = utf-8 -indent_size = 4 -indent_style = space -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true -max_line_length = 120 - -[*.md] -trim_trailing_whitespace = false diff --git a/.envrc b/.envrc deleted file mode 100644 index 84fc8e5..0000000 --- a/.envrc +++ /dev/null @@ -1,7 +0,0 @@ -# Automatically sets up your devbox environment whenever you cd into this -# directory via our direnv integration: - -eval "$(devbox generate direnv --print-envrc)" - -# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/ -# for more details diff --git a/.gitignore b/.gitignore index ad6b563..5ea4bc2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,6 @@ composer.phar composer.lock phpunit.xml .phpunit.result.cache +.phpunit.cache .DS_Store Thumbs.db -.php-cs-fixer.cache diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php deleted file mode 100644 index 205cead..0000000 --- a/.php-cs-fixer.php +++ /dev/null @@ -1,160 +0,0 @@ -exclude('vendor') - ->in(__DIR__) - ->name('*.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -$config = new PhpCsFixer\Config(); - -return $config->setFinder($finder) - ->setLineEnding("\n") - ->setRules([ - '@PSR12' => true, - 'phpdoc_no_empty_return' => false, - 'phpdoc_var_annotation_correct_order' => true, - 'array_syntax' => [ - 'syntax' => 'short', - ], - 'no_singleline_whitespace_before_semicolons' => true, - 'no_extra_blank_lines' => [ - 'tokens' => [ - 'break', - 'case', - 'continue', - 'curly_brace_block', - 'default', - 'extra', - 'parenthesis_brace_block', - 'return', - 'square_brace_block', - 'switch', - 'throw', - 'use', - 'use_trait', - ], - ], - 'cast_spaces' => [ - 'space' => 'single', - ], - 'concat_space' => [ - 'spacing' => 'one', - ], - 'ordered_imports' => [ - 'sort_algorithm' => 'length', - ], - 'single_quote' => true, - 'lowercase_cast' => true, - 'lowercase_static_reference' => true, - 'no_empty_phpdoc' => true, - 'no_empty_comment' => true, - 'array_indentation' => true, - 'short_scalar_cast' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'const' => 'one', - 'method' => 'one', - 'property' => 'one', - ], - ], - 'no_mixed_echo_print' => [ - 'use' => 'echo', - ], - 'no_unused_imports' => true, - 'binary_operator_spaces' => [ - 'default' => 'single_space', - ], - 'no_empty_statement' => true, - 'unary_operator_spaces' => true, - 'single_line_comment_style' => [ - 'comment_types' => [ - 'hash', - ], - ], - 'standardize_not_equals' => true, - 'native_function_casing' => true, - 'ternary_operator_spaces' => true, - 'ternary_to_null_coalescing' => true, - 'declare_equal_normalize' => [ - 'space' => 'single', - ], - 'function_typehint_space' => true, - 'no_leading_import_slash' => true, - 'blank_line_before_statement' => [ - 'statements' => [ - 'break', - 'case', - 'continue', - 'declare', - 'default', - 'do', - 'exit', - 'for', - 'foreach', - 'goto', - 'if', - 'include', - 'include_once', - 'require', - 'require_once', - 'return', - 'switch', - 'throw', - 'try', - 'while', - 'yield', - ], - ], - 'combine_consecutive_unsets' => true, - 'method_chaining_indentation' => true, - 'no_whitespace_in_blank_line' => true, - 'blank_line_after_opening_tag' => true, - 'no_trailing_comma_in_list_call' => true, - 'list_syntax' => [ - 'syntax' => 'short', - ], - 'compact_nullable_typehint' => true, - 'explicit_string_variable' => true, - 'no_leading_namespace_whitespace' => true, - 'trailing_comma_in_multiline' => [ - 'elements' => [ - 'arrays', - ] - ], - 'not_operator_with_successor_space' => true, - 'object_operator_without_whitespace' => true, - 'blank_lines_before_namespace' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'whitespace_after_comma_in_array' => true, - 'multiline_whitespace_before_semicolons' => [ - 'strategy' => 'no_multi_line', - ], - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_useless_return' => true, - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_order' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'single_trait_insert_per_statement' => true, - 'ordered_class_elements' => [ - 'order' => [ - 'use_trait', - 'constant', - 'property', - 'construct', - 'public', - 'protected', - 'private', - ], - 'sort_algorithm' => 'none', - ], - 'return_type_declaration' => [ - 'space_before' => 'none', - ], - ]); diff --git a/composer.json b/composer.json index 871413e..d122e73 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "illuminate/mail": "^9.2|^10.0|^11.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.7", + "laravel/pint": "^1.18", "orchestra/testbench": "^7.1|^8.0|^9.0", "phpunit/phpunit": "^9.5.10|^10.5", "spatie/ray": "^1.41.1" @@ -36,6 +36,17 @@ "Tests\\": "tests/" } }, + "scripts": { + "pint": [ + "./vendor/bin/pint" + ], + "pint-check": [ + "./vendor/bin/pint --test" + ], + "test": [ + "./vendor/bin/phpunit" + ] + }, "config": { "sort-packages": true }, diff --git a/devbox.d/php/php-fpm.conf b/devbox.d/php/php-fpm.conf deleted file mode 100644 index b935957..0000000 --- a/devbox.d/php/php-fpm.conf +++ /dev/null @@ -1,17 +0,0 @@ -[global] -pid = ${PHPFPM_PID_FILE} -error_log = ${PHPFPM_ERROR_LOG_FILE} -daemonize = yes - -[www] -; user = www-data -; group = www-data -listen = 127.0.0.1:${PHPFPM_PORT} -; listen.owner = www-data -; listen.group = www-data -pm = dynamic -pm.max_children = 5 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 -chdir = / diff --git a/devbox.d/php/php.ini b/devbox.d/php/php.ini deleted file mode 100644 index b4626d5..0000000 --- a/devbox.d/php/php.ini +++ /dev/null @@ -1,6 +0,0 @@ -[php] - -; Put your php.ini directives here. For the latest default php.ini file, see https://github.com/php/php-src/blob/master/php.ini-production - -; memory_limit = 128M -; expose_php = Off diff --git a/devbox.json b/devbox.json deleted file mode 100644 index e28cec2..0000000 --- a/devbox.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "packages": ["php@8.2"], - "shell": { - "init_hook": [ - "echo 'Welcome to devbox!' > /dev/null" - ], - "scripts": { - "test": [ - "echo \"Error: no test specified\" && exit 1" - ] - } - } -} diff --git a/devbox.lock b/devbox.lock deleted file mode 100644 index 1d9d8a0..0000000 --- a/devbox.lock +++ /dev/null @@ -1,54 +0,0 @@ -{ - "lockfile_version": "1", - "packages": { - "php@8.2": { - "last_modified": "2024-03-08T13:51:52Z", - "plugin_version": "0.0.3", - "resolved": "github:NixOS/nixpkgs/a343533bccc62400e8a9560423486a3b6c11a23b#php", - "source": "devbox-search", - "version": "8.2.16", - "systems": { - "aarch64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/zbs3abbzn3wk71cg0nxb1cslr0dqvqh1-php-with-extensions-8.2.16", - "default": true - } - ], - "store_path": "/nix/store/zbs3abbzn3wk71cg0nxb1cslr0dqvqh1-php-with-extensions-8.2.16" - }, - "aarch64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/m1zbpk3mkx2g8zg9jr2ihw15miahjap4-php-with-extensions-8.2.16", - "default": true - } - ], - "store_path": "/nix/store/m1zbpk3mkx2g8zg9jr2ihw15miahjap4-php-with-extensions-8.2.16" - }, - "x86_64-darwin": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/1c7sygadaq4bfacs9lx5php74hllrsnn-php-with-extensions-8.2.16", - "default": true - } - ], - "store_path": "/nix/store/1c7sygadaq4bfacs9lx5php74hllrsnn-php-with-extensions-8.2.16" - }, - "x86_64-linux": { - "outputs": [ - { - "name": "out", - "path": "/nix/store/a96xa8idc7zsjdc5s8bbysc2ij16818j-php-with-extensions-8.2.16", - "default": true - } - ], - "store_path": "/nix/store/a96xa8idc7zsjdc5s8bbysc2ij16818j-php-with-extensions-8.2.16" - } - } - } - } -} diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..eb8cc3c --- /dev/null +++ b/pint.json @@ -0,0 +1,44 @@ +{ + "preset": "laravel", + "rules": { + "blank_line_before_statement": { + "statements": [ + "break", + "case", + "continue", + "declare", + "default", + "do", + "exit", + "for", + "foreach", + "if", + "include", + "include_once", + "require", + "require_once", + "return", + "switch", + "throw", + "try", + "while", + "yield" + ] + }, + "class_definition": { + "multi_line_extends_each_single_line": true, + "single_item_single_line": true, + "single_line": false + }, + "concat_space": { + "spacing": "one" + }, + "explicit_string_variable": true, + "method_chaining_indentation": true, + "new_with_braces": true, + "nullable_type_declaration_for_default_null_value": true, + "ordered_traits": true, + "phpdoc_separation": true, + "single_line_empty_body": true + } +} diff --git a/src/AssertableMessage.php b/src/AssertableMessage.php index b29ab90..7388c1e 100644 --- a/src/AssertableMessage.php +++ b/src/AssertableMessage.php @@ -3,9 +3,9 @@ namespace KirschbaumDevelopment\MailIntercept; use Illuminate\Support\Str; +use Illuminate\Support\Traits\ForwardsCalls; use PHPUnit\Framework\Assert; use Symfony\Component\Mime\Email; -use Illuminate\Support\Traits\ForwardsCalls; /** * @method assertBcc(array|string $expected) @@ -62,15 +62,11 @@ class AssertableMessage extends Assert /** * The Symfony SentMessage instance. - * - * @var Email */ protected Email $email; /** * Create a new SentMessage instance. - * - * @param Email $email */ public function __construct(Email $email) { @@ -80,8 +76,6 @@ public function __construct(Email $email) /** * Dynamically pass missing methods to the Symfony instance. * - * @param string $method - * @param array $parameters * * @return mixed */ diff --git a/src/Assertions/BccAssertions.php b/src/Assertions/BccAssertions.php index c94704a..229da41 100644 --- a/src/Assertions/BccAssertions.php +++ b/src/Assertions/BccAssertions.php @@ -3,18 +3,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; use Illuminate\Support\Arr; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait BccAssertions { /** * Assert mail was BCC'd to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailBcc(array|string $expected, AssertableMessage | Email $mail): void + public function assertMailBcc(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getBcc', $mail); @@ -30,11 +27,8 @@ public function assertMailBcc(array|string $expected, AssertableMessage | Email /** * Assert mail was not BCC'd to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotBcc(array|string $expected, AssertableMessage | Email $mail): void + public function assertMailNotBcc(array|string $expected, AssertableMessage|Email $mail): void { $addresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getBcc', $mail); diff --git a/src/Assertions/CcAssertions.php b/src/Assertions/CcAssertions.php index de9c132..be1675c 100644 --- a/src/Assertions/CcAssertions.php +++ b/src/Assertions/CcAssertions.php @@ -3,18 +3,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; use Illuminate\Support\Arr; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait CcAssertions { /** * Assert mail was CC'd to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailCc(array|string $expected, AssertableMessage | Email $mail): void + public function assertMailCc(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getCc', $mail); @@ -30,11 +27,8 @@ public function assertMailCc(array|string $expected, AssertableMessage | Email $ /** * Assert mail was not CC'd to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotCc(array|string $expected, AssertableMessage | Email $mail): void + public function assertMailNotCc(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getCc', $mail); diff --git a/src/Assertions/ContentAssertions.php b/src/Assertions/ContentAssertions.php index 95bf4e9..a4e7690 100644 --- a/src/Assertions/ContentAssertions.php +++ b/src/Assertions/ContentAssertions.php @@ -2,18 +2,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait ContentAssertions { /** * Assert mail body contains string. - * - * @param string $needle - * @param AssertableMessage|Email $mail */ - public function assertMailBodyContainsString(string $needle, AssertableMessage | Email $mail): void + public function assertMailBodyContainsString(string $needle, AssertableMessage|Email $mail): void { $method = method_exists($this, 'assertStringContainsString') ? 'assertStringContainsString' @@ -28,11 +25,8 @@ public function assertMailBodyContainsString(string $needle, AssertableMessage | /** * Assert mail body does not contain string. - * - * @param string $needle - * @param AssertableMessage|Email $mail */ - public function assertMailBodyNotContainsString(string $needle, AssertableMessage | Email $mail): void + public function assertMailBodyNotContainsString(string $needle, AssertableMessage|Email $mail): void { $method = method_exists($this, 'assertStringNotContainsString') ? 'assertStringNotContainsString' diff --git a/src/Assertions/ContentTypeAssertions.php b/src/Assertions/ContentTypeAssertions.php index d7f53ad..b261913 100644 --- a/src/Assertions/ContentTypeAssertions.php +++ b/src/Assertions/ContentTypeAssertions.php @@ -2,18 +2,16 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; +use KirschbaumDevelopment\MailIntercept\AssertableMessage; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Part\AbstractMultipartPart; -use KirschbaumDevelopment\MailIntercept\AssertableMessage; trait ContentTypeAssertions { /** * Assert mail content type is text/plain. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsPlain(AssertableMessage | Email $mail): void + public function assertMailIsPlain(AssertableMessage|Email $mail): void { $this->assertEquals( 'plain', @@ -24,10 +22,8 @@ public function assertMailIsPlain(AssertableMessage | Email $mail): void /** * Assert mail content type is not text/plain. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsNotPlain(AssertableMessage | Email $mail): void + public function assertMailIsNotPlain(AssertableMessage|Email $mail): void { $this->assertNotEquals( 'plain', @@ -38,10 +34,8 @@ public function assertMailIsNotPlain(AssertableMessage | Email $mail): void /** * Assert multipart email has text/plain content type. - * - * @param AssertableMessage|Email $mail */ - public function assertMailHasPlainContent(AssertableMessage | Email $mail): void + public function assertMailHasPlainContent(AssertableMessage|Email $mail): void { if ($mail->getBody() instanceof AbstractMultipartPart) { $hasPlainContent = collect($mail->getBody()->getParts()) @@ -56,10 +50,8 @@ public function assertMailHasPlainContent(AssertableMessage | Email $mail): void /** * Assert multipart email does not have text/plain content type. - * - * @param AssertableMessage|Email $mail */ - public function assertMailDoesNotHavePlainContent(AssertableMessage | Email $mail): void + public function assertMailDoesNotHavePlainContent(AssertableMessage|Email $mail): void { if ($mail->getBody() instanceof AbstractMultipartPart) { $hasPlainContent = collect($mail->getBody()->getParts()) @@ -74,10 +66,8 @@ public function assertMailDoesNotHavePlainContent(AssertableMessage | Email $mai /** * Assert mail content type is text/html. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsHtml(AssertableMessage | Email $mail): void + public function assertMailIsHtml(AssertableMessage|Email $mail): void { $this->assertEquals( 'html', @@ -88,10 +78,8 @@ public function assertMailIsHtml(AssertableMessage | Email $mail): void /** * Assert mail content type is not text/html. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsNotHtml(AssertableMessage | Email $mail): void + public function assertMailIsNotHtml(AssertableMessage|Email $mail): void { $this->assertNotEquals( 'html', @@ -102,10 +90,8 @@ public function assertMailIsNotHtml(AssertableMessage | Email $mail): void /** * Assert multipart email has text/html content type. - * - * @param AssertableMessage|Email $mail */ - public function assertMailHasHtmlContent(AssertableMessage | Email $mail): void + public function assertMailHasHtmlContent(AssertableMessage|Email $mail): void { if ($mail->getBody() instanceof AbstractMultipartPart) { $hasHtmlContent = collect($mail->getBody()->getParts()) @@ -120,10 +106,8 @@ public function assertMailHasHtmlContent(AssertableMessage | Email $mail): void /** * Assert multipart email does not have text/html content type. - * - * @param AssertableMessage|Email $mail */ - public function assertMailDoesNotHaveHtmlContent(AssertableMessage | Email $mail): void + public function assertMailDoesNotHaveHtmlContent(AssertableMessage|Email $mail): void { if ($mail->getBody() instanceof AbstractMultipartPart) { $hasHtmlContent = collect($mail->getBody()->getParts()) @@ -138,10 +122,8 @@ public function assertMailDoesNotHaveHtmlContent(AssertableMessage | Email $mail /** * Assert mail content type is multipart/alternative. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsAlternative(AssertableMessage | Email $mail): void + public function assertMailIsAlternative(AssertableMessage|Email $mail): void { $this->assertEquals( 'alternative', @@ -152,10 +134,8 @@ public function assertMailIsAlternative(AssertableMessage | Email $mail): void /** * Assert mail content type is not multipart/alternative. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsNotAlternative(AssertableMessage | Email $mail): void + public function assertMailIsNotAlternative(AssertableMessage|Email $mail): void { $this->assertNotEquals( 'alternative', @@ -166,10 +146,8 @@ public function assertMailIsNotAlternative(AssertableMessage | Email $mail): voi /** * Assert mail content type is multipart/mixed. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsMixed(AssertableMessage | Email $mail): void + public function assertMailIsMixed(AssertableMessage|Email $mail): void { $this->assertEquals( 'mixed', @@ -180,10 +158,8 @@ public function assertMailIsMixed(AssertableMessage | Email $mail): void /** * Assert mail content type is not multipart/mixed. - * - * @param AssertableMessage|Email $mail */ - public function assertMailIsNotMixed(AssertableMessage | Email $mail): void + public function assertMailIsNotMixed(AssertableMessage|Email $mail): void { $this->assertNotEquals( 'mixed', diff --git a/src/Assertions/FromAssertions.php b/src/Assertions/FromAssertions.php index 839d87f..8d9e580 100644 --- a/src/Assertions/FromAssertions.php +++ b/src/Assertions/FromAssertions.php @@ -3,18 +3,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; use Illuminate\Support\Arr; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait FromAssertions { /** * Assert mail was sent from address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailSentFrom(array | string $expected, AssertableMessage | Email $mail): void + public function assertMailSentFrom(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getFrom', $mail); @@ -30,11 +27,8 @@ public function assertMailSentFrom(array | string $expected, AssertableMessage | /** * Assert mail was not sent from address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotSentFrom(array | string $expected, AssertableMessage | Email $mail): void + public function assertMailNotSentFrom(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getFrom', $mail); diff --git a/src/Assertions/PriorityAssertions.php b/src/Assertions/PriorityAssertions.php index 2d700ee..2256f8f 100644 --- a/src/Assertions/PriorityAssertions.php +++ b/src/Assertions/PriorityAssertions.php @@ -2,18 +2,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait PriorityAssertions { /** * Assert mail has priority. - * - * @param int $expected - * @param AssertableMessage|Email $mail */ - public function assertMailPriority(int $expected, AssertableMessage | Email $mail): void + public function assertMailPriority(int $expected, AssertableMessage|Email $mail): void { $this->assertEquals( $expected, @@ -24,11 +21,8 @@ public function assertMailPriority(int $expected, AssertableMessage | Email $mai /** * Assert mail does not have priority. - * - * @param int $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotPriority(int $expected, AssertableMessage | Email $mail): void + public function assertMailNotPriority(int $expected, AssertableMessage|Email $mail): void { $this->assertNotEquals( $expected, @@ -39,10 +33,8 @@ public function assertMailNotPriority(int $expected, AssertableMessage | Email $ /** * Assert mail has the highest priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityIsHighest(AssertableMessage | Email $mail): void + public function assertMailPriorityIsHighest(AssertableMessage|Email $mail): void { $this->assertEquals( Email::PRIORITY_HIGHEST, @@ -53,10 +45,8 @@ public function assertMailPriorityIsHighest(AssertableMessage | Email $mail): vo /** * Assert mail does not have the highest priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityNotHighest(AssertableMessage | Email $mail): void + public function assertMailPriorityNotHighest(AssertableMessage|Email $mail): void { $this->assertNotEquals( Email::PRIORITY_HIGHEST, @@ -67,10 +57,8 @@ public function assertMailPriorityNotHighest(AssertableMessage | Email $mail): v /** * Assert mail has high priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityIsHigh(AssertableMessage | Email $mail): void + public function assertMailPriorityIsHigh(AssertableMessage|Email $mail): void { $this->assertEquals( Email::PRIORITY_HIGH, @@ -81,10 +69,8 @@ public function assertMailPriorityIsHigh(AssertableMessage | Email $mail): void /** * Assert mail does not have high priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityNotHigh(AssertableMessage | Email $mail): void + public function assertMailPriorityNotHigh(AssertableMessage|Email $mail): void { $this->assertNotEquals( Email::PRIORITY_HIGH, @@ -95,10 +81,8 @@ public function assertMailPriorityNotHigh(AssertableMessage | Email $mail): void /** * Assert mail has normal priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityIsNormal(AssertableMessage | Email $mail): void + public function assertMailPriorityIsNormal(AssertableMessage|Email $mail): void { $this->assertEquals( Email::PRIORITY_NORMAL, @@ -109,10 +93,8 @@ public function assertMailPriorityIsNormal(AssertableMessage | Email $mail): voi /** * Assert mail does not have normal priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityNotNormal(AssertableMessage | Email $mail): void + public function assertMailPriorityNotNormal(AssertableMessage|Email $mail): void { $this->assertNotEquals( Email::PRIORITY_NORMAL, @@ -123,10 +105,8 @@ public function assertMailPriorityNotNormal(AssertableMessage | Email $mail): vo /** * Assert mail has low priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityIsLow(AssertableMessage | Email $mail): void + public function assertMailPriorityIsLow(AssertableMessage|Email $mail): void { $this->assertEquals( Email::PRIORITY_LOW, @@ -137,10 +117,8 @@ public function assertMailPriorityIsLow(AssertableMessage | Email $mail): void /** * Assert mail does not have low priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityNotLow(AssertableMessage | Email $mail): void + public function assertMailPriorityNotLow(AssertableMessage|Email $mail): void { $this->assertNotEquals( Email::PRIORITY_LOW, @@ -151,10 +129,8 @@ public function assertMailPriorityNotLow(AssertableMessage | Email $mail): void /** * Assert mail has the lowest priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityIsLowest(AssertableMessage | Email $mail): void + public function assertMailPriorityIsLowest(AssertableMessage|Email $mail): void { $this->assertEquals( Email::PRIORITY_LOWEST, @@ -165,10 +141,8 @@ public function assertMailPriorityIsLowest(AssertableMessage | Email $mail): voi /** * Assert mail does not have the lowest priority. - * - * @param AssertableMessage|Email $mail */ - public function assertMailPriorityNotLowest(AssertableMessage | Email $mail): void + public function assertMailPriorityNotLowest(AssertableMessage|Email $mail): void { $this->assertNotEquals( Email::PRIORITY_LOWEST, diff --git a/src/Assertions/ReplyToAssertions.php b/src/Assertions/ReplyToAssertions.php index 6ed1fa8..9f0f615 100644 --- a/src/Assertions/ReplyToAssertions.php +++ b/src/Assertions/ReplyToAssertions.php @@ -3,18 +3,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; use Illuminate\Support\Arr; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait ReplyToAssertions { /** * Assert mail replies to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailRepliesTo(array | string $expected, AssertableMessage | Email $mail): void + public function assertMailRepliesTo(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getReplyTo', $mail); @@ -30,11 +27,8 @@ public function assertMailRepliesTo(array | string $expected, AssertableMessage /** * Assert mail does not reply to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotRepliesTo(array | string $expected, AssertableMessage | Email $mail): void + public function assertMailNotRepliesTo(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getReplyTo', $mail); diff --git a/src/Assertions/ReturnPathAssertions.php b/src/Assertions/ReturnPathAssertions.php index d9b6294..641c917 100644 --- a/src/Assertions/ReturnPathAssertions.php +++ b/src/Assertions/ReturnPathAssertions.php @@ -2,18 +2,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait ReturnPathAssertions { /** * Assert mail has return path. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailReturnPath(string $expected, AssertableMessage | Email $mail): void + public function assertMailReturnPath(string $expected, AssertableMessage|Email $mail): void { $this->assertEquals( $expected, @@ -24,11 +21,8 @@ public function assertMailReturnPath(string $expected, AssertableMessage | Email /** * Assert mail does not have return path. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotReturnPath(string $expected, AssertableMessage | Email $mail): void + public function assertMailNotReturnPath(string $expected, AssertableMessage|Email $mail): void { $this->assertNotEquals( $expected, diff --git a/src/Assertions/SenderAssertions.php b/src/Assertions/SenderAssertions.php index 553ffd9..d8f6b50 100644 --- a/src/Assertions/SenderAssertions.php +++ b/src/Assertions/SenderAssertions.php @@ -2,18 +2,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait SenderAssertions { /** * Assert mail sender was address. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailSender(string $expected, AssertableMessage | Email $mail): void + public function assertMailSender(string $expected, AssertableMessage|Email $mail): void { $this->assertEquals( $expected, @@ -24,11 +21,8 @@ public function assertMailSender(string $expected, AssertableMessage | Email $ma /** * Assert mail was not sender address. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotSender(string $expected, AssertableMessage | Email $mail): void + public function assertMailNotSender(string $expected, AssertableMessage|Email $mail): void { $this->assertNotEquals( $expected, diff --git a/src/Assertions/SubjectAssertions.php b/src/Assertions/SubjectAssertions.php index 212daec..87eeda1 100644 --- a/src/Assertions/SubjectAssertions.php +++ b/src/Assertions/SubjectAssertions.php @@ -2,18 +2,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait SubjectAssertions { /** * Assert mail has subject. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailSubject(string $expected, AssertableMessage | Email $mail): void + public function assertMailSubject(string $expected, AssertableMessage|Email $mail): void { $this->assertEquals( $expected, @@ -24,11 +21,8 @@ public function assertMailSubject(string $expected, AssertableMessage | Email $m /** * Assert mail does not have subject. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotSubject(string $expected, AssertableMessage | Email $mail): void + public function assertMailNotSubject(string $expected, AssertableMessage|Email $mail): void { $this->assertNotEquals( $expected, diff --git a/src/Assertions/ToAssertions.php b/src/Assertions/ToAssertions.php index dd45bb1..1f4445f 100644 --- a/src/Assertions/ToAssertions.php +++ b/src/Assertions/ToAssertions.php @@ -3,18 +3,15 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; use Illuminate\Support\Arr; -use Symfony\Component\Mime\Email; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Symfony\Component\Mime\Email; trait ToAssertions { /** * Assert mail was sent to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailSentTo(array | string $expected, AssertableMessage | Email $mail): void + public function assertMailSentTo(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getTo', $mail); @@ -30,11 +27,8 @@ public function assertMailSentTo(array | string $expected, AssertableMessage | E /** * Assert mail was not sent to address. - * - * @param array|string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailNotSentTo(array | string $expected, AssertableMessage | Email $mail): void + public function assertMailNotSentTo(array|string $expected, AssertableMessage|Email $mail): void { $expectedAddresses = Arr::wrap($expected); $actualAddresses = $this->gatherEmailData('getTo', $mail); diff --git a/src/Assertions/UnstructuredHeaderAssertions.php b/src/Assertions/UnstructuredHeaderAssertions.php index f67c656..cbb3b02 100644 --- a/src/Assertions/UnstructuredHeaderAssertions.php +++ b/src/Assertions/UnstructuredHeaderAssertions.php @@ -2,19 +2,16 @@ namespace KirschbaumDevelopment\MailIntercept\Assertions; +use KirschbaumDevelopment\MailIntercept\AssertableMessage; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Header\UnstructuredHeader; -use KirschbaumDevelopment\MailIntercept\AssertableMessage; trait UnstructuredHeaderAssertions { /** * Assert unstructured header exists. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailHasHeader(string $expected, AssertableMessage | Email $mail): void + public function assertMailHasHeader(string $expected, AssertableMessage|Email $mail): void { $this->assertInstanceOf( UnstructuredHeader::class, @@ -25,11 +22,8 @@ public function assertMailHasHeader(string $expected, AssertableMessage | Email /** * Assert unstructured header exists. - * - * @param string $expected - * @param AssertableMessage|Email $mail */ - public function assertMailMissingHeader(string $expected, AssertableMessage | Email $mail): void + public function assertMailMissingHeader(string $expected, AssertableMessage|Email $mail): void { $this->assertNull( $mail->getHeaders()->get($expected), @@ -39,12 +33,8 @@ public function assertMailMissingHeader(string $expected, AssertableMessage | Em /** * Assert unstructured header is expected value. - * - * @param string $expected - * @param string $expectedValue - * @param AssertableMessage|Email $mail */ - public function assertMailHeaderIs(string $expected, string $expectedValue, AssertableMessage | Email $mail): void + public function assertMailHeaderIs(string $expected, string $expectedValue, AssertableMessage|Email $mail): void { $this->assertEquals( $expectedValue, @@ -55,12 +45,8 @@ public function assertMailHeaderIs(string $expected, string $expectedValue, Asse /** * Assert unstructured header is not expected value. - * - * @param string $expected - * @param string $expectedValue - * @param AssertableMessage|Email $mail */ - public function assertMailHeaderIsNot(string $expected, string $expectedValue, AssertableMessage | Email $mail): void + public function assertMailHeaderIsNot(string $expected, string $expectedValue, AssertableMessage|Email $mail): void { $this->assertNotEquals( $expectedValue, diff --git a/src/WithMailInterceptor.php b/src/WithMailInterceptor.php index 39d0bd5..c22cd61 100644 --- a/src/WithMailInterceptor.php +++ b/src/WithMailInterceptor.php @@ -2,36 +2,36 @@ namespace KirschbaumDevelopment\MailIntercept; -use Symfony\Component\Mime\Email; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Config; -use Symfony\Component\Mailer\SentMessage; -use KirschbaumDevelopment\MailIntercept\Assertions\CcAssertions; -use KirschbaumDevelopment\MailIntercept\Assertions\ToAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\BccAssertions; -use KirschbaumDevelopment\MailIntercept\Assertions\FromAssertions; -use KirschbaumDevelopment\MailIntercept\Assertions\SenderAssertions; +use KirschbaumDevelopment\MailIntercept\Assertions\CcAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\ContentAssertions; -use KirschbaumDevelopment\MailIntercept\Assertions\ReplyToAssertions; -use KirschbaumDevelopment\MailIntercept\Assertions\SubjectAssertions; +use KirschbaumDevelopment\MailIntercept\Assertions\ContentTypeAssertions; +use KirschbaumDevelopment\MailIntercept\Assertions\FromAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\PriorityAssertions; +use KirschbaumDevelopment\MailIntercept\Assertions\ReplyToAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\ReturnPathAssertions; -use KirschbaumDevelopment\MailIntercept\Assertions\ContentTypeAssertions; +use KirschbaumDevelopment\MailIntercept\Assertions\SenderAssertions; +use KirschbaumDevelopment\MailIntercept\Assertions\SubjectAssertions; +use KirschbaumDevelopment\MailIntercept\Assertions\ToAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\UnstructuredHeaderAssertions; +use Symfony\Component\Mailer\SentMessage; +use Symfony\Component\Mime\Email; trait WithMailInterceptor { - use CcAssertions; - use ToAssertions; use BccAssertions; - use FromAssertions; - use SenderAssertions; + use CcAssertions; use ContentAssertions; - use ReplyToAssertions; - use SubjectAssertions; + use ContentTypeAssertions; + use FromAssertions; use PriorityAssertions; + use ReplyToAssertions; use ReturnPathAssertions; - use ContentTypeAssertions; + use SenderAssertions; + use SubjectAssertions; + use ToAssertions; use UnstructuredHeaderAssertions; /** @@ -44,8 +44,6 @@ public function interceptMail(): void /** * Retrieve email from internal array. - * - * @return Collection */ public function interceptedMail(): Collection { @@ -58,13 +56,8 @@ public function interceptedMail(): Collection /** * Gather email addresses from specific field method. - * - * @param string $method - * @param AssertableMessage|Email $mail - * - * @return array */ - protected function gatherEmailData(string $method, AssertableMessage | Email $mail): array + protected function gatherEmailData(string $method, AssertableMessage|Email $mail): array { return collect($mail->$method()) ->map(fn ($address) => $address->getAddress()) diff --git a/tests/BccAssertionsTest.php b/tests/BccAssertionsTest.php index 34ae8d0..c403d82 100644 --- a/tests/BccAssertionsTest.php +++ b/tests/BccAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class BccAssertionsTest extends TestCase { diff --git a/tests/CcAssertionsTest.php b/tests/CcAssertionsTest.php index 41555e4..6856907 100644 --- a/tests/CcAssertionsTest.php +++ b/tests/CcAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class CcAssertionsTest extends TestCase { diff --git a/tests/ContentAssertionsTest.php b/tests/ContentAssertionsTest.php index 6e69deb..c01aaa7 100644 --- a/tests/ContentAssertionsTest.php +++ b/tests/ContentAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests; +use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Part\TextPart; -use PHPUnit\Framework\ExpectationFailedException; -use KirschbaumDevelopment\MailIntercept\AssertableMessage; class ContentAssertionsTest extends TestCase { diff --git a/tests/ContentTypeAssertionsTest.php b/tests/ContentTypeAssertionsTest.php index dd8a17b..2e1b60a 100644 --- a/tests/ContentTypeAssertionsTest.php +++ b/tests/ContentTypeAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests; +use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Part\TextPart; -use PHPUnit\Framework\ExpectationFailedException; -use KirschbaumDevelopment\MailIntercept\AssertableMessage; class ContentTypeAssertionsTest extends TestCase { diff --git a/tests/Fluent/BccAssertionsTest.php b/tests/Fluent/BccAssertionsTest.php index 8c8db7d..fb0b56e 100644 --- a/tests/Fluent/BccAssertionsTest.php +++ b/tests/Fluent/BccAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class BccAssertionsTest extends TestCase { diff --git a/tests/Fluent/CcAssertionsTest.php b/tests/Fluent/CcAssertionsTest.php index a4fd08d..b13918d 100644 --- a/tests/Fluent/CcAssertionsTest.php +++ b/tests/Fluent/CcAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class CcAssertionsTest extends TestCase { diff --git a/tests/Fluent/ContentAssertionsTest.php b/tests/Fluent/ContentAssertionsTest.php index d1bb66f..2724689 100644 --- a/tests/Fluent/ContentAssertionsTest.php +++ b/tests/Fluent/ContentAssertionsTest.php @@ -2,11 +2,11 @@ namespace Tests\Fluent; -use Tests\TestCase; +use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Part\TextPart; -use PHPUnit\Framework\ExpectationFailedException; -use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Tests\TestCase; class ContentAssertionsTest extends TestCase { diff --git a/tests/Fluent/ContentTypeAssertionsTest.php b/tests/Fluent/ContentTypeAssertionsTest.php index 0434815..be582dd 100644 --- a/tests/Fluent/ContentTypeAssertionsTest.php +++ b/tests/Fluent/ContentTypeAssertionsTest.php @@ -2,11 +2,11 @@ namespace Tests\Fluent; -use Tests\TestCase; +use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Part\TextPart; -use PHPUnit\Framework\ExpectationFailedException; -use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use Tests\TestCase; class ContentTypeAssertionsTest extends TestCase { diff --git a/tests/Fluent/FromAssertionsTest.php b/tests/Fluent/FromAssertionsTest.php index 44cefa2..db05930 100644 --- a/tests/Fluent/FromAssertionsTest.php +++ b/tests/Fluent/FromAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class FromAssertionsTest extends TestCase { diff --git a/tests/Fluent/PriorityAssertionsTest.php b/tests/Fluent/PriorityAssertionsTest.php index 0acab87..4fc79b0 100644 --- a/tests/Fluent/PriorityAssertionsTest.php +++ b/tests/Fluent/PriorityAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class PriorityAssertionsTest extends TestCase { diff --git a/tests/Fluent/ReplyToAssertionsTest.php b/tests/Fluent/ReplyToAssertionsTest.php index f57747d..fcfea36 100644 --- a/tests/Fluent/ReplyToAssertionsTest.php +++ b/tests/Fluent/ReplyToAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class ReplyToAssertionsTest extends TestCase { diff --git a/tests/Fluent/ReturnPathAssertionsTest.php b/tests/Fluent/ReturnPathAssertionsTest.php index 631f437..65affeb 100644 --- a/tests/Fluent/ReturnPathAssertionsTest.php +++ b/tests/Fluent/ReturnPathAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class ReturnPathAssertionsTest extends TestCase { diff --git a/tests/Fluent/SenderAssertionsTest.php b/tests/Fluent/SenderAssertionsTest.php index 281faa8..19d435d 100644 --- a/tests/Fluent/SenderAssertionsTest.php +++ b/tests/Fluent/SenderAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class SenderAssertionsTest extends TestCase { diff --git a/tests/Fluent/SubjectAssertionsTest.php b/tests/Fluent/SubjectAssertionsTest.php index 68bbd69..6cb9fac 100644 --- a/tests/Fluent/SubjectAssertionsTest.php +++ b/tests/Fluent/SubjectAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class SubjectAssertionsTest extends TestCase { diff --git a/tests/Fluent/ToAssertionsTest.php b/tests/Fluent/ToAssertionsTest.php index cd1b21e..1c56e42 100644 --- a/tests/Fluent/ToAssertionsTest.php +++ b/tests/Fluent/ToAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class ToAssertionsTest extends TestCase { diff --git a/tests/Fluent/UnstructuredHeaderAssertionsTest.php b/tests/Fluent/UnstructuredHeaderAssertionsTest.php index 0853e54..9356837 100644 --- a/tests/Fluent/UnstructuredHeaderAssertionsTest.php +++ b/tests/Fluent/UnstructuredHeaderAssertionsTest.php @@ -2,10 +2,10 @@ namespace Tests\Fluent; -use Tests\TestCase; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; +use Tests\TestCase; class UnstructuredHeaderAssertionsTest extends TestCase { diff --git a/tests/FromAssertionsTest.php b/tests/FromAssertionsTest.php index 76dea9a..936b2fe 100644 --- a/tests/FromAssertionsTest.php +++ b/tests/FromAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class FromAssertionsTest extends TestCase { diff --git a/tests/PriorityAssertionsTest.php b/tests/PriorityAssertionsTest.php index dd162ad..e31dd4a 100644 --- a/tests/PriorityAssertionsTest.php +++ b/tests/PriorityAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class PriorityAssertionsTest extends TestCase { diff --git a/tests/ReplyToAssertionsTest.php b/tests/ReplyToAssertionsTest.php index 64afb7c..f54ef76 100644 --- a/tests/ReplyToAssertionsTest.php +++ b/tests/ReplyToAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class ReplyToAssertionsTest extends TestCase { diff --git a/tests/ReturnPathAssertionsTest.php b/tests/ReturnPathAssertionsTest.php index 4586c8e..4e7aafb 100644 --- a/tests/ReturnPathAssertionsTest.php +++ b/tests/ReturnPathAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class ReturnPathAssertionsTest extends TestCase { diff --git a/tests/SenderAssertionsTest.php b/tests/SenderAssertionsTest.php index 89a33c1..d927650 100644 --- a/tests/SenderAssertionsTest.php +++ b/tests/SenderAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class SenderAssertionsTest extends TestCase { diff --git a/tests/SubjectAssertionsTest.php b/tests/SubjectAssertionsTest.php index 95df380..624eb7b 100644 --- a/tests/SubjectAssertionsTest.php +++ b/tests/SubjectAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class SubjectAssertionsTest extends TestCase { diff --git a/tests/TestCase.php b/tests/TestCase.php index 68fc341..72781a3 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,8 +3,8 @@ namespace Tests; use Illuminate\Foundation\Testing\WithFaker; -use Orchestra\Testbench\TestCase as OrchestraTestCase; use KirschbaumDevelopment\MailIntercept\WithMailInterceptor; +use Orchestra\Testbench\TestCase as OrchestraTestCase; class TestCase extends OrchestraTestCase { diff --git a/tests/ToAssertionsTest.php b/tests/ToAssertionsTest.php index f0f3244..150b490 100644 --- a/tests/ToAssertionsTest.php +++ b/tests/ToAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class ToAssertionsTest extends TestCase { diff --git a/tests/UnstructuredHeaderAssertionsTest.php b/tests/UnstructuredHeaderAssertionsTest.php index 21970ad..049236a 100644 --- a/tests/UnstructuredHeaderAssertionsTest.php +++ b/tests/UnstructuredHeaderAssertionsTest.php @@ -2,9 +2,9 @@ namespace Tests; -use Symfony\Component\Mime\Email; -use PHPUnit\Framework\ExpectationFailedException; use KirschbaumDevelopment\MailIntercept\AssertableMessage; +use PHPUnit\Framework\ExpectationFailedException; +use Symfony\Component\Mime\Email; class UnstructuredHeaderAssertionsTest extends TestCase { From 425a181ac394cf1b90b569c1307f6fde6a407366 Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Fri, 18 Oct 2024 15:13:55 -0700 Subject: [PATCH 02/10] Pest and arch tests --- .github/workflows/ci.yml | 6 ++-- .github/workflows/code-style.yml | 10 ++---- composer.json | 11 +++++-- phpunit.xml.dist | 20 ++++-------- tests/Architecture/AssertableMessageTest.php | 15 +++++++++ tests/Architecture/AssertionsTest.php | 14 +++++++++ tests/Architecture/PresetTest.php | 7 +++++ tests/Architecture/TraitTest.php | 33 ++++++++++++++++++++ 8 files changed, 90 insertions(+), 26 deletions(-) create mode 100644 tests/Architecture/AssertableMessageTest.php create mode 100644 tests/Architecture/AssertionsTest.php create mode 100644 tests/Architecture/PresetTest.php create mode 100644 tests/Architecture/TraitTest.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5db766..4d94a42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: composer install --prefer-dist --no-interaction --no-scripts - name: Run Testsuite - run: vendor/bin/phpunit tests/ + run: composer pest phpunit-php81: name: PHP 8.1 @@ -36,7 +36,7 @@ jobs: composer install --prefer-dist --no-interaction --no-scripts - name: Run Testsuite - run: vendor/bin/phpunit tests/ + run: composer pest phpunit-php82: name: PHP 8.2 @@ -54,4 +54,4 @@ jobs: composer install --prefer-dist --no-interaction --no-scripts - name: Run Testsuite - run: vendor/bin/phpunit tests/ + run: composer pest diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 19e2297..9c56a3e 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -2,20 +2,16 @@ on: push name: Code Style jobs: - php-cs-fixer: + pint: runs-on: ubuntu-latest container: - image: kirschbaumdevelopment/laravel-test-runner:8.0 + image: kirschbaumdevelopment/laravel-test-runner:8.2 steps: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: Install PHP CS Fixer - run: | - composer global require friendsofphp/php-cs-fixer - - name: Check Coding Standards - run: php-cs-fixer fix --dry-run + run: composer pint-check diff --git a/composer.json b/composer.json index d122e73..d939c98 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "require-dev": { "laravel/pint": "^1.18", "orchestra/testbench": "^7.1|^8.0|^9.0", - "phpunit/phpunit": "^9.5.10|^10.5", + "pestphp/pest": "^2.36|^3.4", + "phpunit/phpunit": "^9.5.10|^10.5|^11.0", "spatie/ray": "^1.41.1" }, "autoload": { @@ -37,6 +38,9 @@ } }, "scripts": { + "pest": [ + "./vendor/bin/pest" + ], "pint": [ "./vendor/bin/pint" ], @@ -48,7 +52,10 @@ ] }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true + } }, "minimum-stability": "dev", "prefer-stable": true diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3648b39..087da46 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,14 @@ - + tests - - + + + src/ - - + + diff --git a/tests/Architecture/AssertableMessageTest.php b/tests/Architecture/AssertableMessageTest.php new file mode 100644 index 0000000..dd38904 --- /dev/null +++ b/tests/Architecture/AssertableMessageTest.php @@ -0,0 +1,15 @@ +expect(AssertableMessage::class) + ->toExtend(Assert::class); + +arch()->expect(AssertableMessage::class) + ->toUseTraits([ + ForwardsCalls::class, + WithMailInterceptor::class, + ]); diff --git a/tests/Architecture/AssertionsTest.php b/tests/Architecture/AssertionsTest.php new file mode 100644 index 0000000..824873d --- /dev/null +++ b/tests/Architecture/AssertionsTest.php @@ -0,0 +1,14 @@ +expect('KirschbaumDevelopment\MailIntercept\Assertions') + ->toBeTraits(); + +arch()->expect('KirschbaumDevelopment\MailIntercept\Assertions') + ->traits() + ->toHaveSuffix('Assertions'); + +arch()->expect('KirschbaumDevelopment\MailIntercept\Assertions') + ->not->toHavePrivateMethods(); + +arch()->expect('KirschbaumDevelopment\MailIntercept\Assertions') + ->not->toHaveProtectedMethods(); diff --git a/tests/Architecture/PresetTest.php b/tests/Architecture/PresetTest.php new file mode 100644 index 0000000..e49a393 --- /dev/null +++ b/tests/Architecture/PresetTest.php @@ -0,0 +1,7 @@ +preset()->laravel(); + +arch()->preset()->php(); + +arch()->preset()->security(); diff --git a/tests/Architecture/TraitTest.php b/tests/Architecture/TraitTest.php new file mode 100644 index 0000000..1cde0a0 --- /dev/null +++ b/tests/Architecture/TraitTest.php @@ -0,0 +1,33 @@ +expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') + ->toBeTrait(); + +arch()->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') + ->toUseTraits([ + BccAssertions::class, + CcAssertions::class, + ContentAssertions::class, + ContentTypeAssertions::class, + FromAssertions::class, + PriorityAssertions::class, + ReplyToAssertions::class, + ReturnPathAssertions::class, + SenderAssertions::class, + SubjectAssertions::class, + ToAssertions::class, + UnstructuredHeaderAssertions::class, + ]); From 00fa385ef1e5c93a2114ab60d8ccb07600a98401 Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Fri, 18 Oct 2024 16:48:26 -0700 Subject: [PATCH 03/10] Attachment assertions --- README.md | 22 ++ src/AssertableMessage.php | 8 + src/Assertions/AttachmentAssertions.php | 147 +++++++++++++ src/WithMailInterceptor.php | 2 + tests/AttachmentAssertionsTest.php | 213 ++++++++++++++++++ tests/Fixtures/f-18.jpg | Bin 0 -> 30922 bytes tests/Fluent/AttachmentAssertionsTest.php | 250 ++++++++++++++++++++++ 7 files changed, 642 insertions(+) create mode 100644 src/Assertions/AttachmentAssertions.php create mode 100644 tests/AttachmentAssertionsTest.php create mode 100644 tests/Fixtures/f-18.jpg create mode 100644 tests/Fluent/AttachmentAssertionsTest.php diff --git a/README.md b/README.md index fa1dc02..23457c6 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,17 @@ This should be called after `Mail` has been sent, but before your assertions, ot | `$intercepted->assertPriorityIsLowest();` | | | `$intercepted->assertPriorityIsLowest();` | | +| Attachment Assertions | Parameters | +|:-------------------------------------------------------|:-------------------| +| `$intercepted->assertHasAttachment($filename);` | `$filename` string | +| `$intercepted->assertHasAttachments();` | | +| `$intercepted->assertMissingAttachment($filename);` | `$filename` string | +| `$intercepted->assertMissingAttachments();` | | +| `$intercepted->assertHasEmbeddedImage($filename);` | `$filename` string | +| `$intercepted->assertHasEmbeddedImages();` | | +| `$intercepted->assertMissingEmbeddedImage($filename);` | `$filename` string | +| `$intercepted->assertMissingEmbeddedImages();` | | + #### Assertion Methods | Assertions | Parameters | @@ -211,6 +222,17 @@ This should be called after `Mail` has been sent, but before your assertions, ot | `$this->assertMailPriorityIsLowest($mail);` | `$mail` AssertableMessage, Email | | `$this->assertMailPriorityIsLowest($mail);` | `$mail` AssertableMessage, Email | +| Attachment Assertions | Parameters | +|:---------------------------------------------------|:--------------------------------------------------------| +| `this->assertMailHasAttachment($filename);` | `$filename` string
`$mail` AssertableMessage, Email | +| `this->assertMailHasAttachments();` | `$mail` AssertableMessage, Email | +| `this->assertMailMissingAttachment($filename);` | `$filename` string
`$mail` AssertableMessage, Email | +| `this->assertMailMissingAttachments();` | `$mail` AssertableMessage, Email | +| `this->assertMailHasEmbeddedImage($filename);` | `$filename` string
`$mail` AssertableMessage, Email | +| `this->assertMailHasEmbeddedImages();` | `$mail` AssertableMessage, Email | +| `this->assertMailMissingEmbeddedImage($filename);` | `$filename` string
`$mail` AssertableMessage, Email | +| `this->assertMailMissingEmbeddedImages();` | `$mail` AssertableMessage, Email | + You should use each item of the `interceptedMail()` collection as the mail object for all assertions. If you are injecting your own headers or need access to other headers in the email, use this assertion to verify they exist and are set properly. These assertions require the header name and the compiled email. diff --git a/src/AssertableMessage.php b/src/AssertableMessage.php index 7388c1e..cc51adb 100644 --- a/src/AssertableMessage.php +++ b/src/AssertableMessage.php @@ -54,6 +54,14 @@ * @method assertMissingHeader(string $expected) * @method assertHeaderIs(string $expected, string $expectedValue) * @method assertHeaderIsNot(string $expected, string $expectedValue) + * @method assertHasAttachment(string $filename) + * @method assertHasAttachments() + * @method assertMissingAttachment(string $filename) + * @method assertMissingAttachments() + * @method assertHasEmbeddedImage(string $filename) + * @method assertHasEmbeddedImages() + * @method assertMissingEmbeddedImage(string $filename) + * @method assertMissingEmbeddedImages() */ class AssertableMessage extends Assert { diff --git a/src/Assertions/AttachmentAssertions.php b/src/Assertions/AttachmentAssertions.php new file mode 100644 index 0000000..8be8471 --- /dev/null +++ b/src/Assertions/AttachmentAssertions.php @@ -0,0 +1,147 @@ +assertNotEmpty( + $mail->getAttachments(), + 'Mail missing expected attachments.' + ); + } + + /** + * Assert mail missing attachments. + */ + public function assertMailMissingAttachments(AssertableMessage|Email $mail): void + { + $this->assertEmpty( + $mail->getAttachments(), + 'Mail has expected attachments.' + ); + } + + /** + * Assert mail has attachment. + */ + public function assertMailHasAttachment(string $expected, AssertableMessage|Email $mail): void + { + $hasAttachment = collect($mail->getAttachments()) + ->contains(fn (DataPart $attachment) => $expected === $attachment->getFilename()); + + $this->assertTrue( + $hasAttachment, + 'Mail missing expected attachment.' + ); + } + + /** + * Assert mail missing attachment. + */ + public function assertMailMissingAttachment(string $expected, AssertableMessage|Email $mail): void + { + $missingAttachment = ! collect($mail->getAttachments()) + ->contains(fn (DataPart $attachment) => $expected === $attachment->getFilename()); + + $this->assertTrue( + $missingAttachment, + 'Mail has expected attachment.' + ); + } + + /* + |-------------------------------------------------------------------------- + | Embedded Images + |-------------------------------------------------------------------------- + */ + + /** + * Assert mail has attachments. + */ + public function assertMailHasEmbeddedImages(AssertableMessage|Email $mail): void + { + $hasEmbedded = collect($mail->getAttachments()) + ->contains(fn (DataPart $attachment) => $attachment->getDisposition() === 'inline'); + + $this->assertTrue( + $hasEmbedded, + 'Mail missing embedded images.' + ); + } + + /** + * Assert mail missing attachments. + */ + public function assertMailMissingEmbeddedImages(AssertableMessage|Email $mail): void + { + $missingEmbedded = ! collect($mail->getAttachments()) + ->contains(fn (DataPart $attachment) => $attachment->getDisposition() === 'inline'); + + $this->assertTrue( + $missingEmbedded, + 'Mail has embedded images.' + ); + } + + /** + * Assert mail has attachment. + */ + public function assertMailHasEmbeddedImage(string $expected, AssertableMessage|Email $mail): void + { + /** + * @var DataPart|null $embed + */ + $embed = collect($mail->getAttachments()) + ->firstWhere(fn (DataPart $attachment) => $expected === $attachment->getFilename()); + + if ($embed) { + $this->assertTrue( + $embed->getDisposition() === 'inline', + 'Mail has expected attachment but is not embedded.' + ); + + return; + } + + throw new ExpectationFailedException('Mail missing expected embedded image.'); + } + + /** + * Assert mail missing attachment. + */ + public function assertMailMissingEmbeddedImage(string $expected, AssertableMessage|Email $mail): void + { + /** + * @var DataPart|null $embed + */ + $embed = collect($mail->getAttachments()) + ->firstWhere(fn (DataPart $attachment) => $expected === $attachment->getFilename()); + + if (! $embed) { + $this->assertNull($embed); + + return; + } + + $this->assertTrue( + $embed->getDisposition() !== 'inline', + 'Mail has expected embedded image.' + ); + } +} diff --git a/src/WithMailInterceptor.php b/src/WithMailInterceptor.php index c22cd61..057b4db 100644 --- a/src/WithMailInterceptor.php +++ b/src/WithMailInterceptor.php @@ -4,6 +4,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Config; +use KirschbaumDevelopment\MailIntercept\Assertions\AttachmentAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\BccAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\CcAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\ContentAssertions; @@ -21,6 +22,7 @@ trait WithMailInterceptor { + use AttachmentAssertions; use BccAssertions; use CcAssertions; use ContentAssertions; diff --git a/tests/AttachmentAssertionsTest.php b/tests/AttachmentAssertionsTest.php new file mode 100644 index 0000000..cd0770f --- /dev/null +++ b/tests/AttachmentAssertionsTest.php @@ -0,0 +1,213 @@ +addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))); + + $this->assertMailHasAttachments($mail); + } + + public function testMailHasAttachmentsThrowsProperExpectationFailedException() + { + $mail = (new Email()); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected attachments.'); + + $this->assertMailHasAttachments($mail); + } + + /* + |-------------------------------------------------------------------------- + | assertMailMissingAttachments + |-------------------------------------------------------------------------- + */ + + public function testMailMissingAttachments() + { + $mail = (new Email()); + + $this->assertMailMissingAttachments($mail); + } + + public function testMailMissingAttachmentsThrowsProperExpectationFailedException() + { + $mail = (new Email())->addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has expected attachments.'); + + $this->assertMailMissingAttachments($mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailHasAttachment + |-------------------------------------------------------------------------- + */ + + public function testMailHasAttachment() + { + $mail = (new Email())->addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))); + + $this->assertMailHasAttachment('f-18.jpg', $mail); + } + + public function testMailHasAttachmentThrowsProperExpectationFailedException() + { + $mail = (new Email()); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected attachment.'); + + $this->assertMailHasAttachment('f-18.jpg', $mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailMissingAttachment + |-------------------------------------------------------------------------- + */ + + public function testMailMissingAttachment() + { + $mail = (new Email()); + + $this->assertMailMissingAttachment('f-18.jpg', $mail); + } + + public function testMailMissingAttachmentThrowsProperExpectationFailedException() + { + $mail = (new Email())->addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has expected attachment.'); + + $this->assertMailMissingAttachment('f-18.jpg', $mail); + } + + /* + |-------------------------------------------------------------------------- + | assertMailHasEmbeddedImages + |-------------------------------------------------------------------------- + */ + + public function testMailHasEmbeddedImages() + { + $mail = (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()); + + $this->assertMailHasEmbeddedImages($mail); + } + + public function testMailHasEmbeddedImagesThrowsProperExpectationFailedException() + { + $mail = (new Email()); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing embedded images.'); + + $this->assertMailHasEmbeddedImages($mail); + } + + /* + |-------------------------------------------------------------------------- + | assertMailMissingEmbeddedImages + |-------------------------------------------------------------------------- + */ + + public function testMailMissingEmbeddedImages() + { + $mail = (new Email()); + + $this->assertMailMissingEmbeddedImages($mail); + } + + public function testMailMissingEmbeddedImagesThrowsProperExpectationFailedException() + { + $mail = (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has embedded images.'); + + $this->assertMailMissingEmbeddedImages($mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailHasEmbeddedImage + |-------------------------------------------------------------------------- + */ + + public function testMailHasEmbeddedImage() + { + $mail = (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()); + + $this->assertMailHasEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailHasEmbeddedImageThrowsProperExpectationFailedException() + { + $mail = (new Email()); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected embedded image.'); + + $this->assertMailHasEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailHasEmbeddedImageButCheckingForWrongImageThrowsProperExpectationFailedException() + { + $mail = (new Email()); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected embedded image.'); + + $this->assertMailHasEmbeddedImage('f-22.jpg', $mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailMissingEmbeddedImage + |-------------------------------------------------------------------------- + */ + + public function testMailMissingEmbeddedImage() + { + $mail = (new Email()); + + $this->assertMailMissingEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailMissingEmbeddedImageThrowsProperExpectationFailedException() + { + $mail = (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has expected embedded image.'); + + $this->assertMailMissingEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailHasEmbeddedImageButCheckingForDifferentImage() + { + $mail = (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()); + + $this->assertMailMissingEmbeddedImage('f-22.jpg', $mail); + } +} diff --git a/tests/Fixtures/f-18.jpg b/tests/Fixtures/f-18.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cfab7de81089a3d98d1214b93ee0e5bfb3248e91 GIT binary patch literal 30922 zcmeFYcT`hP*ESq_6A+|VDT;!CNR<{91pxs8A@nG{Bho^Rpn%i}2q*}MfOI0g2!vh* zq(kUcS|Fi>07>|A-_LVD&$r&c-u3?d+bcO|GV5f{>^*b#?CaWdE@v)Rn2ApyE{*_z zo*qCP007VeXvnAm6r>UvfShz-{qHgvsmueQ`gc75U`xjPKV?_4TmO4K`L+MOKH3F9 z`QO*SA)WsvPf1@=OaFbQ`3L~ekbY6#y?0M0iR{11WaJcpZ~v*6xqJ5;+5fiqjr>0? zl0EoF@t-oFFaJM1CN=ht{9}QCEbxy7{;|M67Wl^k|5)H33;bh&e=P8i1^%(XKN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y9RI zCo!-q$RMc%5PA{FJt>piJgHMfMCk)uC z4^u<_uze}m6D^qI&SND06(WiIoO%O9U25Fj7Ldx#8@3htdV^DWPM|ttZ71;l2Cc>Z zqf;O#?%9COI3R)S_J8tDZa?eh*Z%-TJ$hG# zf8_5^{eDOP0HpENDC=O9tbB7Ph5S`zKiKs>KJMCVXUn;P?cWEd%POM*>BTI*AHB4f z{Vc}`1Ni1a>F8_izuG(gO3lapdqMoG<8K}R0LStF0DJlhi)&+570YuDTMHy$Wu60` z$i}7xomD!Bk(@&jWA~ULJAP4t z(hX02St>{SS3V1(mI`eV*DhjTfTEn?U>k#dI_E{OdL! z^{w{F6H?4)PDX&%yHADD=7_+qWx z{{Y9b{{XxzQGetXD!DWj^c`b;;fs59T}MWe<%A^}hM-~wZqfx7?}Z&ayqx1Z$3f2C zEtIz|`f~YDoNPxS%JI+5wE_0|ML+&s#ZZs#8ZE7c-G%b<06cyInTH1(xW|6gVqd&I zf~!gQ8~xw#tjh8mvmC3F^yalRjT6LL<=C;%Z0~gmPyDm9wwC4p0PmQUi2SixmcMlV z752~UIsX79Z~ob@^QMqDW6HcW`zrp^o-kEk4EPhoS0S_hw#eCzKkMkh$I`vOPX7Rc zWPa9~rJQ=Mr=sZEd;|%%YFe}r81Oo ZRsR4WE3fx|t#i$&&y^#1Mann1|JnJAe_Q|n literal 0 HcmV?d00001 diff --git a/tests/Fluent/AttachmentAssertionsTest.php b/tests/Fluent/AttachmentAssertionsTest.php new file mode 100644 index 0000000..69303d4 --- /dev/null +++ b/tests/Fluent/AttachmentAssertionsTest.php @@ -0,0 +1,250 @@ +addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))) + ); + + $mail->assertHasAttachments($mail); + } + + public function testMailHasAttachmentsThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + new Email() + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected attachments.'); + + $mail->assertHasAttachments($mail); + } + + /* + |-------------------------------------------------------------------------- + | assertMailMissingAttachments + |-------------------------------------------------------------------------- + */ + + public function testMailMissingAttachments() + { + $mail = new AssertableMessage( + new Email() + ); + + $mail->assertMissingAttachments($mail); + } + + public function testMailMissingAttachmentsThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + (new Email())->addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))) + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has expected attachments.'); + + $mail->assertMissingAttachments($mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailHasAttachment + |-------------------------------------------------------------------------- + */ + + public function testMailHasAttachment() + { + $mail = new AssertableMessage( + (new Email())->addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))) + ); + + $mail->assertHasAttachment('f-18.jpg', $mail); + } + + public function testMailHasAttachmentThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + new Email() + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected attachment.'); + + $mail->assertHasAttachment('f-18.jpg', $mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailMissingAttachment + |-------------------------------------------------------------------------- + */ + + public function testMailMissingAttachment() + { + $mail = new AssertableMessage( + new Email() + ); + + $mail->assertMissingAttachment('f-18.jpg', $mail); + } + + public function testMailMissingAttachmentThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + (new Email())->addPart(new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg'))) + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has expected attachment.'); + + $mail->assertMissingAttachment('f-18.jpg', $mail); + } + + /* + |-------------------------------------------------------------------------- + | assertMailHasEmbeddedImages + |-------------------------------------------------------------------------- + */ + + public function testMailHasEmbeddedImages() + { + $mail = new AssertableMessage( + (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()) + ); + + $mail->assertHasEmbeddedImages($mail); + } + + public function testMailHasEmbeddedImagesThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + new Email() + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing embedded images.'); + + $mail->assertHasEmbeddedImages($mail); + } + + /* + |-------------------------------------------------------------------------- + | assertMailMissingEmbeddedImages + |-------------------------------------------------------------------------- + */ + + public function testMailMissingEmbeddedImages() + { + $mail = new AssertableMessage( + new Email() + ); + + $mail->assertMissingEmbeddedImages($mail); + } + + public function testMailMissingEmbeddedImagesThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()) + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has embedded images.'); + + $mail->assertMissingEmbeddedImages($mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailHasEmbeddedImage + |-------------------------------------------------------------------------- + */ + + public function testMailHasEmbeddedImage() + { + $mail = new AssertableMessage( + (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()) + ); + + $mail->assertHasEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailHasEmbeddedImageThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + new Email() + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected embedded image.'); + + $mail->assertHasEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailHasEmbeddedImageButCheckingForWrongImageThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + new Email() + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail missing expected embedded image.'); + + $mail->assertHasEmbeddedImage('f-22.jpg', $mail); + } + + /* + |-------------------------------------------------------------------------- + | testMailMissingEmbeddedImage + |-------------------------------------------------------------------------- + */ + + public function testMailMissingEmbeddedImage() + { + $mail = new AssertableMessage( + new Email() + ); + + $mail->assertMissingEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailMissingEmbeddedImageThrowsProperExpectationFailedException() + { + $mail = new AssertableMessage( + (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()) + ); + + $this->expectException(ExpectationFailedException::class); + $this->expectExceptionMessage('Mail has expected embedded image.'); + + $mail->assertMissingEmbeddedImage('f-18.jpg', $mail); + } + + public function testMailHasEmbeddedImageButCheckingForDifferentImage() + { + $mail = new AssertableMessage( + (new Email())->addPart((new DataPart(new File(__DIR__ . '/../Fixtures/f-18.jpg')))->asInline()) + ); + + $mail->assertMissingEmbeddedImage('f-22.jpg', $mail); + } +} From ac6f44825dd8af2a0e3c77655240fe4a73b8f5d3 Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Fri, 18 Oct 2024 16:52:06 -0700 Subject: [PATCH 04/10] Changelog --- CHANGELOG.md | 10 ++++++++++ tests/AttachmentAssertionsTest.php | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e88643..8ad845e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to `mail-intercept` will be documented in this file +## 0.6.0 - 2024-10-18 + +- Added Attachment and embedded image assertions. +- Pest architecture tests. +- Replace PHP CS Fixer with Laravel Pint. + +## 0.5.0 - 2024-03-18 + +- Added Laravel 11 support. + ## 0.4.0 - 2023-04-05 - Added Laravel 10 support. Thank you [@cstriuli](https://github.com/cstriuli). diff --git a/tests/AttachmentAssertionsTest.php b/tests/AttachmentAssertionsTest.php index cd0770f..b529d29 100644 --- a/tests/AttachmentAssertionsTest.php +++ b/tests/AttachmentAssertionsTest.php @@ -2,7 +2,6 @@ namespace Tests; -use KirschbaumDevelopment\MailIntercept\AssertableMessage; use PHPUnit\Framework\ExpectationFailedException; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\Part\DataPart; From 874b17735f01fd08b2fa7ea4bfcfbdabc5d2129b Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Mon, 21 Oct 2024 10:48:05 -0700 Subject: [PATCH 05/10] Bumped minimum requirements to L11 and PHP 8.2 for new major release --- .github/workflows/ci.yml | 52 +++++++++++++--------------------------- CHANGELOG.md | 5 ++-- README.md | 2 +- composer.json | 10 ++++---- 4 files changed, 26 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d94a42..bc9faee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,29 +2,11 @@ on: push name: CI jobs: - phpunit-php80: - name: PHP 8.0 - runs-on: ubuntu-latest - container: - image: kirschbaumdevelopment/laravel-test-runner:8.0 - - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - - name: Install composer dependencies - run: | - composer install --prefer-dist --no-interaction --no-scripts - - - name: Run Testsuite - run: composer pest - - phpunit-php81: - name: PHP 8.1 + phpunit-php82: + name: PHP 8.2 runs-on: ubuntu-latest container: - image: kirschbaumdevelopment/laravel-test-runner:8.1 + image: kirschbaumdevelopment/laravel-test-runner:8.2 steps: - uses: actions/checkout@v1 @@ -38,20 +20,20 @@ jobs: - name: Run Testsuite run: composer pest - phpunit-php82: - name: PHP 8.2 - runs-on: ubuntu-latest - container: - image: kirschbaumdevelopment/laravel-test-runner:8.2 + phpunit-php83: + name: PHP 8.3 + runs-on: ubuntu-latest + container: + image: kirschbaumdevelopment/laravel-test-runner:8.3 - steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 - - name: Install composer dependencies - run: | - composer install --prefer-dist --no-interaction --no-scripts + - name: Install composer dependencies + run: | + composer install --prefer-dist --no-interaction --no-scripts - - name: Run Testsuite - run: composer pest + - name: Run Testsuite + run: composer pest diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ad845e..219b575 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ All notable changes to `mail-intercept` will be documented in this file -## 0.6.0 - 2024-10-18 +## 1.0.0 - 2024-10-21 -- Added Attachment and embedded image assertions. +- Bumped minimum requirement to Laravel 11 and PHP 8.2. +- New attachment and embedded image assertions. - Pest architecture tests. - Replace PHP CS Fixer with Laravel Pint. diff --git a/README.md b/README.md index 23457c6..797323d 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Mail isn't faked here. You get to inspect the actual mail ensuring you are sendi | Laravel Version | Mail Intercept Version | |:----------------|:-----------------------| -| 11.x | 0.5.x | +| 11.x | 0.6.x | | 10.x | 0.4.x | | 9.x | 0.3.x | | 8.x and lower | 0.2.x | diff --git a/composer.json b/composer.json index d939c98..c89efea 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ } ], "require": { - "php": "^8.0.2|^8.1|^8.2", - "illuminate/mail": "^9.2|^10.0|^11.0" + "php": "^8.2", + "illuminate/mail": "^11.0" }, "require-dev": { "laravel/pint": "^1.18", - "orchestra/testbench": "^7.1|^8.0|^9.0", - "pestphp/pest": "^2.36|^3.4", - "phpunit/phpunit": "^9.5.10|^10.5|^11.0", + "orchestra/testbench": "^9.0", + "pestphp/pest": "^3.4", + "phpunit/phpunit": "^11.0", "spatie/ray": "^1.41.1" }, "autoload": { From 54a35cca22cc0274a093c4ac718d0b3007a77885 Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Mon, 21 Oct 2024 10:53:23 -0700 Subject: [PATCH 06/10] Putting L10 back in with php 8.1 --- .github/workflows/ci.yml | 22 ++++++++++++++++++++-- composer.json | 10 +++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc9faee..8458b74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,25 @@ on: push name: CI jobs: - phpunit-php82: + pest-php81: + name: PHP 8.1 + runs-on: ubuntu-latest + container: + image: kirschbaumdevelopment/laravel-test-runner:8.1 + + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + + - name: Install composer dependencies + run: | + composer install --prefer-dist --no-interaction --no-scripts + + - name: Run Testsuite + run: composer pest + + pest-php82: name: PHP 8.2 runs-on: ubuntu-latest container: @@ -20,7 +38,7 @@ jobs: - name: Run Testsuite run: composer pest - phpunit-php83: + pest-php83: name: PHP 8.3 runs-on: ubuntu-latest container: diff --git a/composer.json b/composer.json index c89efea..0dcd52e 100644 --- a/composer.json +++ b/composer.json @@ -17,14 +17,14 @@ } ], "require": { - "php": "^8.2", - "illuminate/mail": "^11.0" + "php": "^8.1|^8.2", + "illuminate/mail": "^10.0|^11.0" }, "require-dev": { "laravel/pint": "^1.18", - "orchestra/testbench": "^9.0", - "pestphp/pest": "^3.4", - "phpunit/phpunit": "^11.0", + "orchestra/testbench": "^8.0|^9.0", + "pestphp/pest": "^2.36|^3.4", + "phpunit/phpunit": "^10.1|^11.0", "spatie/ray": "^1.41.1" }, "autoload": { From 05819b5c92d1f2666e43082d56be7c95c4010c7e Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Mon, 21 Oct 2024 10:59:29 -0700 Subject: [PATCH 07/10] Pest updates for v2 --- tests/Architecture/AssertableMessageTest.php | 4 ++-- tests/Architecture/AssertionsTest.php | 8 ++++---- tests/Architecture/PresetTest.php | 6 +++--- tests/Architecture/TraitTest.php | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/Architecture/AssertableMessageTest.php b/tests/Architecture/AssertableMessageTest.php index dd38904..7461339 100644 --- a/tests/Architecture/AssertableMessageTest.php +++ b/tests/Architecture/AssertableMessageTest.php @@ -5,10 +5,10 @@ use KirschbaumDevelopment\MailIntercept\WithMailInterceptor; use PHPUnit\Framework\Assert; -arch()->expect(AssertableMessage::class) +arch('AssertableMessage extends Assert')->expect(AssertableMessage::class) ->toExtend(Assert::class); -arch()->expect(AssertableMessage::class) +arch('AssertableMessage uses traits')->expect(AssertableMessage::class) ->toUseTraits([ ForwardsCalls::class, WithMailInterceptor::class, diff --git a/tests/Architecture/AssertionsTest.php b/tests/Architecture/AssertionsTest.php index 824873d..5f2d03f 100644 --- a/tests/Architecture/AssertionsTest.php +++ b/tests/Architecture/AssertionsTest.php @@ -1,14 +1,14 @@ expect('KirschbaumDevelopment\MailIntercept\Assertions') +arch('assertions are traits')->expect('KirschbaumDevelopment\MailIntercept\Assertions') ->toBeTraits(); -arch()->expect('KirschbaumDevelopment\MailIntercept\Assertions') +arch('assertions have correct suffix')->expect('KirschbaumDevelopment\MailIntercept\Assertions') ->traits() ->toHaveSuffix('Assertions'); -arch()->expect('KirschbaumDevelopment\MailIntercept\Assertions') +arch('assertions do not have private methods')->expect('KirschbaumDevelopment\MailIntercept\Assertions') ->not->toHavePrivateMethods(); -arch()->expect('KirschbaumDevelopment\MailIntercept\Assertions') +arch('assertions do not have protected methods')->expect('KirschbaumDevelopment\MailIntercept\Assertions') ->not->toHaveProtectedMethods(); diff --git a/tests/Architecture/PresetTest.php b/tests/Architecture/PresetTest.php index e49a393..29d1299 100644 --- a/tests/Architecture/PresetTest.php +++ b/tests/Architecture/PresetTest.php @@ -1,7 +1,7 @@ preset()->laravel(); +arch('laravel preset')->preset()->laravel(); -arch()->preset()->php(); +arch('php preset')->preset()->php(); -arch()->preset()->security(); +arch('security preset')->preset()->security(); diff --git a/tests/Architecture/TraitTest.php b/tests/Architecture/TraitTest.php index 1cde0a0..b5f3fa5 100644 --- a/tests/Architecture/TraitTest.php +++ b/tests/Architecture/TraitTest.php @@ -13,10 +13,10 @@ use KirschbaumDevelopment\MailIntercept\Assertions\ToAssertions; use KirschbaumDevelopment\MailIntercept\Assertions\UnstructuredHeaderAssertions; -arch()->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') +arch('WithMailInterceptor is a trait')->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') ->toBeTrait(); -arch()->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') +arch('WithMailInterceptor uses traits')->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') ->toUseTraits([ BccAssertions::class, CcAssertions::class, From 22f217b55107150b652f43fe108eb3c11ee3c0c9 Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Mon, 21 Oct 2024 11:01:46 -0700 Subject: [PATCH 08/10] Style workflow fix --- .github/workflows/code-style.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 9c56a3e..b12129b 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -12,6 +12,10 @@ jobs: with: fetch-depth: 1 + - name: Install composer dependencies + run: | + composer install --prefer-dist --no-interaction --no-scripts + - name: Check Coding Standards run: composer pint-check From 665dba81b57d020c3b3843b19ab012e8dadea4c7 Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Mon, 21 Oct 2024 11:16:41 -0700 Subject: [PATCH 09/10] Ignoring preset tests if using Pest >3 --- tests/Architecture/PresetTest.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/Architecture/PresetTest.php b/tests/Architecture/PresetTest.php index 29d1299..3e0ce58 100644 --- a/tests/Architecture/PresetTest.php +++ b/tests/Architecture/PresetTest.php @@ -1,7 +1,12 @@ preset()->laravel(); +// Pest Presets are available beginning in version 3. +exec('composer show pestphp/pest', $output); -arch('php preset')->preset()->php(); +if ($output[3] === 'versions : * v3') { + arch('laravel preset')->preset()->laravel(); -arch('security preset')->preset()->security(); + arch('php preset')->preset()->php(); + + arch('security preset')->preset()->security(); +} From e756382702a3034f044fce439c9e1e0dc307ead0 Mon Sep 17 00:00:00 2001 From: Brandon Ferens Date: Mon, 21 Oct 2024 11:21:30 -0700 Subject: [PATCH 10/10] Pest v2 is getting annoying... --- tests/Architecture/AssertableMessageTest.php | 15 ++++++--- tests/Architecture/AssertionsTest.php | 13 +++++--- tests/Architecture/TraitTest.php | 35 +++++++++++--------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/tests/Architecture/AssertableMessageTest.php b/tests/Architecture/AssertableMessageTest.php index 7461339..c9bbdbf 100644 --- a/tests/Architecture/AssertableMessageTest.php +++ b/tests/Architecture/AssertableMessageTest.php @@ -8,8 +8,13 @@ arch('AssertableMessage extends Assert')->expect(AssertableMessage::class) ->toExtend(Assert::class); -arch('AssertableMessage uses traits')->expect(AssertableMessage::class) - ->toUseTraits([ - ForwardsCalls::class, - WithMailInterceptor::class, - ]); +// Pest Presets are available beginning in version 3. +exec('composer show pestphp/pest', $output); + +if ($output[3] === 'versions : * v3') { + arch('AssertableMessage uses traits')->expect(AssertableMessage::class) + ->toUseTraits([ + ForwardsCalls::class, + WithMailInterceptor::class, + ]); +} diff --git a/tests/Architecture/AssertionsTest.php b/tests/Architecture/AssertionsTest.php index 5f2d03f..74921f8 100644 --- a/tests/Architecture/AssertionsTest.php +++ b/tests/Architecture/AssertionsTest.php @@ -7,8 +7,13 @@ ->traits() ->toHaveSuffix('Assertions'); -arch('assertions do not have private methods')->expect('KirschbaumDevelopment\MailIntercept\Assertions') - ->not->toHavePrivateMethods(); +// Pest Presets are available beginning in version 3. +exec('composer show pestphp/pest', $output); -arch('assertions do not have protected methods')->expect('KirschbaumDevelopment\MailIntercept\Assertions') - ->not->toHaveProtectedMethods(); +if ($output[3] === 'versions : * v3') { + arch('assertions do not have private methods')->expect('KirschbaumDevelopment\MailIntercept\Assertions') + ->not->toHavePrivateMethods(); + + arch('assertions do not have protected methods')->expect('KirschbaumDevelopment\MailIntercept\Assertions') + ->not->toHaveProtectedMethods(); +} diff --git a/tests/Architecture/TraitTest.php b/tests/Architecture/TraitTest.php index b5f3fa5..32274a4 100644 --- a/tests/Architecture/TraitTest.php +++ b/tests/Architecture/TraitTest.php @@ -16,18 +16,23 @@ arch('WithMailInterceptor is a trait')->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') ->toBeTrait(); -arch('WithMailInterceptor uses traits')->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') - ->toUseTraits([ - BccAssertions::class, - CcAssertions::class, - ContentAssertions::class, - ContentTypeAssertions::class, - FromAssertions::class, - PriorityAssertions::class, - ReplyToAssertions::class, - ReturnPathAssertions::class, - SenderAssertions::class, - SubjectAssertions::class, - ToAssertions::class, - UnstructuredHeaderAssertions::class, - ]); +// Pest Presets are available beginning in version 3. +exec('composer show pestphp/pest', $output); + +if ($output[3] === 'versions : * v3') { + arch('WithMailInterceptor uses traits')->expect('KirschbaumDevelopment\MailIntercept\WithMailInterceptor') + ->toUseTraits([ + BccAssertions::class, + CcAssertions::class, + ContentAssertions::class, + ContentTypeAssertions::class, + FromAssertions::class, + PriorityAssertions::class, + ReplyToAssertions::class, + ReturnPathAssertions::class, + SenderAssertions::class, + SubjectAssertions::class, + ToAssertions::class, + UnstructuredHeaderAssertions::class, + ]); +}