Skip to content

Commit 7aea583

Browse files
authored
Merge pull request #38 from joelbutcher/use-pest
Use Pest
2 parents 0ebf33e + 58b151c commit 7aea583

File tree

4 files changed

+42
-35
lines changed

4 files changed

+42
-35
lines changed

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
},
2424
"require-dev": {
2525
"orchestra/testbench": "^5.1|^6.3|^7.0|^8.0",
26+
"pestphp/pest": "1.x-dev",
2627
"phpunit/phpunit": "^8.0|^9.0"
2728
},
2829
"autoload": {
@@ -40,7 +41,10 @@
4041
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
4142
},
4243
"config": {
43-
"sort-packages": true
44+
"sort-packages": true,
45+
"allow-plugins": {
46+
"pestphp/pest-plugin": true
47+
}
4448
},
4549
"minimum-stability": "dev",
4650
"extra": {

tests/HeloTest.php

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,38 @@
22

33
namespace BeyondCode\HeloLaravel\Tests;
44

5-
use BeyondCode\HeloLaravel\HeloLaravelServiceProvider;
65
use BeyondCode\HeloLaravel\Mailer;
76
use BeyondCode\HeloLaravel\Laravel7Mailer;
87
use BeyondCode\HeloLaravel\TestMail;
98
use BeyondCode\HeloLaravel\TestMailCommand;
109
use Illuminate\Support\Facades\Mail;
11-
use Orchestra\Testbench\TestCase;
1210

13-
class HeloTest extends TestCase
14-
{
15-
protected function getPackageProviders($app)
16-
{
17-
return [
18-
HeloLaravelServiceProvider::class
19-
];
20-
}
11+
uses(TestCase::class);
2112

22-
/** @test */
23-
public function test_the_mail_commands_sends_the_mailable()
24-
{
25-
Mail::fake();
13+
test('the mail commands sends the mailable', function ()
14+
{
15+
Mail::fake();
2616

27-
$this->artisan(TestMailCommand::class);
17+
$this->artisan(TestMailCommand::class);
2818

29-
Mail::assertSent(TestMail::class);
30-
}
19+
Mail::assertSent(TestMail::class);
20+
});
3121

32-
/** @test */
33-
public function test_plain_text_mails_work_correctly()
34-
{
35-
Mail::fake();
22+
test('plain text mails work correctly(', function ()
23+
{
24+
Mail::fake();
3625

37-
Mail::to('test@usehelo.com')->send(new TestMail(true));
26+
Mail::to('test@usehelo.com')->send(new TestMail(true));
3827

39-
Mail::assertSent(TestMail::class);
40-
}
28+
Mail::assertSent(TestMail::class);
29+
});
4130

42-
/** @test */
43-
public function test_the_correct_mailer_is_binded()
44-
{
45-
$mailer = app(Mailer::class);
31+
test('the correct mailer is binded', function () {
32+
$mailer = app(Mailer::class);
4633

47-
if (version_compare(app()->version(), '7.0.0', '<')) {
48-
$this->assertTrue($mailer instanceof Mailer);
49-
} else {
50-
$this->assertTrue($mailer instanceof Laravel7Mailer);
51-
}
34+
if (version_compare(app()->version(), '7.0.0', '<')) {
35+
$this->assertTrue($mailer instanceof Mailer);
36+
} else {
37+
$this->assertTrue($mailer instanceof Laravel7Mailer);
5238
}
53-
}
39+
});

tests/Pest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

tests/TestCase.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace BeyondCode\HeloLaravel\Tests;
4+
5+
use BeyondCode\HeloLaravel\HeloLaravelServiceProvider;
6+
use Orchestra\Testbench\TestCase as BaseTestCase;
7+
8+
class TestCase extends BaseTestCase
9+
{
10+
protected function getPackageProviders($app)
11+
{
12+
return [
13+
HeloLaravelServiceProvider::class
14+
];
15+
}
16+
}

0 commit comments

Comments
 (0)