@@ -75,29 +75,6 @@ public function testSingleServiceWithAtLeastOneParamSupplied(string $service): v
7575 }
7676 }
7777
78- public function testSingleServiceWithAllParamsSupplied (): void
79- {
80- $ cache1 = single_service ('cache ' , null , true );
81- $ cache2 = single_service ('cache ' , null , true );
82-
83- assert ($ cache1 !== null );
84- assert ($ cache2 !== null );
85-
86- // Assert that even passing true as last param this will
87- // not create a shared instance.
88- $ this ->assertInstanceOf ($ cache1 ::class, $ cache2 );
89- $ this ->assertNotSame ($ cache1 , $ cache2 );
90- }
91-
92- public function testSingleServiceWithGibberishGiven (): void
93- {
94- $ this ->assertNull (single_service ('foo ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
95- $ this ->assertNull (single_service ('bar ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
96- $ this ->assertNull (single_service ('baz ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
97- $ this ->assertNull (single_service ('caches ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
98- $ this ->assertNull (single_service ('timers ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
99- }
100-
10178 /**
10279 * @return iterable<string, array{string}>
10380 */
@@ -137,4 +114,27 @@ public static function provideServiceNames(): iterable
137114
138115 yield from $ services ;
139116 }
117+
118+ public function testSingleServiceWithAllParamsSupplied (): void
119+ {
120+ $ cache1 = single_service ('cache ' , null , true );
121+ $ cache2 = single_service ('cache ' , null , true );
122+
123+ assert ($ cache1 !== null );
124+ assert ($ cache2 !== null );
125+
126+ // Assert that even passing true as last param this will
127+ // not create a shared instance.
128+ $ this ->assertInstanceOf ($ cache1 ::class, $ cache2 );
129+ $ this ->assertNotSame ($ cache1 , $ cache2 );
130+ }
131+
132+ public function testSingleServiceWithGibberishGiven (): void
133+ {
134+ $ this ->assertNull (single_service ('foo ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
135+ $ this ->assertNull (single_service ('bar ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
136+ $ this ->assertNull (single_service ('baz ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
137+ $ this ->assertNull (single_service ('caches ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
138+ $ this ->assertNull (single_service ('timers ' )); // @phpstan-ignore codeigniter.unknownServiceMethod
139+ }
140140}
0 commit comments