lithium\test\Group::add()
Add a tests to the group.
Parameters
-
string
$test
The test to be added.
-
array
$options
Method options. Currently not used in this method.
Returns
arrayUpdated list of tests contained within this collection.
Source
public function add($test = null, array $options = []) {
$resolve = function($test) {
switch (true) {
case !$test:
return [];
case is_object($test) && $test instanceof Unit:
return [get_class($test)];
case is_string($test) && !file_exists(Libraries::path($test)):
return $this->_resolve($test);
default:
return (array) $test;
}
};
if (is_array($test)) {
foreach ($test as $t) {
$this->_data = array_filter(array_merge($this->_data, $resolve($t)));
}
return $this->_data;
}
return $this->_data = array_merge($this->_data, $resolve($test));
}