Skip to content

Commit

Permalink
Some PHPUnit 6.x fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oradwell committed Feb 8, 2017
1 parent 537d7ec commit 85ba014
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
6 changes: 1 addition & 5 deletions src/Command/ValidateCommand.php
Expand Up @@ -6,7 +6,6 @@
use OckCyp\CoversValidator\Loader\TestSuiteLoader;
use OckCyp\CoversValidator\Validator\Validator;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Warning;
use PHPUnit\Framework\WarningTestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -68,10 +67,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$suiteIterator = new \RecursiveIteratorIterator($suiteList);
/** @var TestCase $suite */
foreach ($suiteIterator as $suite) {
// PHPUnit 4 and PHPUnit 5 uses different classes for this
if ($suite instanceof WarningTestCase
|| $suite instanceof Warning
) {
if ($suite instanceof WarningTestCase) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Loader/FileLoader.php
Expand Up @@ -2,7 +2,7 @@

namespace OckCyp\CoversValidator\Loader;

use PHPUnit\Util\Fileloader as PHPUnitFileLoader;
use PHPUnit\Util\Fileloader as PHPUnitFileloader;

class FileLoader
{
Expand All @@ -13,6 +13,6 @@ class FileLoader
*/
public static function loadFile($filename)
{
PHPUnitFileLoader::checkAndLoad($filename);
PHPUnitFileloader::checkAndLoad($filename);
}
}
4 changes: 1 addition & 3 deletions tests/Command/ValidateCommandTest.php
Expand Up @@ -133,10 +133,8 @@ public function testSkipsEmptyTestClasses()

$this->assertEquals(0, $exitCode);
$display = $commandTester->getDisplay();
// Generated by PHPUnit 4
// Generated by PHPUnit 6
$this->assertNotRegExp('/PHPUnit\Framework\WarningTestCase::Warning/', $display);
// Generated by PHPUnit 5
$this->assertNotRegExp('/PHPUnit\Framework\Warning::Warning/', $display);
$this->assertRegExp('/Validation complete. All @covers tags are valid./', $display);
}

Expand Down
2 changes: 0 additions & 2 deletions tests/Loader/FileLoaderTest.php
Expand Up @@ -12,7 +12,6 @@ class FileLoaderTest extends FileTestCase
*/
public function testLoadsFile()
{
$this->assertFalse(isset($GLOBALS['cv_global_var']));
file_put_contents('my1.php', '<?php $cv_global_var = true;');
FileLoader::loadFile('my1.php');
$this->assertTrue(isset($GLOBALS['cv_global_var']));
Expand All @@ -23,7 +22,6 @@ public function testLoadsFile()
*/
public function testLoadsFile2()
{
$this->assertFalse(isset($GLOBALS['cv_global_var']));
file_put_contents('my2.php', '<?php $cv_global_var = true;');
FileLoader::loadFile('my2.php');
$this->assertTrue(isset($GLOBALS['cv_global_var']));
Expand Down

0 comments on commit 85ba014

Please sign in to comment.