1
1
Fork 0

Merge pull request #10112 from nupplaphil/feat/phpunit_upgrade

Enable PHP 8.0 Unit-Tests
This commit is contained in:
Hypolite Petovan 2021-04-05 07:24:24 -04:00 committed by GitHub
commit 49d80dc447
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 282 additions and 1616 deletions

View file

@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['7.2', '7.3', '7.4']
php-versions: ['7.3', '7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2
@ -62,6 +62,9 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist
- name: Setup PHPUnit 8
run: bin/dev/setup-phpunit.sh
- name: Copy default Friendica config
run: cp config/local-sample.config.php config/local.config.php
@ -83,7 +86,7 @@ jobs:
run: vendor/bin/parallel-lint --exclude vendor/ --exclude view/asset/ .
- name: Test with phpunit
run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
run: $(git rev-parse --show-toplevel)/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}

3
.gitignore vendored
View file

@ -79,3 +79,6 @@ venv/
#Ignore log folder
/log
#Ignore temporary installed phpunit
/bin/phpunit

13
bin/dev/setup-phpunit.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
PHPUNIT="$(git rev-parse --show-toplevel)/bin/phpunit"
if ! [ -x "$PHPUNIT" ]; then
echo "Install PHPUnit 8"
cd /tmp/
curl -s -O -L https://phar.phpunit.de/phpunit-8.phar
chmod +x phpunit-8.phar
mv phpunit-8.phar $PHPUNIT
fi
echo "Using $PHPUNIT $($PHPUNIT --version)"

View file

@ -124,12 +124,9 @@
]
},
"require-dev": {
"phpdocumentor/reflection-docblock": "^3.0.2",
"phpunit/php-token-stream": "^1.4.2",
"mikey179/vfsstream": "^1.6",
"mockery/mockery": "^1.2",
"johnkary/phpunit-speedtrap": "1.1",
"php-parallel-lint/php-parallel-lint": "^1.2"
"php-parallel-lint/php-parallel-lint": "^1.2",
"mockery/mockery": "^1.3",
"mikey179/vfsstream": "^1.6"
},
"scripts": {
"test": "phpunit"

1449
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c66de8307eed717b4e23fcf386aa17ef",
"content-hash": "355e17099c031793ea039e702acbb0d7",
"packages": [
{
"name": "asika/simple-console",
@ -3821,60 +3821,6 @@
}
],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14T21:17:01+00:00"
},
{
"name": "hamcrest/hamcrest-php",
"version": "v2.0.1",
@ -3922,54 +3868,6 @@
],
"time": "2020-07-09T08:09:16+00:00"
},
{
"name": "johnkary/phpunit-speedtrap",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/johnkary/phpunit-speedtrap.git",
"reference": "f7cfe17c5a7076ed0ccca5450fe3bb981ec56361"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/johnkary/phpunit-speedtrap/zipball/f7cfe17c5a7076ed0ccca5450fe3bb981ec56361",
"reference": "f7cfe17c5a7076ed0ccca5450fe3bb981ec56361",
"shasum": ""
},
"require": {
"php": ">=5.6",
"phpunit/phpunit": ">=4.7,<6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"psr-0": {
"JohnKary": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "John Kary",
"email": "john@johnkary.net"
}
],
"description": "Find slow tests in your PHPUnit test suite",
"homepage": "https://github.com/johnkary/phpunit-speedtrap",
"keywords": [
"phpunit",
"profile",
"slow"
],
"time": "2017-03-25T17:14:26+00:00"
},
{
"name": "mikey179/vfsstream",
"version": "v1.6.8",
@ -4081,51 +3979,6 @@
],
"time": "2021-02-24T09:51:00+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^4.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
},
"files": [
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"time": "2017-10-19T19:58:43+00:00"
},
{
"name": "php-parallel-lint/php-parallel-lint",
"version": "v1.2.0",
@ -4178,1306 +4031,6 @@
"description": "This tool check syntax of PHP files about 20x faster than serial check.",
"homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint",
"time": "2020-04-04T12:18:32+00:00"
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2017-09-11T18:02:19+00:00"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.3.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2",
"reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0",
"phpdocumentor/reflection-common": "^1.0.0",
"phpdocumentor/type-resolver": "^0.4.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2017-11-10T14:09:06+00:00"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.4.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "9c977708995954784726e25d0cd1dddf4e65b0f7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7",
"reference": "9c977708995954784726e25d0cd1dddf4e65b0f7",
"shasum": ""
},
"require": {
"php": "^5.5 || ^7.0",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2017-07-14T14:27:02+00:00"
},
{
"name": "phpspec/prophecy",
"version": "v1.10.3",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "451c3cd1418cf640de218914901e51b064abb093"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093",
"reference": "451c3cd1418cf640de218914901e51b064abb093",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
"sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5 || ^3.2",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10.x-dev"
}
},
"autoload": {
"psr-4": {
"Prophecy\\": "src/Prophecy"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2020-03-05T15:02:03+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "4.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xmlwriter": "*",
"php": "^5.6 || ^7.0",
"phpunit/php-file-iterator": "^1.3",
"phpunit/php-text-template": "^1.2",
"phpunit/php-token-stream": "^1.4.2 || ^2.0",
"sebastian/code-unit-reverse-lookup": "^1.0",
"sebastian/environment": "^1.3.2 || ^2.0",
"sebastian/version": "^1.0 || ^2.0"
},
"require-dev": {
"ext-xdebug": "^2.1.4",
"phpunit/phpunit": "^5.7"
},
"suggest": {
"ext-xdebug": "^2.5.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2017-04-02T07:44:40+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
"reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2017-11-27T13:52:08+00:00"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21T13:50:34+00:00"
},
{
"name": "phpunit/php-timer",
"version": "1.0.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2017-02-26T11:10:40+00:00"
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16",
"reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"abandoned": true,
"time": "2017-12-04T08:55:13+00:00"
},
{
"name": "phpunit/phpunit",
"version": "5.7.27",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
"reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"myclabs/deep-copy": "~1.3",
"php": "^5.6 || ^7.0",
"phpspec/prophecy": "^1.6.2",
"phpunit/php-code-coverage": "^4.0.4",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "^3.2",
"sebastian/comparator": "^1.2.4",
"sebastian/diff": "^1.4.3",
"sebastian/environment": "^1.3.4 || ^2.0",
"sebastian/exporter": "~2.0",
"sebastian/global-state": "^1.1",
"sebastian/object-enumerator": "~2.0",
"sebastian/resource-operations": "~1.0",
"sebastian/version": "^1.0.6|^2.0.1",
"symfony/yaml": "~2.1|~3.0|~4.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "3.0.2"
},
"require-dev": {
"ext-pdo": "*"
},
"suggest": {
"ext-xdebug": "*",
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.7.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2018-02-01T05:50:59+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "3.4.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "a23b761686d50a560cc56233b9ecf49597cc9118"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118",
"reference": "a23b761686d50a560cc56233b9ecf49597cc9118",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.6 || ^7.0",
"phpunit/php-text-template": "^1.2",
"sebastian/exporter": "^1.2 || ^2.0"
},
"conflict": {
"phpunit/phpunit": "<5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^5.4"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"abandoned": true,
"time": "2017-06-30T09:13:00+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
"reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619",
"reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "^8.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-11-30T08:15:22+00:00"
},
{
"name": "sebastian/comparator",
"version": "1.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.2",
"sebastian/exporter": "~1.2 || ~2.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2017-01-29T09:50:25+00:00"
},
{
"name": "sebastian/diff",
"version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2017-05-22T07:24:03+00:00"
},
{
"name": "sebastian/environment",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2016-11-26T07:53:53+00:00"
},
{
"name": "sebastian/exporter",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/recursion-context": "~2.0"
},
"require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2016-11-19T08:54:04+00:00"
},
{
"name": "sebastian/global-state",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12T03:26:01+00:00"
},
{
"name": "sebastian/object-enumerator",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7",
"reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7",
"shasum": ""
},
"require": {
"php": ">=5.6",
"sebastian/recursion-context": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "~5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2017-02-18T15:18:39+00:00"
},
{
"name": "sebastian/recursion-context",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2016-11-19T07:33:16+00:00"
},
{
"name": "sebastian/resource-operations",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/resource-operations.git",
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2015-07-28T20:34:47+00:00"
},
{
"name": "sebastian/version",
"version": "2.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
"reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
"shasum": ""
},
"require": {
"php": ">=5.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.19.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b",
"reference": "aed596913b70fae57be53d86faa2e9ef85a2297b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.19-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-10-23T09:01:57+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/ddc23324e6cfe066f3dd34a37ff494fa80b617ed",
"reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"symfony/console": "~2.8|~3.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-07-23T12:43:26+00:00"
},
{
"name": "webmozart/assert",
"version": "1.9.1",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<3.9.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
},
"type": "library",
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2020-07-08T17:02:28+00:00"
}
],
"aliases": [],

View file

@ -27,4 +27,18 @@ namespace Friendica\Test;
abstract class DatabaseTest extends MockedTest
{
use DatabaseTestTrait;
protected function setUp(): void
{
$this->setUpDb();
parent::setUp();
}
protected function tearDown(): void
{
$this->tearDownDb();
parent::tearDown();
}
}

View file

@ -29,23 +29,23 @@ use Friendica\Test\Util\Database\StaticDatabase;
*/
trait DatabaseTestTrait
{
protected function setUp()
protected function setUpDb()
{
StaticDatabase::statConnect($_SERVER);
// Rollbacks every DB usage (in case the test couldn't call tearDown)
StaticDatabase::statRollback();
// Start the first, outer transaction
StaticDatabase::getGlobConnection()->beginTransaction();
parent::setUp();
}
protected function tearDown()
protected function tearDownDb()
{
// Rollbacks every DB usage so we don't commit anything into the DB
StaticDatabase::statRollback();
parent::tearDown();
try {
// Rollbacks every DB usage so we don't commit anything into the DB
StaticDatabase::statRollback();
} catch (\PDOException $exception) {
print_r("Found already rolled back transaction");
}
}
/**

View file

@ -26,7 +26,7 @@ abstract class FixtureTest extends DatabaseTest
/**
* Create variables used by tests.
*/
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -28,7 +28,7 @@ use PHPUnit\Framework\TestCase;
*/
abstract class MockedTest extends TestCase
{
protected function tearDown()
protected function tearDown() : void
{
\Mockery::close();

13
tests/README.md Normal file
View file

@ -0,0 +1,13 @@
# Using the Friendica tests
## Install PHPUnit
Please use [setup-phpunit.sh](https://github.com/friendica/friendica/bin/dev/setup-phpunit.sh) to install the necessary PHPUnit version.
It will temporarily install the `phpunit` phar file into the `bin/` subdirectory
Currently, Friendica uses PHPUnit 8.
## Supported PHP versions of these tests
The Unit-Tests of Friendica requires at least PHP 7.2.

View file

@ -67,8 +67,9 @@ class ExtendedPDO extends PDO
*/
public function beginTransaction()
{
if($this->_transactionDepth == 0 || !$this->hasSavepoint()) {
if($this->_transactionDepth <= 0 || !$this->hasSavepoint()) {
parent::beginTransaction();
$this->_transactionDepth = $this->_transactionDepth < 0 ? 0 : $this->_transactionDepth;
} else {
$this->exec("SAVEPOINT LEVEL{$this->_transactionDepth}");
}
@ -85,8 +86,9 @@ class ExtendedPDO extends PDO
{
$this->_transactionDepth--;
if($this->_transactionDepth == 0 || !$this->hasSavepoint()) {
if($this->_transactionDepth <= 0 || !$this->hasSavepoint()) {
parent::commit();
$this->_transactionDepth = $this->_transactionDepth < 0 ? 0 : $this->_transactionDepth;
} else {
$this->exec("RELEASE SAVEPOINT LEVEL{$this->_transactionDepth}");
}
@ -100,8 +102,7 @@ class ExtendedPDO extends PDO
*/
public function rollBack()
{
if ($this->_transactionDepth == 0) {
if ($this->_transactionDepth <= 0) {
throw new PDOException('Rollback error : There is no transaction started');
}

View file

@ -24,6 +24,12 @@ use Dice\Dice;
use Friendica\DI;
use PHPUnit\Framework\TestCase;
if (!file_exists(__DIR__ . '/../vendor/autoload.php')) {
die('Vendor path not found. Please execute "bin/composer.phar --no-dev install" on the command line in the web root.');
}
require __DIR__ . '/../vendor/autoload.php';
// Backward compatibility
if (!class_exists(TestCase::class)) {
class_alias(PHPUnit_Framework_TestCase::class, TestCase::class);

View file

@ -19,11 +19,43 @@
*
*/
use Friendica\Core\Protocol;
use Friendica\Model\Contact;
return [
'user' => [
[
'uid' => 42,
'username' => 'Test user',
'nickname' => 'selfcontact',
'verified' => 1,
'password' => '$2y$10$DLRNTRmJgKe1cSrFJ5Jb0edCqvXlA9sh/RHdSnfxjbR.04yZRm4Qm',
'theme' => 'frio',
],
],
'contact' => [
[
'id' => 42,
'uid' => 42,
'name' => 'Self contact',
'nick' => 'selfcontact',
'self' => 1,
'nurl' => 'http://localhost/profile/selfcontact',
'url' => 'http://localhost/profile/selfcontact',
'about' => 'User used in tests',
'pending' => 0,
'blocked' => 0,
'rel' => Contact::FOLLOWER,
'network' => Protocol::DFRN,
'location' => 'DFRN',
],
],
'photo' => [
// move from data-attribute to storage backend
[
'id' => 1,
'uid' => 42,
'contact-id' => 42,
'backend-class' => null,
'backend-ref' => 'f0c0d0i2',
'data' => 'without class',
@ -31,6 +63,8 @@ return [
// move from storage-backend to maybe filesystem backend, skip at database backend
[
'id' => 2,
'uid' => 42,
'contact-id' => 42,
'backend-class' => 'Database',
'backend-ref' => 1,
'data' => '',
@ -38,6 +72,8 @@ return [
// move data if invalid storage
[
'id' => 3,
'uid' => 42,
'contact-id' => 42,
'backend-class' => 'invalid!',
'backend-ref' => 'unimported',
'data' => 'invalid data moved',
@ -45,6 +81,8 @@ return [
// @todo Check failing test because of this (never loaded) fixture
// [
// 'id' => 4,
// 'uid' => 42,
// 'contact-id' => 42,
// 'backend-class' => 'invalid!',
// 'backend-ref' => 'unimported',
// 'data' => '',

View file

@ -45,7 +45,7 @@ class DependencyCheckTest extends TestCase
*/
private $dice;
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -22,6 +22,8 @@ require_once __DIR__ . '/../../include/api.php';
*
* Functions that use header() need to be tested in a separate process.
* @see https://phpunit.de/manual/5.7/en/appendixes.annotations.html#appendixes.annotations.runTestsInSeparateProcesses
*
* @backupGlobals enabled
*/
class ApiTest extends FixtureTest
{
@ -48,7 +50,7 @@ class ApiTest extends FixtureTest
/**
* Create variables used by tests.
*/
protected function setUp()
protected function setUp() : void
{
global $API, $called_api;
$API = [];
@ -108,10 +110,6 @@ class ApiTest extends FixtureTest
'authenticated' => true,
'uid' => $this->selfUser['id']
];
$_POST = [];
$_GET = [];
$_SERVER = [];
}
/**
@ -140,7 +138,7 @@ class ApiTest extends FixtureTest
*
* @return void
*/
private function assertOtherUser(array $user)
private function assertOtherUser(array $user = [])
{
self::assertEquals($this->otherUser['id'], $user['id']);
self::assertEquals($this->otherUser['id'], $user['id_str']);
@ -157,10 +155,10 @@ class ApiTest extends FixtureTest
*
* @return void
*/
private function assertStatus(array $status)
private function assertStatus(array $status = [])
{
self::assertInternalType('string', $status['text']);
self::assertInternalType('int', $status['id']);
self::assertInternalType('string', $status['text'] ?? '');
self::assertInternalType('int', $status['id'] ?? '');
// We could probably do more checks here.
}
@ -171,7 +169,7 @@ class ApiTest extends FixtureTest
*
* @return void
*/
private function assertList(array $list)
private function assertList(array $list = [])
{
self::assertInternalType('string', $list['name']);
self::assertInternalType('int', $list['id']);
@ -188,7 +186,7 @@ class ApiTest extends FixtureTest
*
* @return void
*/
private function assertXml($result, $root_element)
private function assertXml($result = '', $root_element = '')
{
self::assertStringStartsWith('<?xml version="1.0"?>', $result);
self::assertContains('<' . $root_element, $result);
@ -302,8 +300,9 @@ class ApiTest extends FixtureTest
/**
* Test the api_login() function without any login.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
* @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/
public function testApiLoginWithoutLogin()
@ -314,8 +313,9 @@ class ApiTest extends FixtureTest
/**
* Test the api_login() function with a bad login.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
* @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/
public function testApiLoginWithBadLogin()
@ -347,8 +347,9 @@ class ApiTest extends FixtureTest
/**
* Test the api_login() function with a correct login.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
* @doesNotPerformAssertions
*/
public function testApiLoginWithCorrectLogin()
{
@ -360,8 +361,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_login() function with a remote user.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/
public function testApiLoginWithRemoteUser()
@ -404,8 +405,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCall()
{
@ -431,8 +432,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with the profiled enabled.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithProfiler()
{
@ -468,8 +469,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function without any result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithNoResult()
{
@ -494,8 +495,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with an unimplemented API.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithUninplementedApi()
{
@ -508,8 +509,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with a JSON result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithJson()
{
@ -534,8 +535,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with an XML result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithXml()
{
@ -560,8 +561,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with an RSS result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithRss()
{
@ -587,8 +588,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with an Atom result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithAtom()
{
@ -614,8 +615,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with an unallowed method.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithWrongMethod()
{
@ -635,8 +636,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_call() function with an unauthorized user.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiCallWithWrongAuth()
{
@ -660,8 +661,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_error() function with a JSON result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiErrorWithJson()
{
@ -674,8 +675,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_error() function with an XML result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiErrorWithXml()
{
@ -695,8 +696,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_error() function with an RSS result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiErrorWithRss()
{
@ -716,8 +717,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_error() function with an Atom result.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiErrorWithAtom()
{
@ -859,8 +860,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_get_user() function with an user that is not allowed to use the API.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
*/
public function testApiGetUserWithoutApiUser()
{
@ -1312,8 +1313,8 @@ class ApiTest extends FixtureTest
/**
* Test the api_media_upload() function.
*
* @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\BadRequestException
*/
public function testApiMediaUpload()
@ -1504,7 +1505,7 @@ class ApiTest extends FixtureTest
$result = api_search('json');
foreach ($result['status'] as $status) {
self::assertStatus($status);
self::assertContains('reply', $status['text'], null, true);
self::assertContains('reply', $status['text'], '', true);
}
}
@ -1520,7 +1521,7 @@ class ApiTest extends FixtureTest
$result = api_search('json');
foreach ($result['status'] as $status) {
self::assertStatus($status);
self::assertContains('reply', $status['text'], null, true);
self::assertContains('reply', $status['text'], '', true);
}
}
@ -1536,14 +1537,13 @@ class ApiTest extends FixtureTest
$result = api_search('json');
foreach ($result['status'] as $status) {
self::assertStatus($status);
self::assertContains('reply', $status['text'], null, true);
self::assertContains('reply', $status['text'], '', true);
}
}
/**
* Test the api_search() function with an q parameter contains hashtag.
*
* @return void
* @doesNotPerformAssertions
*/
public function testApiSearchWithHashtag()
{
@ -1551,14 +1551,13 @@ class ApiTest extends FixtureTest
$result = api_search('json');
foreach ($result['status'] as $status) {
self::assertStatus($status);
self::assertContains('#friendica', $status['text'], null, true);
self::assertContains('#friendica', $status['text'], '', true);
}
}
/**
* Test the api_search() function with an exclude_replies parameter.
*
* @return void
* @doesNotPerformAssertions
*/
public function testApiSearchWithExcludeReplies()
{
@ -2474,8 +2473,7 @@ class ApiTest extends FixtureTest
/**
* Test the api_format_items() function.
*
* @return void
* @doesNotPerformAssertions
*/
public function testApiFormatItems()
{
@ -2500,8 +2498,7 @@ class ApiTest extends FixtureTest
/**
* Test the api_format_items() function with an XML result.
*
* @return void
* @doesNotPerformAssertions
*/
public function testApiFormatItemsWithXml()
{
@ -2617,8 +2614,7 @@ class ApiTest extends FixtureTest
/**
* Test the api_lists_statuses() function with a list ID.
*
* @return void
* @doesNotPerformAssertions
*/
public function testApiListsStatusesWithListId()
{
@ -3271,8 +3267,6 @@ class ApiTest extends FixtureTest
/**
* Test the api_fr_photo_create_update() function.
*
* @return void
* @expectedException Friendica\Network\HTTPException\BadRequestException
*/
public function testApiFrPhotoCreateUpdate()

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit
bootstrap="bootstrap.php"
verbose="true">
<testsuite name='friendica'>
<directory suffix='.php'>functional/</directory>
<directory suffix='.php'>include/</directory>
<directory suffix='.php'>src/</directory>
<directory suffix='.php'>./</directory>
</testsuite>
<!-- Filters for Code Coverage -->
<filter>
<whitelist>
<directory suffix=".php">..</directory>
<exclude>
<directory suffix=".php">config/</directory>
<directory suffix=".php">doc/</directory>
<directory suffix=".php">images/</directory>
<directory suffix=".php">library/</directory>
<directory suffix=".php">spec/</directory>
<directory suffix=".php">tests/</directory>
<directory suffix=".php">view/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

View file

@ -1,29 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit
bootstrap="bootstrap.php"
verbose="true">
bootstrap="bootstrap.php"
verbose="true"
backupGlobals="false"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900">
<testsuite name='friendica'>
<directory suffix='.php'>functional/</directory>
<directory suffix='.php'>include/</directory>
<directory suffix='.php'>src/</directory>
<directory suffix='.php'>./</directory>
</testsuite>
<!-- Filters for Code Coverage -->
<filter>
<whitelist>
<directory suffix=".php">..</directory>
<exclude>
<directory suffix=".php">../config</directory>
<directory suffix=".php">../doc</directory>
<directory suffix=".php">../images</directory>
<directory suffix=".php">../library</directory>
<directory suffix=".php">../spec</directory>
<directory suffix=".php">../tests</directory>
<directory suffix=".php">../view</directory>
<directory suffix=".php">config/</directory>
<directory suffix=".php">doc/</directory>
<directory suffix=".php">images/</directory>
<directory suffix=".php">library/</directory>
<directory suffix=".php">spec/</directory>
<directory suffix=".php">tests/</directory>
<directory suffix=".php">view/</directory>
<directory suffix=".php">vendor/</directory>
</exclude>
</whitelist>
</filter>
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
</phpunit>

View file

@ -53,7 +53,7 @@ class ModeTest extends MockedTest
*/
private $configCacheMock;
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -40,7 +40,7 @@ class RouterTest extends TestCase
*/
private $cache;
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -76,7 +76,7 @@ class AutomaticInstallationConsoleTest extends ConsoleTest
*/
private $dice;
public function setUp()
public function setUp() : void
{
static::markTestSkipped('Needs class \'Installer\' as constructing argument for console tests');

View file

@ -38,7 +38,7 @@ class ConfigConsoleTest extends ConsoleTest
/** @var IConfig|LegacyMockInterface|MockInterface */
private $configMock;
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -32,7 +32,7 @@ abstract class ConsoleTest extends MockedTest
*/
protected $consoleArgv = [ 'consoleTest.php' ];
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -40,7 +40,7 @@ class LockConsoleTest extends ConsoleTest
*/
private $lockMock;
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -42,7 +42,7 @@ class ServerBlockConsoleTest extends ConsoleTest
*/
private $configMock;
protected function setUp()
protected function setUp() : void
{
parent::setUp();

View file

@ -19,7 +19,7 @@ class SmiliesTest extends MockedTest
use VFSTrait;
use AppMockTrait;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setUpVfsDir();

View file

@ -35,7 +35,7 @@ class BBCodeTest extends MockedTest
use VFSTrait;
use AppMockTrait;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setUpVfsDir();

View file

@ -33,7 +33,7 @@ class HTMLTest extends MockedTest
use VFSTrait;
use AppMockTrait;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setUpVfsDir();

View file

@ -32,7 +32,7 @@ class MarkdownTest extends MockedTest
use VFSTrait;
use AppMockTrait;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setUpVfsDir();

View file

@ -28,7 +28,7 @@ use Friendica\Core\Cache\APCuCache;
*/
class APCuCacheTest extends MemoryCacheTest
{
protected function setUp()
protected function setUp(): void
{
if (!APCuCache::isAvailable()) {
static::markTestSkipped('APCu is not available');
@ -43,7 +43,7 @@ class APCuCacheTest extends MemoryCacheTest
return $this->cache;
}
protected function tearDown()
protected function tearDown(): void
{
$this->cache->clear(false);
parent::tearDown();

View file

@ -31,7 +31,7 @@ class ArrayCacheTest extends MemoryCacheTest
return $this->cache;
}
protected function tearDown()
protected function tearDown(): void
{
$this->cache->clear(false);
parent::tearDown();
@ -40,6 +40,7 @@ class ArrayCacheTest extends MemoryCacheTest
public function testTTL()
{
// Array Cache doesn't support TTL
self::markTestSkipped("Array Cache doesn't support TTL");
return true;
}
}

View file

@ -81,7 +81,7 @@ abstract class CacheTest extends MockedTest
abstract protected function getInstance();
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -36,10 +36,12 @@ class DatabaseCacheTest extends CacheTest
use DatabaseTestTrait;
use VFSTrait;
protected function setUp()
protected function setUp(): void
{
$this->setUpVfsDir();
$this->setUpDb();
parent::setUp();
}
@ -60,9 +62,12 @@ class DatabaseCacheTest extends CacheTest
return $this->cache;
}
protected function tearDown()
protected function tearDown(): void
{
$this->cache->clear(false);
$this->tearDownDb();
parent::tearDown();
}
}

View file

@ -56,7 +56,7 @@ class MemcacheCacheTest extends MemoryCacheTest
return $this->cache;
}
protected function tearDown()
protected function tearDown(): void
{
$this->cache->clear(false);
parent::tearDown();

View file

@ -55,7 +55,7 @@ class MemcachedCacheTest extends MemoryCacheTest
return $this->cache;
}
protected function tearDown()
protected function tearDown(): void
{
$this->cache->clear(false);
parent::tearDown();

View file

@ -31,7 +31,7 @@ abstract class MemoryCacheTest extends CacheTest
*/
protected $instance;
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -65,7 +65,7 @@ class RedisCacheTest extends MemoryCacheTest
return $this->cache;
}
protected function tearDown()
protected function tearDown(): void
{
$this->cache->clear(false);
parent::tearDown();

View file

@ -55,7 +55,7 @@ abstract class ConfigTest extends MockedTest
}
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -45,7 +45,7 @@ class InstallerTest extends MockedTest
*/
private $dice;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -64,6 +64,15 @@ class InstallerTest extends MockedTest
DI::init($this->dice);
}
public static function tearDownAfterClass(): void
{
// Reset mocking
global $phpMock;
$phpMock = [];
parent::tearDownAfterClass();
}
private function mockL10nT(string $text, $times = null)
{
$this->l10nMock->shouldReceive('t')->with($text)->andReturn($text)->times($times);
@ -463,6 +472,7 @@ class InstallerTest extends MockedTest
/**
* Test the setup of the config cache for installation
* @doesNotPerformAssertions
*/
public function testSetUpCache()
{

View file

@ -29,7 +29,7 @@ use Friendica\Core\Lock\CacheLock;
*/
class APCuCacheLockTest extends LockTest
{
protected function setUp()
protected function setUp(): void
{
if (!APCuCache::isAvailable()) {
static::markTestSkipped('APCu is not available');

View file

@ -33,7 +33,6 @@ class ArrayCacheLockTest extends LockTest
public function testLockTTL()
{
// ArrayCache doesn't support TTL
return true;
self::markTestSkipped("ArrayCache doesn't support TTL");
}
}

View file

@ -38,10 +38,12 @@ class DatabaseLockDriverTest extends LockTest
protected $pid = 123;
protected function setUp()
protected function setUp(): void
{
$this->setUpVfsDir();
$this->setUpDb();
parent::setUp();
}
@ -60,4 +62,11 @@ class DatabaseLockDriverTest extends LockTest
return new DatabaseLock($dba, $this->pid);
}
protected function tearDown(): void
{
$this->tearDownDb();
parent::tearDown();
}
}

View file

@ -38,7 +38,7 @@ abstract class LockTest extends MockedTest
abstract protected function getInstance();
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -46,7 +46,7 @@ abstract class LockTest extends MockedTest
$this->instance->releaseAll(true);
}
protected function tearDown()
protected function tearDown(): void
{
$this->instance->releaseAll(true);
parent::tearDown();

View file

@ -32,7 +32,7 @@ use Mockery\MockInterface;
class SemaphoreLockTest extends LockTest
{
protected function setUp()
protected function setUp(): void
{
/** @var MockInterface|Dice $dice */
$dice = Mockery::mock(Dice::class)->makePartial();
@ -61,8 +61,7 @@ class SemaphoreLockTest extends LockTest
public function testLockTTL()
{
// Semaphore doesn't work with TTL
return true;
self::markTestSkipped("Semaphore doesn't work with TTL");
}
/**

View file

@ -57,7 +57,7 @@ abstract class PConfigTest extends MockedTest
}
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -57,7 +57,7 @@ class StorageManagerTest extends DatabaseTest
use VFSTrait;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -296,7 +296,7 @@ class StorageManagerTest extends DatabaseTest
public function testMoveStorage($name, $assert, $assertName, $userBackend)
{
if (!$userBackend) {
return;
self::markTestSkipped("No user backend");
}
$this->loadFixture(__DIR__ . '/../../datasets/storage/database.fixture.php', $this->dba);

View file

@ -10,7 +10,7 @@ use Friendica\Test\Util\Database\StaticDatabase;
class DBATest extends DatabaseTest
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -30,7 +30,7 @@ use Friendica\Test\Util\Database\StaticDatabase;
class DBStructureTest extends DatabaseTest
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -18,7 +18,7 @@ class ProcessTest extends DatabaseTest
/** @var StaticDatabase */
private $dba;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -71,6 +71,9 @@ class ProcessTest extends DatabaseTest
self::assertEquals([['command' => 'test']], $this->dba->selectToArray('process', ['command'], ['pid' => 1]));
}
/**
* @doesNotPerformAssertions
*/
public function testWrongDelete()
{
$process = new Process($this->dba);

View file

@ -38,10 +38,12 @@ class DatabaseStorageTest extends StorageTest
use DatabaseTestTrait;
use VFSTrait;
protected function setUp()
protected function setUp(): void
{
$this->setUpVfsDir();
$this->setUpDb();
parent::setUp();
}
@ -68,4 +70,11 @@ class DatabaseStorageTest extends StorageTest
{
self::assertEmpty($storage->getOptions());
}
protected function tearDown(): void
{
$this->tearDownDb();
parent::tearDown();
}
}

View file

@ -39,7 +39,7 @@ class FilesystemStorageTest extends StorageTest
/** @var MockInterface|IConfig */
protected $config;
protected function setUp()
protected function setUp(): void
{
$this->setUpVfsDir();

View file

@ -35,7 +35,7 @@ class CookieTest extends MockedTest
/** @var MockInterface|BaseURL */
private $baseUrl;
protected function setUp()
protected function setUp(): void
{
StaticCookie::clearStatic();
@ -45,7 +45,7 @@ class CookieTest extends MockedTest
$this->baseUrl = \Mockery::mock(BaseURL::class);
}
protected function tearDown()
protected function tearDown(): void
{
StaticCookie::clearStatic();

View file

@ -37,7 +37,7 @@ class UserTest extends MockedTest
private $child;
private $manage;
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -31,7 +31,7 @@ use Psr\Log\NullLogger;
class CurlResultTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -3,11 +3,12 @@
namespace Friendica\Test\src\Security\TwoFactor\Factory;
use Friendica\Security\TwoFactor\Factory\TrustedBrowser;
use Friendica\Test\MockedTest;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Logger\VoidLogger;
use Friendica\Util\Strings;
class TrustedBrowserTest extends \PHPUnit_Framework_TestCase
class TrustedBrowserTest extends MockedTest
{
public function testCreateFromTableRowSuccess()
{

View file

@ -3,10 +3,11 @@
namespace Friendica\Test\src\Security\TwoFactor\Model;
use Friendica\Security\TwoFactor\Model\TrustedBrowser;
use Friendica\Test\MockedTest;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
class TrustedBrowserTest extends \PHPUnit_Framework_TestCase
class TrustedBrowserTest extends MockedTest
{
public function test__construct()
{

View file

@ -31,7 +31,7 @@ class ConfigFileLoaderTest extends MockedTest
{
use VFSTrait;
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -29,6 +29,15 @@ use PHPUnit\Framework\TestCase;
class CryptoTest extends TestCase
{
public static function tearDownAfterClass(): void
{
// Reset mocking
global $phpMock;
$phpMock = [];
parent::tearDownAfterClass();
}
/**
* Replaces random_int results with given mocks
*

View file

@ -35,7 +35,7 @@ class EMailerTest extends MockedTest
/** @var BaseURL|MockInterface */
private $baseUrl;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -53,7 +53,7 @@ class EMailerTest extends MockedTest
$this->baseUrl->shouldReceive('get')->andReturn('http://friendica.local');
}
protected function tearDown()
protected function tearDown(): void
{
EmailerSpy::$MAIL_DATA = [];

View file

@ -51,7 +51,7 @@ class MailBuilderTest extends MockedTest
/** @var string */
private $defaultHeaders;
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -41,7 +41,7 @@ class SystemMailBuilderTest extends MockedTest
/** @var BaseURL */
private $baseUrl;
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -58,7 +58,7 @@ abstract class AbstractLoggerTest extends MockedTest
*/
abstract protected function getInstance($level = LogLevel::DEBUG);
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -41,7 +41,7 @@ class ProfilerLoggerTest extends MockedTest
*/
private $profiler;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -52,6 +52,7 @@ class ProfilerLoggerTest extends MockedTest
/**
* Test if the profiler is profiling data
* @dataProvider dataTests
* @doesNotPerformAssertions
*/
public function testProfiling($function, $message, array $context)
{
@ -64,6 +65,7 @@ class ProfilerLoggerTest extends MockedTest
/**
* Test the log() function
* @doesNotPerformAssertions
*/
public function testProfilingLog()
{

View file

@ -42,7 +42,7 @@ class StreamLoggerTest extends AbstractLoggerTest
*/
private $fileSystem;
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View file

@ -31,7 +31,7 @@ class SyslogLoggerTest extends AbstractLoggerTest
*/
private $logger;
protected function setUp()
protected function setUp(): void
{
parent::setUp();
@ -86,8 +86,13 @@ class SyslogLoggerTest extends AbstractLoggerTest
*/
public function testServerException()
{
$this->expectException(\UnexpectedValueException::class);
$this->expectExceptionMessageRegExp("/Can\'t open syslog for ident \".*\" and facility \".*\": .* /");
if (PHP_MAJOR_VERSION < 8) {
$this->expectException(\UnexpectedValueException::class);
$this->expectExceptionMessageRegExp("/Can\'t open syslog for ident \".*\" and facility \".*\": .* /");
} else {
$this->expectException(\TypeError::class);
$this->expectExceptionMessage("openlog(): Argument #3 (\$facility) must be of type int, string given");
}
$logger = new SyslogLoggerWrapper('test', $this->introspection, LogLevel::DEBUG, null, 'a string');
$logger->emergency('not working');
@ -95,6 +100,7 @@ class SyslogLoggerTest extends AbstractLoggerTest
/**
* Test the close() method
* @doesNotPerformAssertions
*/
public function testClose()
{

View file

@ -32,6 +32,7 @@ class VoidLoggerTest extends MockedTest
/**
* Test if the profiler is profiling data
* @dataProvider dataTests
* @doesNotPerformAssertions
*/
public function testNormal($function, $message, array $context)
{
@ -41,6 +42,7 @@ class VoidLoggerTest extends MockedTest
/**
* Test the log() function
* @doesNotPerformAssertions
*/
public function testProfilingLog()
{

View file

@ -35,7 +35,7 @@ class ProfilerTest extends MockedTest
*/
private $logger;
protected function setUp()
protected function setUp(): void
{
parent::setUp();