Skip to content

Commit 3513cae

Browse files
authored
Merge pull request #1 from butschster/feature/smtp-server
Added test for SMTP server
2 parents e88aa7c + e62dd86 commit 3513cae

File tree

6 files changed

+84
-18
lines changed

6 files changed

+84
-18
lines changed

app/Mail/OrderShipped.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace App\Mail;
44

55
use Illuminate\Bus\Queueable;
6-
use Illuminate\Contracts\Queue\ShouldQueue;
76
use Illuminate\Mail\Mailable;
87
use Illuminate\Queue\SerializesModels;
98

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<server name="CACHE_DRIVER" value="array"/>
2121
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
2222
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
23-
<server name="MAIL_MAILER" value="array"/>
23+
<!-- <server name="MAIL_MAILER" value="array"/> -->
2424
<server name="QUEUE_CONNECTION" value="sync"/>
2525
<server name="SESSION_DRIVER" value="array"/>
2626
<server name="TELESCOPE_ENABLED" value="false"/>

tests/Feature/LandingTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Tests\Feature;
5+
6+
use Tests\TestCase;
7+
8+
class LandingTest extends TestCase
9+
{
10+
protected function setUp(): void
11+
{
12+
parent::setUp();
13+
14+
logger()->setDefaultDriver('null');
15+
}
16+
17+
function test_log()
18+
{
19+
ray()->trace()->hide();
20+
21+
ray($this)->hide();
22+
23+
ray(['I\'m RayServer'])->blue()->label('Welcome');
24+
ray('Hello Artisans!')->large();
25+
26+
27+
$this->assertTrue(true);
28+
}
29+
30+
function test_colors_and_labels()
31+
{
32+
ray(['I\'m RayServer'])->blue()->label('Welcome');
33+
ray('Hello Artisans!')->large()->purple();
34+
ray('this is red')->red();
35+
ray('this is blue')->green()->label('Super label');
36+
}
37+
}

tests/Feature/RayLaravelTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ function test_handling_models()
9090
User::firstWhere('email', '[email protected]')
9191
);
9292

93-
ray()->model(User::all());
93+
ray()->model(new User([
94+
'username' => 'john',
95+
'email' => '[email protected]'
96+
]));
9497

9598
$this->assertTrue(true);
9699
}

tests/Feature/RayTest.php

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,32 @@
77

88
class RayTest extends TestCase
99
{
10+
function test_new_screen()
11+
{
12+
ray()->newScreen();
13+
14+
$this->assertTrue(true);
15+
}
16+
17+
function test_clear_all()
18+
{
19+
ray()->clearAll();
20+
21+
$this->assertTrue(true);
22+
}
23+
1024
function test_log()
1125
{
12-
ray('a string');
26+
ray('Hello', 'World');
1327

1428
ray(['an array']);
1529

30+
ray(true, false);
31+
1632
ray($this);
1733

34+
ray(['a' => 1, 'b' => ['c' => 3]]);
35+
1836
$this->assertTrue(true);
1937
}
2038

@@ -46,27 +64,13 @@ function test_labels()
4664
$this->assertTrue(true);
4765
}
4866

49-
function test_new_screen()
50-
{
51-
ray()->newScreen();
52-
53-
$this->assertTrue(true);
54-
}
55-
5667
function test_new_screen_with_name()
5768
{
5869
ray()->newScreen('My debug screen');
5970

6071
$this->assertTrue(true);
6172
}
6273

63-
function test_clear_all()
64-
{
65-
ray()->clearAll();
66-
67-
$this->assertTrue(true);
68-
}
69-
7074
function test_caller()
7175
{
7276
ray()->caller();

tests/Feature/SMTPTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace Tests\Feature;
5+
6+
use App\Mail\OrderShipped;
7+
use Illuminate\Support\Facades\Mail;
8+
use Tests\TestCase;
9+
10+
class SMTPTest extends TestCase
11+
{
12+
protected function setUp(): void
13+
{
14+
parent::setUp();
15+
ray()->disable();
16+
}
17+
18+
function test_send_mail()
19+
{
20+
Mail::to(['[email protected]', '[email protected]'])->send(new OrderShipped());
21+
$this->assertTrue(true);
22+
}
23+
}

0 commit comments

Comments
 (0)