3
3
namespace Staudenmeir \LaravelAdjacencyList \Tests \IdeHelper ;
4
4
5
5
use Barryvdh \LaravelIdeHelper \Console \ModelsCommand ;
6
+ use Illuminate \Contracts \Config \Repository ;
7
+ use Illuminate \Contracts \Foundation \Application ;
6
8
use Mockery ;
7
9
use Mockery \Adapter \Phpunit \MockeryPHPUnitIntegration ;
8
10
use PHPUnit \Framework \TestCase ;
@@ -16,11 +18,14 @@ class RecursiveRelationsHookTest extends TestCase
16
18
17
19
public function testTreeRelations (): void
18
20
{
19
- $ config = Mockery::mock ();
21
+ $ config = Mockery::mock (Repository::class );
20
22
$ config ->shouldReceive ('get ' )->andReturn (true );
21
23
24
+ $ app = Mockery::mock (Application::class);
25
+ $ app ->shouldReceive ('make ' )->andReturn ($ config );
26
+
22
27
$ command = Mockery::mock (ModelsCommand::class);
23
- $ command ->shouldReceive ('getLaravel ' )->andReturn ([ ' config ' => $ config ] );
28
+ $ command ->shouldReceive ('getLaravel ' )->andReturn ($ app );
24
29
$ command ->shouldReceive ('setProperty ' )->times (2 );
25
30
$ command ->shouldReceive ('setProperty ' )->once ()->with (
26
31
'ancestorsAndSelf ' ,
@@ -55,11 +60,14 @@ public function testTreeRelations(): void
55
60
56
61
public function testGraphRelations (): void
57
62
{
58
- $ config = Mockery::mock ();
63
+ $ config = Mockery::mock (Repository::class );
59
64
$ config ->shouldReceive ('get ' )->andReturn (true );
60
65
66
+ $ app = Mockery::mock (Application::class);
67
+ $ app ->shouldReceive ('make ' )->andReturn ($ config );
68
+
61
69
$ command = Mockery::mock (ModelsCommand::class);
62
- $ command ->shouldReceive ('getLaravel ' )->andReturn ([ ' config ' => $ config ] );
70
+ $ command ->shouldReceive ('getLaravel ' )->andReturn ($ app );
63
71
$ command ->shouldReceive ('setProperty ' )->times (2 );
64
72
$ command ->shouldReceive ('setProperty ' )->once ()->with (
65
73
'ancestorsAndSelf ' ,
0 commit comments