Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,9 @@ matrix:
env:
- CS_CHECK=true
- name: "Build Phar"
php: 7.1
php: 7.3
env:
- BUILD_PHAR=true
- name: "Tests PHP 7.1 Lowest Dependencies"
php: 7.1
env:
- DEPS=lowest
- name: "Tests PHP 7.1 PHPUnit Dev Version"
php: 7.1
env:
- PHPUNIT_DEV=true
- name: "Tests PHP 7.1"
php: 7.1
- name: "Tests PHP 7.2 Lowest Dependencies"
php: 7.2
env:
- DEPS=lowest
- name: "Tests PHP 7.2 PHPUnit Dev Version"
php: 7.2
env:
- PHPUNIT_DEV=true
- name: "Tests PHP 7.2"
php: 7.2
- php: 7.3
name: "Tests PHP 7.3 Lowest Dependencies"
env:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "mamitech/paratest",
"require": {
"php": "^7.1",
"php": "^7.3",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-simplexml": "*",
"brianium/habitat": "1.0.0",
"phpunit/php-timer": "^2.0|^3.0|^4.0|^5.0",
"phpunit/phpunit": "^7.5.8|^8.0|^9.0",
"phpunit/php-timer": "^5.0",
"phpunit/phpunit": "^9.2",
"symfony/console": "^3.4||^4.0||^5.0",
"symfony/process": "^3.4||^4.0||^5.0",
"phpunit/php-code-coverage": "^6.1.4|^7.0.2|^8.0"
"phpunit/php-code-coverage": "^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
Expand Down
7 changes: 1 addition & 6 deletions src/Runners/PHPUnit/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use ParaTest\Logging\JUnit\Reader;
use ParaTest\Logging\LogInterpreter;
use SebastianBergmann\Timer\ResourceUsageFormatter;
use SebastianBergmann\Timer\Timer;

/**
* Class ResultPrinter.
Expand Down Expand Up @@ -209,11 +208,7 @@ public function printFeedback(ExecutableTest $test)
*/
public function getHeader(): string
{
if (class_exists(ResourceUsageFormatter::class)) {
$resourceUsage = (new ResourceUsageFormatter())->resourceUsageSinceStartOfRequest();
} else {
$resourceUsage = Timer::resourceUsage();
}
$resourceUsage = (new ResourceUsageFormatter())->resourceUsageSinceStartOfRequest();

return "\n\n" . $resourceUsage . "\n\n";
}
Expand Down
2 changes: 1 addition & 1 deletion test/Functional/Coverage/CoverageMergerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testCoverageFromFileIsDeletedAfterAdd(array $coverageFiles)
$coverageMerger = new CoverageMerger();
$coverageMerger->addCoverageFromFile($filename);

static::assertFileNotExists($filename);
static::assertFileDoesNotExist($filename);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions test/Functional/Coverage/CoverageReporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testGeneratePhp(array $coverageFiles)

$target = $this->targetDir . '/coverage.php';

static::assertFileNotExists($target);
static::assertFileDoesNotExist($target);

$coverageMerger->getReporter()->php($target);

Expand All @@ -100,7 +100,7 @@ public function testGenerateClover(array $coverageFiles)

$target = $this->targetDir . '/coverage.xml';

static::assertFileNotExists($target);
static::assertFileDoesNotExist($target);

$coverageMerger->getReporter()->clover($target);

Expand All @@ -126,7 +126,7 @@ public function testGenerateCrap4J(array $coverageFiles)

$target = $this->targetDir . '/coverage.xml';

static::assertFileNotExists($target);
static::assertFileDoesNotExist($target);

$coverageMerger->getReporter()->crap4j($target);

Expand All @@ -153,7 +153,7 @@ public function testGenerateHtml(array $coverageFiles)

$target = $this->targetDir . '/coverage';

static::assertFileNotExists($target);
static::assertFileDoesNotExist($target);

$coverageMerger->getReporter()->html($target);

Expand Down
12 changes: 6 additions & 6 deletions test/Functional/DataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testFunctionalMode()
'functional' => null,
'max-batch-size' => 50,
]);
$this->assertRegExp('/OK \(1150 tests, 1150 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(1150 tests, 1150 assertions\)/', $proc->getOutput());
}

public function testNumericDataSetInFunctionalModeWithMethodFilter()
Expand All @@ -34,7 +34,7 @@ public function testNumericDataSetInFunctionalModeWithMethodFilter()
'max-batch-size' => 50,
'filter' => 'testNumericDataProvider50',
]);
$this->assertRegExp('/OK \(50 tests, 50 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(50 tests, 50 assertions\)/', $proc->getOutput());
}

public function testNumericDataSetInFunctionalModeWithCustomFilter()
Expand All @@ -44,7 +44,7 @@ public function testNumericDataSetInFunctionalModeWithCustomFilter()
'max-batch-size' => 50,
'filter' => 'testNumericDataProvider50.*1',
]);
$this->assertRegExp('/OK \(14 tests, 14 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(14 tests, 14 assertions\)/', $proc->getOutput());
}

public function testNamedDataSetInFunctionalModeWithMethodFilter()
Expand All @@ -54,7 +54,7 @@ public function testNamedDataSetInFunctionalModeWithMethodFilter()
'max-batch-size' => 50,
'filter' => 'testNamedDataProvider50',
]);
$this->assertRegExp('/OK \(50 tests, 50 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(50 tests, 50 assertions\)/', $proc->getOutput());
}

public function testNamedDataSetInFunctionalModeWithCustomFilter()
Expand All @@ -64,7 +64,7 @@ public function testNamedDataSetInFunctionalModeWithCustomFilter()
'max-batch-size' => 50,
'filter' => 'testNamedDataProvider50.*name_of_test_.*1',
]);
$this->assertRegExp('/OK \(14 tests, 14 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(14 tests, 14 assertions\)/', $proc->getOutput());
}

public function testNumericDataSet1000InFunctionalModeWithFilterAndMaxBatchSize()
Expand All @@ -74,6 +74,6 @@ public function testNumericDataSet1000InFunctionalModeWithFilterAndMaxBatchSize(
'max-batch-size' => 50,
'filter' => 'testNumericDataProvider1000',
]);
$this->assertRegExp('/OK \(1000 tests, 1000 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(1000 tests, 1000 assertions\)/', $proc->getOutput());
}
}
2 changes: 1 addition & 1 deletion test/Functional/FunctionalTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function invokeParatest($path, $options = [], $callback = null)

protected function assertTestsPassed(Process $proc, $testPattern = '\d+', $assertionPattern = '\d+')
{
$this->assertRegExp(
$this->assertMatchesRegularExpression(
"/OK \($testPattern tests?, $assertionPattern assertions?\)/",
$proc->getOutput()
);
Expand Down
12 changes: 6 additions & 6 deletions test/Functional/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,37 @@ public function setUp(): void
public function testGroupSwitchOnlyExecutesThoseGroups()
{
$proc = $this->invoker->execute(['group' => 'group1']);
$this->assertRegExp('/OK \(2 tests, 2 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(2 tests, 2 assertions\)/', $proc->getOutput());
}

public function testExcludeGroupSwitchDontExecuteThatGroup()
{
$proc = $this->invoker->execute(['exclude-group' => 'group1']);

$this->assertRegExp('/OK \(3 tests, 3 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(3 tests, 3 assertions\)/', $proc->getOutput());
}

public function testGroupSwitchExecutesGroupsUsingShortOption()
{
$proc = $this->invoker->execute(['g' => 'group1']);
$this->assertRegExp('/OK \(2 tests, 2 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(2 tests, 2 assertions\)/', $proc->getOutput());
}

public function testGroupSwitchOnlyExecutesThoseGroupsInFunctionalMode()
{
$proc = $this->invoker->execute(['functional', 'g' => 'group1']);
$this->assertRegExp('/OK \(2 tests, 2 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(2 tests, 2 assertions\)/', $proc->getOutput());
}

public function testGroupSwitchOnlyExecutesThoseGroupsWhereTestHasMultipleGroups()
{
$proc = $this->invoker->execute(['functional', 'group' => 'group3']);
$this->assertRegExp('/OK \(1 test, 1 assertion\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(1 test, 1 assertion\)/', $proc->getOutput());
}

public function testGroupsSwitchExecutesMultipleGroups()
{
$proc = $this->invoker->execute(['functional', 'group' => 'group1,group3']);
$this->assertRegExp('/OK \(3 tests, 3 assertions\)/', $proc->getOutput());
$this->assertMatchesRegularExpression('/OK \(3 tests, 3 assertions\)/', $proc->getOutput());
}
}
6 changes: 3 additions & 3 deletions test/Functional/OutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testDefaultMessagesDisplayed()
$output = $this->paratest->execute(['p' => 5])->getOutput();
$this->assertStringContainsString('Running phpunit in 5 processes with ' . PHPUNIT, $output);
$this->assertStringContainsString('Configuration read from ' . getcwd() . DS . 'phpunit.xml.dist', $output);
$this->assertRegExp('/[.F]{4}/', $output);
$this->assertMatchesRegularExpression('/[.F]{4}/', $output);
}

public function testMessagePrintedWhenInvalidConfigFileSupplied()
Expand All @@ -43,14 +43,14 @@ public function testMessagePrintedWhenFunctionalModeIsOn()
->getOutput();
$this->assertStringContainsString('Running phpunit in 5 processes with ' . PHPUNIT, $output);
$this->assertStringContainsString('Functional mode is ON.', $output);
$this->assertRegExp('/[.F]{4}/', $output);
$this->assertMatchesRegularExpression('/[.F]{4}/', $output);
}

public function testProcCountIsReportedWithProcOption()
{
$output = $this->paratest->execute(['p' => 1])
->getOutput();
$this->assertStringContainsString('Running phpunit in 1 process with ' . PHPUNIT, $output);
$this->assertRegExp('/[.F]{4}/', $output);
$this->assertMatchesRegularExpression('/[.F]{4}/', $output);
}
}
12 changes: 6 additions & 6 deletions test/Functional/PHPUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testWithBootstrapThatDoesNotExist()
$this->assertEquals(1, $proc->getExitCode(), 'Unexpected exit code');

// The [RuntimeException] message appears only on lower 6.x versions of Phpunit
$this->assertRegExp(
$this->assertMatchesRegularExpression(
'/(\[RuntimeException\]|Bootstrap specified but could not be found)/',
$errors,
'Expected exception name not found in output'
Expand Down Expand Up @@ -118,7 +118,7 @@ public function testParatestEnvironmentVariableWithWrapperRunnerWithoutTestToken
'paratest-only-tests/EnvironmentTest.php',
['bootstrap' => BOOTSTRAP, 'runner' => 'WrapperRunner', 'no-test-tokens' => 0]
);
$this->assertRegexp('/Failures: 1/', $proc->getOutput());
$this->assertMatchesRegularExpression('/Failures: 1/', $proc->getOutput());
}

public function testParatestEnvironmentVariableWithSqliteRunner()
Expand All @@ -142,7 +142,7 @@ public function testWithConfigurationThatDoesNotExist()
'passing-tests',
['configuration' => FIXTURES . DS . 'phpunit.xml.disto']
); // dist"o" does not exist
$this->assertRegExp('/Could not read ".*phpunit.xml.disto"./', $proc->getOutput());
$this->assertMatchesRegularExpression('/Could not read ".*phpunit.xml.disto"./', $proc->getOutput());
}

public function testFunctionalWithBootstrap()
Expand All @@ -167,7 +167,7 @@ public function testWithBootstrapAndProcessesSwitch()
'passing-tests',
['bootstrap' => BOOTSTRAP, 'processes' => 6]
);
$this->assertRegExp('/Running phpunit in 6 processes/', $proc->getOutput());
$this->assertMatchesRegularExpression('/Running phpunit in 6 processes/', $proc->getOutput());
$this->assertTestsPassed($proc);
}

Expand Down Expand Up @@ -295,8 +295,8 @@ public function testFullyConfiguredRun()
]);
$this->assertTestsPassed($proc);
$results = $proc->getOutput();
$this->assertRegExp('/Running phpunit in 6 processes/', $results);
$this->assertRegExp('/Functional mode is on/i', $results);
$this->assertMatchesRegularExpression('/Running phpunit in 6 processes/', $results);
$this->assertMatchesRegularExpression('/Functional mode is on/i', $results);
$this->assertFileExists($output);
if (file_exists($output)) {
unlink($output);
Expand Down
4 changes: 2 additions & 2 deletions test/Unit/Console/VersionProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testComposerInstalledVersion()
$this->assertIsString($actual, 'Version of phpunit package was found installed');

// dev-master is included here as the phpunit package is checked and there is a dev-master used on travis
$this->assertRegExp("~^dev-master|\d.\d.(.)+$~", $actual, 'Actual version number');
$this->assertMatchesRegularExpression("~^dev-master|\d.\d.(.)+$~", $actual, 'Actual version number');

$actual = $provider->getComposerInstalledVersion('foooo/barazzoraz');
$this->assertNull($actual, 'No version for non-existent package');
Expand All @@ -44,6 +44,6 @@ public function testGitVersion()
$provider = new VersionProvider();
$actual = $provider->getGitVersion();
$this->assertIsString($actual, 'Git is enabled and works');
$this->assertRegExp("~^\d.\d(?:.\d+)?(?:-\d+-g[\da-f]+)?$~", $actual, 'Git gives a version');
$this->assertMatchesRegularExpression("~^\d.\d(?:.\d+)?(?:-\d+-g[\da-f]+)?$~", $actual, 'Git gives a version');
}
}
2 changes: 1 addition & 1 deletion test/Unit/Logging/JUnit/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function testRemoveLog()
file_put_contents($tmp, $contents);
$reader = new Reader($tmp);
$reader->removeLog();
$this->assertFileNotExists($tmp);
$this->assertFileDoesNotExist($tmp);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion test/Unit/Runners/PHPUnit/ExecutableTestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ public function testCommandRedirectsCoverage()

$command = $this->executableTestChild->command($binary, $options);
$coverageFileName = str_replace('/', '\/', $this->executableTestChild->getCoverageFileName());
$this->assertRegExp("/^'\/usr\/bin\/phpunit' '--a' 'b' '--coverage-php' '$coverageFileName' '.*'/", $command);
$this->assertMatchesRegularExpression(
"/^'\/usr\/bin\/phpunit' '--a' 'b' '--coverage-php' '$coverageFileName' '.*'/",
$command
);
}

public function testHandleEnvironmentVariablesAssignsToken()
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/Runners/PHPUnit/ResultPrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public function testGetHeader()

$header = $this->printer->getHeader();

$this->assertRegExp(
$this->assertMatchesRegularExpression(
"/\n\nTime: ([.:]?[0-9]{1,3})+ ?" .
'(minute|minutes|second|seconds|ms|)?,' .
" Memory:[\s][0-9]+([.][0-9]{1,2})? ?M[Bb]\n\n/",
Expand Down