Skip to content

Commit 4ba195b

Browse files
committed
Added $newInstance param to createCollection().
1 parent b1d59ca commit 4ba195b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tools/functions.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
* @subpackage Tools
2323
* @return ModCollection
2424
*/
25-
function createTestCollection() : ModCollection
25+
function createTestCollection(bool $newInstance=false) : ModCollection
2626
{
2727
$key = '__test_cpmdb_mod_collection';
2828

29-
if(isset($GLOBALS[$key])) {
29+
if($newInstance && isset($GLOBALS[$key])) {
3030
return $GLOBALS[$key];
3131
}
3232

@@ -36,7 +36,9 @@ function createTestCollection() : ModCollection
3636
'http://127.0.0.1/cpmdb'
3737
);
3838

39-
$GLOBALS[$key] = $collection;
39+
if(!$newInstance) {
40+
$GLOBALS[$key] = $collection;
41+
}
4042

4143
return $collection;
4244
}

0 commit comments

Comments
 (0)