| Total Complexity | 5 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class HydePublishViewsCommandTest extends TestCase |
||
| 12 | { |
||
| 13 | protected function setUp(): void |
||
| 14 | { |
||
| 15 | parent::setUp(); |
||
| 16 | |||
| 17 | backupDirectory(Hyde::path('resources/views/vendor/hyde')); |
||
| 18 | deleteDirectory(Hyde::path('resources/views/vendor/hyde')); |
||
| 19 | } |
||
| 20 | |||
| 21 | protected function tearDown(): void |
||
| 22 | { |
||
| 23 | restoreDirectory(Hyde::path('resources/views/vendor/hyde')); |
||
| 24 | |||
| 25 | parent::tearDown(); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function test_command_publishes_views() |
||
| 29 | { |
||
| 30 | $this->artisan('publish:views all') |
||
| 31 | ->expectsOutput('Copied [vendor/hyde/framework/resources/views/pages/404.blade.php] to [_pages/404.blade.php]') |
||
| 32 | ->assertExitCode(0); |
||
| 33 | |||
| 34 | $this->assertFileExists(Hyde::path('resources/views/vendor/hyde/layouts/app.blade.php')); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function test_command_prompts_for_input() |
||
| 38 | { |
||
| 39 | $this->artisan('publish:views') |
||
| 40 | ->expectsQuestion('Which category do you want to publish?', 'all') |
||
| 41 | ->assertExitCode(0); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function test_can_select_view() |
||
| 45 | { |
||
| 46 | $this->artisan('publish:views 404') |
||
| 47 | ->expectsOutput('Copied [vendor/hyde/framework/resources/views/pages/404.blade.php] to [_pages/404.blade.php]') |
||
| 48 | ->assertExitCode(0); |
||
| 49 | |||
| 50 | $this->assertFileExists(Hyde::path('_pages/404.blade.php')); |
||
| 51 | } |
||
| 53 |