Skip to content

Commit 1bd22cc

Browse files
committed
test: domain generator
1 parent cbc751e commit 1bd22cc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/Unit/DomainGeneratorTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace Bit\Skeleton\Tests\Unit;
4+
5+
use Mockery;
6+
use Mockery\MockInterface;
7+
use Bit\Skeleton\Tests\TestCase;
8+
use Illuminate\Filesystem\Filesystem;
9+
use Bit\Skeleton\Generators\DomainGenerator;
10+
use Bit\Skeleton\Exceptions\EntityAlreadyExistsException;
11+
12+
class DomainGeneratorTest extends TestCase
13+
{
14+
public function test_can_generate_a_domain_when_it_does_not_exist()
15+
{
16+
app(DomainGenerator::class)->generate('FooBar');
17+
18+
$domainExists = (new Filesystem)->exists(domain_path('FooBar'));
19+
20+
$this->assertEquals(true, $domainExists);
21+
}
22+
23+
public function test_cannot_generate_a_domain_when_it_already_exists()
24+
{
25+
$this->expectException(EntityAlreadyExistsException::class);
26+
$this->expectExceptionMessage('Domain already exists!');
27+
28+
app(DomainGenerator::class)->generate('FooBar');
29+
app(DomainGenerator::class)->generate('FooBar');
30+
}
31+
}

0 commit comments

Comments
 (0)