Skip to content

Commit ca78c46

Browse files
committed
MAGETWO-35078: Code Coverage for Unit Tests build is broken
- eliminate @Covers annotations with nonexistent methods
1 parent 404e40a commit ca78c46

File tree

3 files changed

+12
-101
lines changed

3 files changed

+12
-101
lines changed

dev/tests/static/framework/autoload.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,11 @@
99
$testsBaseDir = $baseDir . '/dev/tests/static';
1010
$autoloadWrapper = \Magento\Framework\Autoload\AutoloaderRegistry::getAutoloader();
1111
$autoloadWrapper->addPsr4('Magento\\', $testsBaseDir . '/testsuite/Magento/');
12-
$autoloadWrapper->addPsr4('Magento\\TestFramework\\', $testsBaseDir . '/framework/Magento/TestFramework/');
12+
$autoloadWrapper->addPsr4(
13+
'Magento\\TestFramework\\',
14+
[
15+
$testsBaseDir . '/framework/Magento/TestFramework/',
16+
$testsBaseDir . '/../integration/framework/Magento/TestFramework/',
17+
]
18+
);
1319
$autoloadWrapper->addPsr4('Magento\\', $baseDir . '/var/generation/Magento/');

dev/tests/static/testsuite/Magento/Test/Integrity/ClassesTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,9 @@ public function testCoversAnnotation()
557557
}
558558
}
559559
if ($errors) {
560-
$this->fail(implode(PHP_EOL, $errors));
560+
$this->fail('Nonexistent classes/methods were found in @covers annotations: ' . PHP_EOL
561+
. implode(PHP_EOL, $errors)
562+
);
561563
}
562564
}
563565

@@ -567,8 +569,7 @@ public function testCoversAnnotation()
567569
*/
568570
private function isNonexistentEntityCovered($matches)
569571
{
570-
return (!empty($matches[2]) && !class_exists($matches[2])
571-
|| !empty($matches[4]) && !method_exists($matches[2], $matches[4]))
572-
&& strpos($matches[2], 'Magento\TestFramework') === false; // not autoloaded currently
572+
return !empty($matches[2]) && !class_exists($matches[2])
573+
|| !empty($matches[4]) && !method_exists($matches[2], $matches[4]);
573574
}
574575
}

lib/internal/Magento/Framework/TestFramework/Test/Unit/Unit/Helper/ObjectManagerTest.php

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)