Skip to content

Commit

Permalink
Pest v2 is getting annoying...
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonferens committed Oct 21, 2024
1 parent 665dba8 commit e756382
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
15 changes: 10 additions & 5 deletions tests/Architecture/AssertableMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}
13 changes: 9 additions & 4 deletions tests/Architecture/AssertionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
35 changes: 20 additions & 15 deletions tests/Architecture/TraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]);
}

0 comments on commit e756382

Please sign in to comment.