lithium\test\Group::_resolve()

protected method

Resolves a unit test class (or classes) from a class or namespace path string.

Parameters

  • string $test

    The path string in which to find the test case(s). This may be a library, a namespace, or a fully-namespaced class reference.

Returns

array

Returns an array containing one or more fully-namespaced class references to unit tests.

Source

	protected function _resolve($test) {
		if (strpos($test, '\\') === false && Libraries::get($test)) {
			return (array) Libraries::find($test, [
				'recursive' => true,
				'filter' => '/(cases|integration|functional)\\\.*Test$/',
				'exclude' => '/tests\\\mocks/'
			]);
		}
		if (!$test = trim($test, '\\')) {
			return [];
		}
		list($library, $path) = explode('\\', $test, 2) + [$test, null];

		return (array) Libraries::find($library, [
			'recursive' => true,
			'path' => '/' . str_replace('\\', '/', $path ?? ""),
			'filter' => '/(cases|integration|functional)\\\.*Test$/',
			'exclude' => strstr($test, 'tests\mocks') ? '' : '/tests\\\mocks/'
		]);
	}