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 22
33namespace SwooleTW \Http \Tests \Server ;
44
5- use Mockery as m ;
65use Illuminate \Container \Container ;
6+ use Mockery as m ;
77use SwooleTW \Http \Server \PidManager ;
88use SwooleTW \Http \Server \PidManagerFactory ;
99use SwooleTW \Http \Tests \TestCase ;
@@ -14,7 +14,7 @@ public function testFactoryReturnsAPidManager()
1414 {
1515 $ factory = new PidManagerFactory ($ container = new Container );
1616
17- $ config = m:: mock (ConfigContract::class );
17+ $ config = $ this -> getConfig ( );
1818
1919 $ container ->singleton (ConfigContract::class, function () use ($ config ) {
2020 return $ config ;
@@ -24,4 +24,21 @@ public function testFactoryReturnsAPidManager()
2424
2525 $ this ->assertInstanceOf (PidManager::class, $ factory ($ container ));
2626 }
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+ }
2744}
You can’t perform that action at this time.
0 commit comments