@@ -154,6 +154,57 @@ public function testSetGetTempDir()
154
154
$ this ->assertSame (__DIR__ .DIRECTORY_SEPARATOR , $ this ->server ->getTempDir ());
155
155
}
156
156
157
+ public function testSetCachePathCallable ()
158
+ {
159
+ $ this ->server ->setCachePathCallable (null );
160
+ $ this ->assertEquals (null , $ this ->server ->getCachePathCallable ());
161
+ }
162
+
163
+ public function testGetCachePathCallable ()
164
+ {
165
+ $ this ->assertEquals (null , $ this ->server ->getCachePathCallable ());
166
+ }
167
+
168
+ public function testCachePathCallableIsCalledOnGetCachePath ()
169
+ {
170
+ $ expected = 'TEST ' ;
171
+ $ callable = function () use ($ expected ) {
172
+ return $ expected ;
173
+ };
174
+
175
+ $ this ->server ->setCachePathCallable ($ callable );
176
+
177
+ self ::assertEquals ($ expected , $ this ->server ->getCachePath ('' ));
178
+ }
179
+
180
+ public function testSetCachePathCallableIsBoundClosure ()
181
+ {
182
+ $ server = $ this ->server ;
183
+ $ phpUnit = $ this ;
184
+ $ this ->server ->setCachePathCallable (function () use ($ phpUnit , $ server ) {
185
+ $ phpUnit ::assertEquals ($ server , $ this );
186
+ });
187
+
188
+ $ this ->server ->getCachePath ('' );
189
+ }
190
+
191
+ public function testSetCachePathCallableArgumentsAreSameAsGetCachePath ()
192
+ {
193
+ $ phpUnit = $ this ;
194
+ $ pathArgument = 'TEST ' ;
195
+ $ optionsArgument = [
196
+ 'TEST ' => 'TEST ' ,
197
+ ];
198
+ $ this ->server ->setCachePathCallable (function () use ($ optionsArgument , $ pathArgument , $ phpUnit ) {
199
+ $ arguments = func_get_args ();
200
+ $ phpUnit ::assertCount (2 , $ arguments );
201
+ $ phpUnit ::assertEquals ($ arguments [0 ], $ pathArgument );
202
+ $ phpUnit ::assertEquals ($ arguments [1 ], $ optionsArgument );
203
+ });
204
+
205
+ $ this ->server ->getCachePath ($ pathArgument , $ optionsArgument );
206
+ }
207
+
157
208
public function testSetGroupCacheInFolders ()
158
209
{
159
210
$ this ->server ->setGroupCacheInFolders (false );
0 commit comments