lithium\test\Group::add PHP Method

add() public method

Add a tests to the group.
public add ( string $test = null, array $options = [] ) : array
$test string The test to be added.
$options array Method options. Currently not used in this method.
return array Updated list of tests contained within this collection.
    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));
    }

Usage Example

コード例 #1
0
ファイル: AffectedTest.php プロジェクト: EHER/chegamos
 public function testCyclicDependency()
 {
     $group = new Group();
     $group->add('lithium\\tests\\cases\\g11n\\CatalogTest');
     $group->add('lithium\\tests\\cases\\g11n\\MessageTest');
     $this->report->group = $group;
     $tests = Affected::apply($this->report, $group->tests());
     $expected = array('lithium\\tests\\cases\\g11n\\CatalogTest', 'lithium\\tests\\cases\\g11n\\MessageTest', 'lithium\\tests\\cases\\console\\command\\g11n\\ExtractTest');
     $result = $tests->map('get_class', array('collect' => false));
     $this->assertEqual($expected, $result);
 }
All Usage Examples Of lithium\test\Group::add