Merge pull request #11096 from nupplaphil/feat/more_deprecated_notices

Replace assertRegExp() assertMatchesRegularExpression() & Upgrade phpunit.xml
This commit is contained in:
Hypolite Petovan 2021-12-12 21:30:03 -05:00 committed by GitHub
commit 0165811f09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 28 deletions

View file

@ -1,30 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<phpunit <phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php" bootstrap="bootstrap.php"
verbose="true" verbose="true"
backupGlobals="false"
timeoutForSmallTests="900" timeoutForSmallTests="900"
timeoutForMediumTests="900" timeoutForMediumTests="900"
timeoutForLargeTests="900"> timeoutForLargeTests="900"
<testsuite name='friendica'> xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<directory suffix='.php'>functional/</directory> <testsuite name="friendica">
<directory suffix='.php'>legacy/</directory> <directory suffix=".php">functional/</directory>
<directory suffix='.php'>src/</directory> <directory suffix=".php">legacy/</directory>
<directory suffix=".php">src/</directory>
</testsuite> </testsuite>
<!-- Filters for Code Coverage --> <!-- Filters for Code Coverage -->
<filter> <coverage>
<whitelist> <include>
<directory suffix=".php">..</directory> <directory suffix=".php">..</directory>
<exclude> </include>
<directory suffix=".php">../config/</directory> <exclude>
<directory suffix=".php">../doc/</directory> <directory suffix=".php">../config/</directory>
<directory suffix=".php">../images/</directory> <directory suffix=".php">../doc/</directory>
<directory suffix=".php">../library/</directory> <directory suffix=".php">../images/</directory>
<directory suffix=".php">../spec/</directory> <directory suffix=".php">../library/</directory>
<directory suffix=".php">../tests/</directory> <directory suffix=".php">../spec/</directory>
<directory suffix=".php">../view/</directory> <directory suffix=".php">../tests/</directory>
<directory suffix=".php">../vendor/</directory> <directory suffix=".php">../view/</directory>
</exclude> <directory suffix=".php">../vendor/</directory>
</whitelist> </exclude>
</filter> </coverage>
</phpunit> </phpunit>

View file

@ -31,7 +31,7 @@ abstract class AbstractLoggerTest extends MockedTest
{ {
use LoggerDataTrait; use LoggerDataTrait;
const LOGLINE = '/.* \[.*\]: .* \{.*\"file\":\".*\".*,.*\"line\":\d*,.*\"function\":\".*\".*,.*\"uid\":\".*\".*}/'; const LOGLINE = '/.* \[.*]: .* {.*\"file\":\".*\".*,.*\"line\":\d*,.*\"function\":\".*\".*,.*\"uid\":\".*\".*}/';
const FILE = 'test'; const FILE = 'test';
const LINE = 666; const LINE = 666;
@ -72,7 +72,7 @@ abstract class AbstractLoggerTest extends MockedTest
public function assertLogline($string) public function assertLogline($string)
{ {
self::assertRegExp(self::LOGLINE, $string); self::assertMatchesRegularExpression(self::LOGLINE, $string);
} }
public function assertLoglineNums($assertNum, $string) public function assertLoglineNums($assertNum, $string)

View file

@ -29,7 +29,7 @@ class WorkerLoggerTest extends MockedTest
{ {
private function assertUid($uid) private function assertUid($uid)
{ {
self::assertRegExp('/^[a-zA-Z0-9]{' . WorkerLogger::WORKER_ID_LENGTH . '}+$/', $uid); self::assertMatchesRegularExpression('/^[a-zA-Z0-9]{' . WorkerLogger::WORKER_ID_LENGTH . '}+$/', $uid);
} }
public function dataTest() public function dataTest()

View file

@ -42,7 +42,7 @@ class SystemTest extends TestCase
private function assertGuid($guid, $length, $prefix = '') private function assertGuid($guid, $length, $prefix = '')
{ {
$length -= strlen($prefix); $length -= strlen($prefix);
self::assertRegExp("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid); self::assertMatchesRegularExpression("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid);
} }
public function testGuidWithoutParameter() public function testGuidWithoutParameter()

View file

@ -229,7 +229,7 @@ class ProfilerTest extends MockedTest
foreach ($data as $perf => $items) { foreach ($data as $perf => $items) {
foreach ($items['functions'] as $function) { foreach ($items['functions'] as $function) {
// assert that the output contains the functions // assert that the output contains the functions
self::assertRegExp('/' . $function . ': \d+/', $output); self::assertMatchesRegularExpression('/' . $function . ': \d+/', $output);
} }
} }
} }
@ -286,7 +286,7 @@ class ProfilerTest extends MockedTest
self::assertTrue($profiler->isRendertime()); self::assertTrue($profiler->isRendertime());
$output = $profiler->getRendertimeString(); $output = $profiler->getRendertimeString();
self::assertRegExp('/test1: \d+/', $output); self::assertMatchesRegularExpression('/test1: \d+/', $output);
self::assertRegExp('/test2: \d+/', $output); self::assertMatchesRegularExpression('/test2: \d+/', $output);
} }
} }