-
Notifications
You must be signed in to change notification settings - Fork 11.3k
/
Copy pathMailMakeCommandTest.php
74 lines (61 loc) · 2.34 KB
/
MailMakeCommandTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
namespace Illuminate\Tests\Integration\Generators;
class MailMakeCommandTest extends TestCase
{
protected $files = [
'app/Mail/FooMail.php',
'resources/views/foo-mail.blade.php',
'tests/Feature/Mail/FooMailTest.php',
];
public function testItCanGenerateMailFile()
{
$this->artisan('make:mail', ['name' => 'FooMail'])
->assertExitCode(0);
$this->assertFileContains([
'namespace App\Mail;',
'use Illuminate\Mail\Mailable;',
'class FooMail extends Mailable',
], 'app/Mail/FooMail.php');
$this->assertFilenameNotExists('resources/views/foo-mail.blade.php');
$this->assertFilenameNotExists('tests/Feature/Mail/FooMailTest.php');
}
public function testItCanGenerateMailFileWithMarkdownOption()
{
$this->artisan('make:mail', ['name' => 'FooMail', '--markdown' => 'foo-mail'])
->assertExitCode(0);
$this->assertFileContains([
'namespace App\Mail;',
'use Illuminate\Mail\Mailable;',
'class FooMail extends Mailable',
'return new Content(',
"markdown: 'foo-mail',",
], 'app/Mail/FooMail.php');
$this->assertFileContains([
'<x-mail::message>',
'<x-mail::button :url="\'\'">',
'</x-mail::button>',
'</x-mail::message>',
], 'resources/views/foo-mail.blade.php');
}
public function testItCanGenerateMailFileWithViewOption()
{
$this->artisan('make:mail', ['name' => 'FooMail', '--view' => 'foo-mail'])
->assertExitCode(0);
$this->assertFileContains([
'namespace App\Mail;',
'use Illuminate\Mail\Mailable;',
'class FooMail extends Mailable',
'return new Content(',
"view: 'foo-mail',",
], 'app/Mail/FooMail.php');
$this->assertFilenameExists('resources/views/foo-mail.blade.php');
}
public function testItCanGenerateMailFileWithTest()
{
$this->artisan('make:mail', ['name' => 'FooMail', '--test' => true])
->assertExitCode(0);
$this->assertFilenameExists('app/Mail/FooMail.php');
$this->assertFilenameNotExists('resources/views/foo-mail.blade.php');
$this->assertFilenameExists('tests/Feature/Mail/FooMailTest.php');
}
}