Skip to content

Commit dd00af2

Browse files
committed
check log directory existence
1 parent 85a8195 commit dd00af2

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

src/PhpunitMerger/Command/LogCommand.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
4444
{
4545
$finder = new Finder();
4646
$finder->files()
47-
->in(realpath($input->getArgument('directory')));
47+
->in(realpath($input->getArgument('directory')))->sortByName(true);
4848

4949
$this->document = new \DOMDocument('1.0', 'UTF-8');
5050
$this->document->formatOutput = true;
@@ -67,7 +67,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
foreach ($finder as $file) {
6868
try {
6969
$xml = new \SimpleXMLElement(file_get_contents($file->getRealPath()));
70-
$code = json_encode($xml);
7170
$xmlArray = json_decode(json_encode($xml), true);
7271
if (!empty($xmlArray)) {
7372
$this->addTestSuites($baseSuite, $xmlArray);
@@ -162,21 +161,6 @@ private function addChildElements(array $tree, \DOMElement $element)
162161
$element->appendChild($child);
163162
}
164163
}
165-
private function addAttributeValueToTestSuite(\DOMElement $element, $key, $value)
166-
{
167-
if (in_array($key, $this->keysToCalculate)) {
168-
$currentValue = $element->hasAttribute($key) ? $element->getAttribute($key) : 0;
169-
$element->setAttribute($key, (string)($currentValue + $value));
170-
171-
if ($element->hasAttribute('parent')) {
172-
$parent = $element->getAttribute('parent');
173-
if (isset($this->domElements[$parent])) {
174-
$this->addAttributeValueToTestSuite($this->domElements[$parent], $key, $value);
175-
}
176-
}
177-
}
178-
}
179-
180164
private function calculateTopLevelStats()
181165
{
182166
/** @var \DOMElement $topNode */

tests/PhpunitMerger/Command/AbstractCommandTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ abstract class AbstractCommandTest extends TestCase
2222
public function assertOutputFileNotExists()
2323
{
2424
$filesystem = new Filesystem();
25+
self::assertDirectoryExists($this->logDirectory , $this->logDirectory . " does not exists");
2526
$filesystem->remove($this->logDirectory . $this->outputFile);
2627

2728
$this->assertFileNotExists($this->logDirectory . $this->outputFile);
2829
}
2930

3031
public function assertOutputDirectoryNotExists()
3132
{
33+
self::assertDirectoryExists($this->logDirectory , $this->logDirectory . " does not exists");
3234
$filesystem = new Filesystem();
3335
$filesystem->remove($this->logDirectory . dirname($this->outputFile));
3436

0 commit comments

Comments
 (0)