strategy:
fail-fast: false
matrix:
- php-versions: ['7.2', '7.3', '7.4']
+ php-versions: ['7.2', '7.3', '7.4', '8.0']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: composer install --prefer-dist
+ - name: Install PHPUnit 8
+ run: curl -O -L https://phar.phpunit.de/phpunit-8.phar
+ && chmod +x phpunit-8.phar
+ && mv phpunit-8.phar /usr/local/bin/phpunit
+
- name: Copy default Friendica config
run: cp config/local-sample.config.php config/local.config.php
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: /usr/local/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
env:
MYSQL_HOST: 127.0.0.1
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
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);
/**
* Test the api_login() function without any login.
*
- * @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
+ * @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/
public function testApiLoginWithoutLogin()
/**
* Test the api_login() function with a bad login.
*
- * @return void
* @runInSeparateProcess
* @preserveGlobalState disabled
+ * @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/
public function testApiLoginWithBadLogin()
/**
* Test the api_login() function with a correct login.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
* @doesNotPerformAssertions
*/
public function testApiLoginWithCorrectLogin()
/**
* Test the api_login() function with a remote user.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
* @expectedException Friendica\Network\HTTPException\UnauthorizedException
*/
public function testApiLoginWithRemoteUser()
/**
* Test the api_call() function.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCall()
{
/**
* Test the api_call() function with the profiled enabled.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithProfiler()
{
/**
* Test the api_call() function without any result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithNoResult()
{
/**
* Test the api_call() function with an unimplemented API.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithUninplementedApi()
{
/**
* Test the api_call() function with a JSON result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithJson()
{
/**
* Test the api_call() function with an XML result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithXml()
{
/**
* Test the api_call() function with an RSS result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithRss()
{
/**
* Test the api_call() function with an Atom result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithAtom()
{
/**
* Test the api_call() function with an unallowed method.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithWrongMethod()
{
/**
* Test the api_call() function with an unauthorized user.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiCallWithWrongAuth()
{
/**
* Test the api_error() function with a JSON result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiErrorWithJson()
{
/**
* Test the api_error() function with an XML result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiErrorWithXml()
{
/**
* Test the api_error() function with an RSS result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiErrorWithRss()
{
/**
* Test the api_error() function with an Atom result.
*
- * @return void
* @runInSeparateProcess
+ * @preserveGlobalState disabled
*/
public function testApiErrorWithAtom()
{
/**
* 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()
{
+++ /dev/null
-<?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>
<?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>