4
4
5
5
use ErrorException ;
6
6
use Illuminate \Config \Repository as Config ;
7
- use Illuminate \Container \ Container ;
7
+ use Illuminate \Foundation \ Application ;
8
8
use Illuminate \Foundation \Bootstrap \HandleExceptions ;
9
9
use Illuminate \Log \LogManager ;
10
10
use Mockery as m ;
@@ -16,11 +16,11 @@ class HandleExceptionsTest extends TestCase
16
16
{
17
17
protected function setUp (): void
18
18
{
19
- $ this ->container = Container ::setInstance (new Container );
19
+ $ this ->app = Application ::setInstance (new Application );
20
20
21
21
$ this ->config = new Config ();
22
22
23
- $ this ->container ->singleton ('config ' , function () {
23
+ $ this ->app ->singleton ('config ' , function () {
24
24
return $ this ->config ;
25
25
});
26
26
@@ -31,20 +31,24 @@ protected function setUp(): void
31
31
32
32
$ property ->setValue (
33
33
$ this ->handleExceptions ,
34
- $ this ->container
34
+ tap (m::mock ($ this ->app ), function ($ app ) {
35
+ $ app ->shouldReceive ('runningUnitTests ' )->andReturn (false );
36
+ $ app ->shouldReceive ('hasBeenBootstrapped ' )->andReturn (true );
37
+ })
35
38
);
36
39
});
37
40
}
38
41
39
42
protected function tearDown (): void
40
43
{
41
- Container ::setInstance (null );
44
+ Application ::setInstance (null );
42
45
}
43
46
44
47
public function testPhpDeprecations ()
45
48
{
46
49
$ logger = m::mock (LogManager::class);
47
- $ this ->container ->instance (LogManager::class, $ logger );
50
+ $ this ->app ->instance (LogManager::class, $ logger );
51
+
48
52
$ logger ->shouldReceive ('channel ' )->with ('deprecations ' )->andReturnSelf ();
49
53
$ logger ->shouldReceive ('warning ' )->with (sprintf ('%s in %s on line %s ' ,
50
54
'str_contains(): Passing null to parameter #2 ($needle) of type string is deprecated ' ,
@@ -63,7 +67,8 @@ public function testPhpDeprecations()
63
67
public function testUserDeprecations ()
64
68
{
65
69
$ logger = m::mock (LogManager::class);
66
- $ this ->container ->instance (LogManager::class, $ logger );
70
+ $ this ->app ->instance (LogManager::class, $ logger );
71
+
67
72
$ logger ->shouldReceive ('channel ' )->with ('deprecations ' )->andReturnSelf ();
68
73
$ logger ->shouldReceive ('warning ' )->with (sprintf ('%s in %s on line %s ' ,
69
74
'str_contains(): Passing null to parameter #2 ($needle) of type string is deprecated ' ,
@@ -82,7 +87,8 @@ public function testUserDeprecations()
82
87
public function testErrors ()
83
88
{
84
89
$ logger = m::mock (LogManager::class);
85
- $ this ->container ->instance (LogManager::class, $ logger );
90
+ $ this ->app ->instance (LogManager::class, $ logger );
91
+
86
92
$ logger ->shouldNotReceive ('channel ' );
87
93
$ logger ->shouldNotReceive ('warning ' );
88
94
@@ -100,7 +106,8 @@ public function testErrors()
100
106
public function testEnsuresDeprecationsDriver ()
101
107
{
102
108
$ logger = m::mock (LogManager::class);
103
- $ this ->container ->instance (LogManager::class, $ logger );
109
+ $ this ->app ->instance (LogManager::class, $ logger );
110
+
104
111
$ logger ->shouldReceive ('channel ' )->andReturnSelf ();
105
112
$ logger ->shouldReceive ('warning ' );
106
113
@@ -131,7 +138,8 @@ public function testEnsuresDeprecationsDriver()
131
138
public function testEnsuresNullDeprecationsDriver ()
132
139
{
133
140
$ logger = m::mock (LogManager::class);
134
- $ this ->container ->instance (LogManager::class, $ logger );
141
+ $ this ->app ->instance (LogManager::class, $ logger );
142
+
135
143
$ logger ->shouldReceive ('channel ' )->andReturnSelf ();
136
144
$ logger ->shouldReceive ('warning ' );
137
145
@@ -151,7 +159,8 @@ public function testEnsuresNullDeprecationsDriver()
151
159
public function testEnsuresNullLogDriver ()
152
160
{
153
161
$ logger = m::mock (LogManager::class);
154
- $ this ->container ->instance (LogManager::class, $ logger );
162
+ $ this ->app ->instance (LogManager::class, $ logger );
163
+
155
164
$ logger ->shouldReceive ('channel ' )->andReturnSelf ();
156
165
$ logger ->shouldReceive ('warning ' );
157
166
@@ -171,7 +180,8 @@ public function testEnsuresNullLogDriver()
171
180
public function testDoNotOverrideExistingNullLogDriver ()
172
181
{
173
182
$ logger = m::mock (LogManager::class);
174
- $ this ->container ->instance (LogManager::class, $ logger );
183
+ $ this ->app ->instance (LogManager::class, $ logger );
184
+
175
185
$ logger ->shouldReceive ('channel ' )->andReturnSelf ();
176
186
$ logger ->shouldReceive ('warning ' );
177
187
0 commit comments