Skip to content

Commit a01f0c7

Browse files
committed
Update to new PHPUnit attributes
1 parent 23bd5f9 commit a01f0c7

11 files changed

+100
-91
lines changed

phpunit.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3-
<coverage includeUncoveredFiles="false">
4-
<include>
5-
<directory suffix=".php">src/</directory>
6-
</include>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
83
<testsuites>
94
<testsuite name="Orchestra\Testbench Test Suite">
105
<directory suffix="Test.php">./tests/</directory>
@@ -19,4 +14,9 @@
1914
<env name="MAIL_DRIVER" value="log"/>
2015
<env name="DB_CONNECTION" value="testbench"/>
2116
</php>
17+
<source>
18+
<include>
19+
<directory suffix=".php">src/</directory>
20+
</include>
21+
</source>
2222
</phpunit>

tests/ConfigCacheTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
namespace Tests;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Throwable;
67

78
class ConfigCacheTest extends TestCase
89
{
9-
/** @test */
10+
#[Test]
1011
public function the_configuration_file_can_be_cached()
1112
{
1213
$failed = false;
1314

1415
try {
1516
serialize(require __DIR__ . '/../config/laravel-database-emails.php');
16-
} catch (Throwable $e) {
17+
} catch (Throwable) {
1718
$failed = true;
1819
}
1920

tests/ConfigTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
namespace Tests;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Stackkit\LaravelDatabaseEmails\Config;
67

78
class ConfigTest extends TestCase
89
{
9-
/** @test */
10+
#[Test]
1011
public function test_max_attempt_count()
1112
{
1213
$this->assertEquals(3, Config::maxAttemptCount());
@@ -16,7 +17,7 @@ public function test_max_attempt_count()
1617
$this->assertEquals(5, Config::maxAttemptCount());
1718
}
1819

19-
/** @test */
20+
#[Test]
2021
public function test_encrypt_emails()
2122
{
2223
$this->assertFalse(Config::encryptEmails());
@@ -26,7 +27,7 @@ public function test_encrypt_emails()
2627
$this->assertTrue(Config::encryptEmails());
2728
}
2829

29-
/** @test */
30+
#[Test]
3031
public function test_testing()
3132
{
3233
$this->assertFalse(Config::testing());
@@ -36,7 +37,7 @@ public function test_testing()
3637
$this->assertTrue(Config::testing());
3738
}
3839

39-
/** @test */
40+
#[Test]
4041
public function test_test_email_address()
4142
{
4243
$this->assertEquals('[email protected]', Config::testEmailAddress());
@@ -46,7 +47,7 @@ public function test_test_email_address()
4647
$this->assertEquals('[email protected]', Config::testEmailAddress());
4748
}
4849

49-
/** @test */
50+
#[Test]
5051
public function test_cronjob_email_limit()
5152
{
5253
$this->assertEquals(20, Config::cronjobEmailLimit());

tests/DatabaseInteractionTest.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Carbon\Carbon;
66
use Illuminate\Support\Facades\DB;
7+
use PHPUnit\Framework\Attributes\Test;
78

89
class DatabaseInteractionTest extends TestCase
910
{
10-
/** @test */
11+
#[Test]
1112
public function label_should_be_saved_correctly()
1213
{
1314
$email = $this->sendEmail(['label' => 'welcome-email']);
@@ -16,15 +17,15 @@ public function label_should_be_saved_correctly()
1617
$this->assertEquals('welcome-email', $email->getLabel());
1718
}
1819

19-
/** @test */
20+
#[Test]
2021
public function recipient_should_be_saved_correctly()
2122
{
2223
$email = $this->sendEmail(['recipient' => '[email protected]']);
2324

2425
$this->assertEquals('[email protected]', $email->getRecipient());
2526
}
2627

27-
/** @test */
28+
#[Test]
2829
public function cc_and_bcc_should_be_saved_correctly()
2930
{
3031
$email = $this->sendEmail([
@@ -44,7 +45,7 @@ public function cc_and_bcc_should_be_saved_correctly()
4445
$this->assertEquals(['[email protected]'], $email->getBcc());
4546
}
4647

47-
/** @test */
48+
#[Test]
4849
public function reply_to_should_be_saved_correctly()
4950
{
5051
$email = $this->sendEmail([
@@ -58,7 +59,7 @@ public function reply_to_should_be_saved_correctly()
5859
$this->assertEquals(['[email protected]'], $email->getReplyTo());
5960
}
6061

61-
/** @test */
62+
#[Test]
6263
public function subject_should_be_saved_correclty()
6364
{
6465
$email = $this->sendEmail(['subject' => 'test subject']);
@@ -67,7 +68,7 @@ public function subject_should_be_saved_correclty()
6768
$this->assertEquals('test subject', $email->getSubject());
6869
}
6970

70-
/** @test */
71+
#[Test]
7172
public function view_should_be_saved_correctly()
7273
{
7374
$email = $this->sendEmail(['view' => 'tests::dummy']);
@@ -76,7 +77,7 @@ public function view_should_be_saved_correctly()
7677
$this->assertEquals('tests::dummy', $email->getView());
7778
}
7879

79-
/** @test */
80+
#[Test]
8081
public function encrypted_should_be_saved_correctly()
8182
{
8283
$email = $this->sendEmail();
@@ -92,7 +93,7 @@ public function encrypted_should_be_saved_correctly()
9293
$this->assertTrue($email->isEncrypted());
9394
}
9495

95-
/** @test */
96+
#[Test]
9697
public function scheduled_date_should_be_saved_correctly()
9798
{
9899
$email = $this->sendEmail();
@@ -105,7 +106,7 @@ public function scheduled_date_should_be_saved_correctly()
105106
$this->assertEquals('2019-01-15 01:02:03', $email->getScheduledDate());
106107
}
107108

108-
/** @test */
109+
#[Test]
109110
public function the_body_should_be_saved_correctly()
110111
{
111112
$email = $this->sendEmail(['variables' => ['name' => 'Jane Doe']]);
@@ -116,7 +117,7 @@ public function the_body_should_be_saved_correctly()
116117
$this->assertSame($expectedBody, $email->getBody());
117118
}
118119

119-
/** @test */
120+
#[Test]
120121
public function from_should_be_saved_correctly()
121122
{
122123
$email = $this->composeEmail()->send();
@@ -132,7 +133,7 @@ public function from_should_be_saved_correctly()
132133
$this->assertEquals('Marick', $email->getFromName());
133134
}
134135

135-
/** @test */
136+
#[Test]
136137
public function variables_should_be_saved_correctly()
137138
{
138139
$email = $this->sendEmail(['variables' => ['name' => 'John Doe']]);
@@ -141,7 +142,7 @@ public function variables_should_be_saved_correctly()
141142
$this->assertEquals(['name' => 'John Doe'], $email->getVariables());
142143
}
143144

144-
/** @test */
145+
#[Test]
145146
public function the_sent_date_should_be_null()
146147
{
147148
$email = $this->sendEmail();
@@ -150,7 +151,7 @@ public function the_sent_date_should_be_null()
150151
$this->assertNull($email->getSendDate());
151152
}
152153

153-
/** @test */
154+
#[Test]
154155
public function failed_should_be_zero()
155156
{
156157
$email = $this->sendEmail();
@@ -159,7 +160,7 @@ public function failed_should_be_zero()
159160
$this->assertFalse($email->hasFailed());
160161
}
161162

162-
/** @test */
163+
#[Test]
163164
public function attempts_should_be_zero()
164165
{
165166
$email = $this->sendEmail();
@@ -168,7 +169,7 @@ public function attempts_should_be_zero()
168169
$this->assertEquals(0, $email->getAttempts());
169170
}
170171

171-
/** @test */
172+
#[Test]
172173
public function the_scheduled_date_should_be_saved_correctly()
173174
{
174175
Carbon::setTestNow(Carbon::now());
@@ -181,7 +182,7 @@ public function the_scheduled_date_should_be_saved_correctly()
181182
$this->assertEquals($scheduledFor, $email->getScheduledDate());
182183
}
183184

184-
/** @test */
185+
#[Test]
185186
public function recipient_should_be_swapped_for_test_address_when_in_testing_mode()
186187
{
187188
$this->app['config']->set('laravel-database-emails.testing.enabled', function () {
@@ -194,7 +195,7 @@ public function recipient_should_be_swapped_for_test_address_when_in_testing_mod
194195
$this->assertEquals('[email protected]', $email->getRecipient());
195196
}
196197

197-
/** @test */
198+
#[Test]
198199
public function attachments_should_be_saved_correctly()
199200
{
200201
$email = $this->composeEmail()
@@ -219,7 +220,7 @@ public function attachments_should_be_saved_correctly()
219220
$this->assertEquals(__DIR__ . '/files/pdf-sample-2.pdf', $email->getAttachments()[1]['attachment']['file']);
220221
}
221222

222-
/** @test */
223+
#[Test]
223224
public function in_memory_attachments_should_be_saved_correctly()
224225
{
225226
$rawData = file_get_contents(__DIR__ . '/files/pdf-sample.pdf');

tests/EncryptionTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Tests;
44

55
use Illuminate\Mail\Mailables\Address;
6+
use PHPUnit\Framework\Attributes\Test;
67

78
class EncryptionTest extends TestCase
89
{
@@ -15,15 +16,15 @@ public function setUp(): void
1516
$this->sendEmail();
1617
}
1718

18-
/** @test */
19+
#[Test]
1920
public function an_email_should_be_marked_as_encrypted()
2021
{
2122
$email = $this->sendEmail();
2223

2324
$this->assertTrue($email->isEncrypted());
2425
}
2526

26-
/** @test */
27+
#[Test]
2728
public function the_recipient_should_be_encrypted_and_decrypted()
2829
{
2930
$email = $this->sendEmail(['recipient' => '[email protected]']);
@@ -33,7 +34,7 @@ public function the_recipient_should_be_encrypted_and_decrypted()
3334
$this->assertEquals('[email protected]', $email->getRecipient());
3435
}
3536

36-
/** @test */
37+
#[Test]
3738
public function cc_and_bb_should_be_encrypted_and_decrypted()
3839
{
3940
$email = $this->sendEmail([
@@ -48,7 +49,7 @@ public function cc_and_bb_should_be_encrypted_and_decrypted()
4849
$this->assertEquals($bcc, $email->getBcc());
4950
}
5051

51-
/** @test */
52+
#[Test]
5253
public function reply_to_should_be_encrypted_and_decrypted()
5354
{
5455
$email = $this->sendEmail([
@@ -79,7 +80,7 @@ public function reply_to_should_be_encrypted_and_decrypted()
7980
$this->assertSame([['address' => '[email protected]', 'name' => 'John Doe'], ['address' => '[email protected]', 'name' => 'Jane Doe']], $email->getReplyTo());
8081
}
8182

82-
/** @test */
83+
#[Test]
8384
public function the_subject_should_be_encrypted_and_decrypted()
8485
{
8586
$email = $this->sendEmail(['subject' => 'test subject']);
@@ -89,7 +90,7 @@ public function the_subject_should_be_encrypted_and_decrypted()
8990
$this->assertEquals('test subject', $email->getSubject());
9091
}
9192

92-
/** @test */
93+
#[Test]
9394
public function the_variables_should_be_encrypted_and_decrypted()
9495
{
9596
$email = $this->sendEmail(['variables' => ['name' => 'Jane Doe']]);
@@ -105,7 +106,7 @@ public function the_variables_should_be_encrypted_and_decrypted()
105106
);
106107
}
107108

108-
/** @test */
109+
#[Test]
109110
public function the_body_should_be_encrypted_and_decrypted()
110111
{
111112
$email = $this->sendEmail(['variables' => ['name' => 'Jane Doe']]);
@@ -117,7 +118,7 @@ public function the_body_should_be_encrypted_and_decrypted()
117118
$this->assertEquals($expectedBody, $email->getBody());
118119
}
119120

120-
/** @test */
121+
#[Test]
121122
public function from_should_be_encrypted_and_decrypted()
122123
{
123124
$email = $this->composeEmail()->from('[email protected]', 'Marick')->send();

0 commit comments

Comments
 (0)