Skip to content

Commit

Permalink
Use development version of phpcompatibility and fix resulting errors
Browse files Browse the repository at this point in the history
The last released version is severely outdated and does not support current PHP versions.
  • Loading branch information
mstilkerich committed Jan 10, 2023
1 parent a43426a commit 16c6832
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"mstilkerich/carddavclient": "dev-master"
},
"require-dev": {
"phpcompatibility/php-compatibility": "*",
"phpcompatibility/php-compatibility": "dev-develop",
"phpunit/phpunit": "~9",
"phpunit/phpcov": "*",
"dealerdirect/phpcodesniffer-composer-installer": ">= 0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/TestLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function expectMessage(string $expLevel, string $expMsg): void

foreach ($this->logBuffer as &$recMsg) {
[ $level, $msg ] = $recMsg;
if (($level == $expLevel) && str_contains($msg, $expMsg) && $recMsg[2] == "UNCHECKED") {
if (($level == $expLevel) && strpos($msg, $expMsg) !== false && $recMsg[2] == "UNCHECKED") {
$recMsg[2] = 'CHECKED';
$found = true;
break;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DataConversionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ private static function compareNodeList(string $dbgid, array $exp, array $rc): v
*/
private function assertPhotoDownloadWarning(TestLogger $logger, string $vcffile): void
{
if (str_contains($vcffile, 'InvalidUriPhoto')) {
if (strpos($vcffile, 'InvalidUriPhoto') !== false) {
$logger->expectMessage(
'warning',
'downloadPhoto: Attempt to download photo from http://localhost/doesNotExist.jpg failed'
Expand Down
5 changes: 4 additions & 1 deletion tests/Unit/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ public static function comparePhoto(string $pExpStr, string $pRcStr): void
TestCase::assertTrue(function_exists('gd_info'), "php-gd required");

// shortcut that also covers URI - if identical strings, save the comparison
if (empty($pExpStr) || empty($pRcStr) || str_contains($pExpStr, "http") || str_contains($pExpStr, "data:")) {
if (
empty($pExpStr) || empty($pRcStr) ||
strpos($pExpStr, "http") !== false || strpos($pExpStr, "data:") !== false
) {
TestCase::assertSame($pExpStr, $pRcStr, "PHOTO comparison on URI value failed");
return;
}
Expand Down

0 comments on commit 16c6832

Please sign in to comment.