Skip to content

Commit d66b253

Browse files
committed
Merge pull request FriendsOfSymfony1#55 from LExpress/lime-full-output
Add an option to test:all task to show full output
2 parents c542454 + c564302 commit d66b253

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

lib/task/symfony/lime_symfony.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* This file is part of the symfony package.
55
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6-
*
6+
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/

lib/task/test/sfLimeHarness.class.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,26 @@ public function addPlugins($plugins)
1111
{
1212
foreach ($plugins as $plugin)
1313
{
14-
$this->plugins[$plugin->getRootDir().DIRECTORY_SEPARATOR.'test'.DIRECTORY_SEPARATOR] = '['.preg_replace('/Plugin$/i', '', $plugin->getName()).'] ';
14+
$pluginDir = $plugin->getRootDir().DIRECTORY_SEPARATOR.'test'.DIRECTORY_SEPARATOR;
15+
16+
$this->plugins[$pluginDir] = '['.preg_replace('/Plugin$/i', '', $plugin->getName()).'] ';
17+
18+
if (true === $this->full_output)
19+
{
20+
$this->plugins[$pluginDir] .= $pluginDir;
21+
}
1522
}
1623
}
1724

1825
protected function get_relative_file($file)
1926
{
2027
$file = strtr($file, $this->plugins);
28+
29+
if (true === $this->full_output)
30+
{
31+
return $file;
32+
}
33+
2134
return str_replace(DIRECTORY_SEPARATOR, '/', str_replace(array(realpath($this->base_dir).DIRECTORY_SEPARATOR, $this->extension), '', $file));
2235
}
2336
}

lib/task/test/sfTestAllTask.class.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* This file is part of the symfony package.
55
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6-
*
6+
*
77
* For the full copyright and license information, please view the LICENSE
88
* file that was distributed with this source code.
99
*/
@@ -25,6 +25,7 @@ protected function configure()
2525
{
2626
$this->addOptions(array(
2727
new sfCommandOption('only-failed', 'f', sfCommandOption::PARAMETER_NONE, 'Only run tests that failed last time'),
28+
new sfCommandOption('full-output', 'o', sfCommandOption::PARAMETER_NONE, 'Display full path for the test'),
2829
new sfCommandOption('xml', null, sfCommandOption::PARAMETER_REQUIRED, 'The file name for the JUnit compatible XML log file'),
2930
));
3031

@@ -62,6 +63,11 @@ protected function configure()
6263
options:
6364
6465
[./symfony test:all --xml=log.xml|INFO]
66+
67+
If you want to display full path for each test in output, add the option
68+
[--full-output|COMMENT] or [-o|COMMENT] :
69+
70+
[./symfony test:all --full-output|INFO]
6571
EOF;
6672
}
6773

@@ -76,6 +82,7 @@ protected function execute($arguments = array(), $options = array())
7682
'force_colors' => isset($options['color']) && $options['color'],
7783
'verbose' => isset($options['trace']) && $options['trace'],
7884
));
85+
$h->full_output = $options['full-output'] ? true : false;
7986
$h->addPlugins(array_map(array($this->configuration, 'getPluginConfiguration'), $this->configuration->getPlugins()));
8087
$h->base_dir = sfConfig::get('sf_test_dir');
8188

lib/vendor/lime/lime.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ class lime_harness extends lime_registration
816816
public $php_cli = null;
817817
public $stats = array();
818818
public $output = null;
819+
public $full_output = false;
819820

820821
public function __construct($options = array())
821822
{
@@ -978,7 +979,14 @@ function lime_shutdown()
978979
}
979980
}
980981

981-
$this->output->echoln(sprintf('%s%s%s', substr($relative_file, -min(67, strlen($relative_file))), str_repeat('.', 70 - min(67, strlen($relative_file))), $stats['status']));
982+
if (true === $this->full_output)
983+
{
984+
$this->output->echoln(sprintf('%s%s%s', $relative_file, '.....', $stats['status']));
985+
}
986+
else
987+
{
988+
$this->output->echoln(sprintf('%s%s%s', substr($relative_file, -min(67, strlen($relative_file))), str_repeat('.', 70 - min(67, strlen($relative_file))), $stats['status']));
989+
}
982990

983991
if ('dubious' == $stats['status'])
984992
{

0 commit comments

Comments
 (0)