lithium\test\Group::tests PHP Method

tests() public method

Get the collection of tests
public tests ( string | array $params = [], array $options = [] ) : Collection
$params string | array
$options array
return lithium\util\Collection
    public function tests($params = array(), array $options = array())
    {
        $tests = new Collection();
        foreach ($this->_data as $test) {
            if (!class_exists($test)) {
                throw new Exception("Test case `{$test}` not found.");
            }
            $tests[] = new $test();
        }
        return $tests;
    }

Usage Example

コード例 #1
0
ファイル: GroupTest.php プロジェクト: EHER/monopolis
 public function testTestsRun()
 {
     $group = new Group();
     $result = $group->add('lithium\\tests\\mocks\\test\\MockUnitTest');
     $expected = array('lithium\\tests\\mocks\\test\\MockUnitTest');
     $this->assertEqual($expected, $result);
     $results = $group->tests();
     $this->assertTrue(is_a($results, 'lithium\\util\\Collection'));
     $results = $group->tests();
     $this->assertTrue(is_a($results->current(), 'lithium\\tests\\mocks\\test\\MockUnitTest'));
     $results = $group->tests()->run();
     $expected = 'pass';
     $result = $results[0][0]['result'];
     $this->assertEqual($expected, $result);
     $expected = 'testNothing';
     $result = $results[0][0]['method'];
     $this->assertEqual($expected, $result);
     $expected = 'lithium\\tests\\mocks\\test\\MockUnitTest';
     $result = $results[0][0]['class'];
     $this->assertEqual($expected, $result);
     $expected = str_replace('\\', '/', LITHIUM_LIBRARY_PATH);
     $expected = realpath($expected . '/lithium/tests/mocks/test/MockUnitTest.php');
     $result = $results[0][0]['file'];
     $this->assertEqual($expected, str_replace('\\', '/', $result));
 }
All Usage Examples Of lithium\test\Group::tests