-
Notifications
You must be signed in to change notification settings - Fork 65
/
ListCommandTest.php
64 lines (52 loc) · 1.52 KB
/
ListCommandTest.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
<?php
namespace tests\Console\Commands\Domain;
use AbuseIO\Models\Domain;
use Illuminate\Support\Facades\Artisan;
use tests\TestCase;
/**
* Class ListCommandTest.
*/
class ListCommandTest extends TestCase
{
public function testHeaders()
{
$exitCode = Artisan::call('domain:list', []);
$this->assertEquals($exitCode, 0);
$headers = ['Id', 'Contact', 'Name', 'Enabled'];
$output = Artisan::output();
foreach ($headers as $header) {
$this->assertContains($header, $output);
}
}
public function testAll()
{
$domain = Domain::all()->random();
$contact = $domain->contact;
$exitCode = Artisan::call('domain:list', []);
$this->assertEquals($exitCode, 0);
$this->assertContains($contact->name, Artisan::output());
}
public function testFilter()
{
$exitCode = Artisan::call(
'domain:list',
[
'--filter' => 'customer1.tld',
]
);
$this->assertEquals($exitCode, 0);
$this->assertContains('customer1.tld', Artisan::output());
$this->assertNotContains('johndoe.tld', Artisan::output());
}
public function testNotFoundFilter()
{
$exitCode = Artisan::call(
'domain:list',
[
'--filter' => 'domain_unknown.com',
]
);
$this->assertEquals($exitCode, 0);
$this->assertContains('No domain found for given filter.', Artisan::output());
}
}