lithium\test\Group::add()

public method

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

array

Updated list of tests contained within this collection.

Source

	public function add($test = null, array $options = array()) {
		$resolve = function($self, $test) {
			switch (true) {
				case !$test:
					return array();
				case is_object($test) && $test instanceof Unit:
					return array(get_class($test));
				case is_string($test) && !file_exists(Libraries::path($test)):
					return $self->invokeMethod('_resolve', array($test));
				default:
					return (array) $test;
			}
		};
		if (is_array($test)) {
			foreach ($test as $t) {
				$this->_data = array_filter(array_merge($this->_data, $resolve($this, $t)));
			}
			return $this->_data;
		}
		return $this->_data = array_merge($this->_data, $resolve($this, $test));
	}