forked from nWidart/laravel-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublishCommandTest.php
42 lines (35 loc) · 1.03 KB
/
PublishCommandTest.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
<?php
namespace Nwidart\Modules\Tests\Commands;
use Nwidart\Modules\Contracts\RepositoryInterface;
use Nwidart\Modules\Tests\BaseTestCase;
class PublishCommandTest extends BaseTestCase
{
/**
* @var \Illuminate\Filesystem\Filesystem
*/
private $finder;
/**
* @var string
*/
private $modulePath;
public function setUp(): void
{
parent::setUp();
$this->modulePath = base_path('modules/Blog');
$this->finder = $this->app['files'];
$this->artisan('module:make', ['name' => ['Blog']]);
$this->finder->put($this->modulePath . '/Assets/script.js', 'assetfile');
}
public function tearDown(): void
{
$this->app[RepositoryInterface::class]->delete('Blog');
parent::tearDown();
}
/** @test */
public function it_published_module_assets()
{
$code = $this->artisan('module:publish', ['module' => 'Blog']);
$this->assertTrue(is_file(public_path('modules/blog/script.js')));
$this->assertSame(0, $code);
}
}