Skip to content

Commit

Permalink
fix(testcmd): the test namespace for file in root was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Aug 31, 2018
1 parent 3a4d714 commit 63fb737
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Console/TestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,13 @@ protected function getTestMetadata(array $classes, array $srcNs, array $testNs):

private function convertToTest(array $metadata, array $srcNs, array $testNs): array
{
$srcNspcs = \array_column($srcNs, 'ns');
$testClass = $metadata['className'] . 'Test';
$testPath = \str_replace(\array_column($srcNs, 'nsPath'), $testNs['nsPath'], $metadata['classPath']);
$testPath = \preg_replace('!\.php$!i', 'Test.php', $testPath);
$testFqcn = \str_replace(\array_column($srcNs, 'ns'), $testNs['ns'], $metadata['classFqcn']) . 'Test';
$testFqcn = \str_replace($srcNspcs, $testNs['ns'], $metadata['classFqcn']) . 'Test';

$testNamespace = \str_replace(\array_column($srcNs, 'ns'), $testNs['ns'], $metadata['namespace']);
$testNamespace = \trim(\str_replace($srcNspcs, $testNs['ns'], $metadata['namespace'] . '\\'), '\\');

return compact('testClass', 'testNamespace', 'testFqcn', 'testPath');
}
Expand Down

0 comments on commit 63fb737

Please sign in to comment.