This repository was archived by the owner on Mar 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace SwooleTW \Http \Tests \Server ;
4
4
5
- use Mockery as m ;
6
5
use Illuminate \Container \Container ;
6
+ use Mockery as m ;
7
7
use SwooleTW \Http \Server \PidManager ;
8
8
use SwooleTW \Http \Server \PidManagerFactory ;
9
9
use SwooleTW \Http \Tests \TestCase ;
@@ -14,7 +14,7 @@ public function testFactoryReturnsAPidManager()
14
14
{
15
15
$ factory = new PidManagerFactory ($ container = new Container );
16
16
17
- $ config = m:: mock (ConfigContract::class );
17
+ $ config = $ this -> getConfig ( );
18
18
19
19
$ container ->singleton (ConfigContract::class, function () use ($ config ) {
20
20
return $ config ;
@@ -24,4 +24,21 @@ public function testFactoryReturnsAPidManager()
24
24
25
25
$ this ->assertInstanceOf (PidManager::class, $ factory ($ container ));
26
26
}
27
+
28
+ protected function getConfig ()
29
+ {
30
+ $ config = m::mock (ConfigContract::class);
31
+ $ callback = function ($ key ) {
32
+ return $ this ->config [$ key ] ?? '' ;
33
+ };
34
+
35
+ $ config ->shouldReceive ('get ' )
36
+ ->with (m::type ('string ' ), m::any ())
37
+ ->andReturnUsing ($ callback );
38
+ $ config ->shouldReceive ('get ' )
39
+ ->with (m::type ('string ' ))
40
+ ->andReturnUsing ($ callback );
41
+
42
+ return $ config ;
43
+ }
27
44
}
You can’t perform that action at this time.
0 commit comments