Use more helpful code test names

This commit is contained in:
Nikita Popov 2015-08-25 21:36:08 +02:00
parent f57d217e91
commit fe6755ff4c

View File

@ -28,11 +28,14 @@ abstract class CodeTestAbstract extends \PHPUnit_Framework_TestCase
// first part is the name
$name = array_shift($parts) . ' (' . $fileName . ')';
$shortName = basename($fileName, '.test');
// multiple sections possible with always two forming a pair
foreach (array_chunk($parts, 2) as $chunk) {
$chunks = array_chunk($parts, 2);
foreach ($chunks as $i => $chunk) {
$dataSetName = $shortName . (count($chunks) > 1 ? '#' . $i : '');
list($expected, $mode) = $this->extractMode(canonicalize($chunk[1]));
$tests[] = array($name, $chunk[0], $expected, $mode);
$tests[$dataSetName] = array($name, $chunk[0], $expected, $mode);
}
}