Skip to content

Commit 5e73348

Browse files
committed
test: domain & job
1 parent 8d3b7f0 commit 5e73348

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

tests/Cli/DomainsTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Bit\Skeleton\Tests\Cli;
4+
5+
use Bit\Skeleton\Tests\TestCase;
6+
7+
class DomainsTest extends TestCase
8+
{
9+
public function test_can_execute_domain_make_command_when_it_does_not_exist()
10+
{
11+
$this->artisan('bit.domain:make FooBar')
12+
->expectsOutput('Domain created successfully!')
13+
->assertSuccessful();
14+
}
15+
16+
public function test_cannot_execute_domain_make_command_when_it_already_exists()
17+
{
18+
$this->artisan('bit.domain:make FooBar');
19+
$this->artisan('bit.domain:make FooBar')
20+
->expectsOutput('Domain already exists!')
21+
->assertFailed();
22+
}
23+
}

tests/Cli/JobsTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Bit\Skeleton\Tests\Cli;
4+
5+
use Bit\Skeleton\Tests\TestCase;
6+
7+
class JobsTest extends TestCase
8+
{
9+
public function test_can_execute_job_make_command_when_it_does_not_exist()
10+
{
11+
$this->artisan('bit.domain:make FooBar');
12+
$this->artisan('bit.job:make FooJob -D FooBar')
13+
->expectsOutput('Job created successfully!')
14+
->assertSuccessful();
15+
}
16+
17+
public function test_cannot_execute_job_make_command_when_missing_domain_option()
18+
{
19+
$this->artisan('bit.job:make FooJob')
20+
->expectsOutput('Domain option is required!')
21+
->assertFailed();
22+
}
23+
24+
public function test_cannot_execute_job_make_command_when_it_already_exists()
25+
{
26+
$this->artisan('bit.domain:make FooBar');
27+
$this->artisan('bit.job:make FooJob -D FooBar');
28+
$this->artisan('bit.job:make FooJob -D FooBar')
29+
->expectsOutput('Job already exists!')
30+
->assertFailed();
31+
}
32+
}

tests/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function setUp(): void
1818
public function tearDown(): void
1919
{
2020
(new Filesystem)->cleanDirectory(service_path());
21+
(new Filesystem)->cleanDirectory(domain_path());
2122
Mockery::close();
2223
}
2324

0 commit comments

Comments
 (0)