@@ -34,24 +34,6 @@ protected function getEnvironmentSetUp($app)
3434
3535 public function test (): void
3636 {
37- $ actualContent = null ;
38-
39- $ mockFilesystem = Mockery::mock (Filesystem::class)->makePartial ();
40- $ mockFilesystem
41- ->shouldReceive ('get ' )
42- ->andReturn (file_get_contents (__DIR__ . '/Models/Simple.php ' ))
43- ->once ();
44- $ mockFilesystem
45- ->shouldReceive ('put ' )
46- ->with (
47- Mockery::any (),
48- Mockery::capture ($ actualContent )
49- )
50- ->andReturn (1 ) // Simulate we wrote _something_ to the file
51- ->once ();
52-
53- $ this ->instance (Filesystem::class, $ mockFilesystem );
54-
5537 $ command = $ this ->app ->make (ModelsCommand::class);
5638
5739 $ tester = $ this ->runCommand ($ command , [
@@ -60,33 +42,6 @@ public function test(): void
6042
6143 $ this ->assertSame (0 , $ tester ->getStatusCode ());
6244 $ this ->assertStringContainsString ('Written new phpDocBlock to ' , $ tester ->getDisplay ());
63-
64- $ expectedContent = <<<'PHP'
65- <?php
66-
67- declare(strict_types=1);
68-
69- namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Models;
70-
71- use Illuminate\Database\Eloquent\Model;
72-
73- /**
74- *
75- *
76- * @property int $id
77- * @property-read string $custom
78- * @method static \Illuminate\Database\Eloquent\Builder<static>|Simple custom($custom)
79- * @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
80- * @method static \Illuminate\Database\Eloquent\Builder<static>|Simple query()
81- * @method static \Illuminate\Database\Eloquent\Builder<static>|Simple whereId($value)
82- * @mixin \Eloquent
83- */
84- class Simple extends Model
85- {
86- }
87-
88- PHP;
89-
90- $ this ->assertSame ($ expectedContent , $ actualContent );
45+ $ this ->assertMatchesMockedSnapshot ();
9146 }
9247}
0 commit comments