Skip to content

Commit ab8118d

Browse files
committed
wip: starting tests
1 parent bc43f80 commit ab8118d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

tests/TestCase.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Support\Facades\View;
77
use Symfony\Component\HttpFoundation\Response;
88
use Orchestra\Testbench\TestCase as OrchestraTestCase;
9+
use Spatie\ViewModels\Providers\ViewModelsServiceProvider;
910

1011
class TestCase extends OrchestraTestCase
1112
{
@@ -31,4 +32,9 @@ protected function getResponseBody(Response $response): array
3132
{
3233
return json_decode($response->getContent(), true);
3334
}
35+
36+
protected function getPackageProviders($app)
37+
{
38+
return [ ViewModelsServiceProvider::class ];
39+
}
3440
}

tests/ViewModelMakeCommandTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Spatie\ViewModels\Tests;
4+
5+
use Illuminate\Http\Response;
6+
use Illuminate\Http\JsonResponse;
7+
use Illuminate\Support\Facades\Artisan;
8+
9+
class ViewModelMakeCommandTest extends TestCase
10+
{
11+
/** @test */
12+
public function command_returns_signal_zero()
13+
{
14+
$a = Artisan::call('make:view-model', [ 'name' => 'PostsViewModel']);
15+
16+
$b = Artisan::output();
17+
18+
dd($a, $b);
19+
}
20+
}

0 commit comments

Comments
 (0)