Skip to content

Commit af3864d

Browse files
committed
Added console input for IDE debugging
1 parent ce3eb82 commit af3864d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace Arachne\Codeception\Console\Input;
4+
5+
use Symfony\Component\Console\Input\InputDefinition;
6+
use Symfony\Component\Console\Input\ArgvInput;
7+
8+
/**
9+
* Codeception run command input for Symfony console
10+
*
11+
* This should only be used when debugging using xDebug and NetBeans (or different IDE).
12+
*
13+
* @author Jáchym Toušek
14+
*/
15+
class RunTestInput extends ArgvInput
16+
{
17+
18+
public function __construct(InputDefinition $definition = NULL)
19+
{
20+
$parameters = array($_SERVER['argv'][0], 'run');
21+
22+
if (isset($_SERVER['argv'][1])) {
23+
$filename = str_replace('\\', '/', $_SERVER['argv'][1]);
24+
$cwd = str_replace('\\', '/', getcwd()) . '/';
25+
if (strpos($filename, $cwd) === 0) {
26+
$parameters[] = substr($filename, strlen($cwd));
27+
}
28+
}
29+
30+
parent::__construct($parameters, $definition);
31+
}
32+
33+
}

0 commit comments

Comments
 (0)