Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/privacy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-04-05 10:21:07 +0300
committerGitHub <noreply@github.com>2022-04-05 10:21:07 +0300
commitc08f04c94a33ada65f60d8eced85db8307b71a03 (patch)
tree39db0767962541ce1792163b0a02571c393ee7b7
parent16939efee3a47ab85c7a967c68f9dc1045c9c397 (diff)
parente555ac0e9fdc43cd12d21b8722def1b580d07b84 (diff)
Merge pull request #755 from nextcloud/update-master-php-testing-versions
Update master php testing versions
-rw-r--r--.github/workflows/lint-php.yml2
-rw-r--r--.github/workflows/phpunit-mysql.yml113
-rw-r--r--.github/workflows/phpunit-oci.yml105
-rw-r--r--.github/workflows/phpunit-pgsql.yml110
-rw-r--r--.github/workflows/phpunit-sqlite.yml99
-rw-r--r--phpunit.integration.xml7
-rw-r--r--phpunit.xml7
-rw-r--r--tests/Unit/Controller/AdminControllerTest.php0
-rw-r--r--tests/Unit/Controller/PageControllerTest.php29
-rw-r--r--tests/Unit/Controller/PersonalControllerTest.php0
-rw-r--r--tests/Unit/Migration/Version100Date20190217131943Test.php0
-rw-r--r--tests/Unit/Settings/MissionSettingsTest.php0
-rw-r--r--tests/Unit/Settings/PrivacySectionTest.php0
-rw-r--r--tests/Unit/Settings/UserDataManifestoSettingsTest.php0
-rw-r--r--tests/Unit/Settings/WhereIsMyDataSettingsTest.php0
-rw-r--r--tests/Unit/Settings/WhoHasAccessSettingsTest.php0
-rw-r--r--tests/bootstrap.php2
-rw-r--r--tests/phpunit.integration.xml7
18 files changed, 436 insertions, 45 deletions
diff --git a/.github/workflows/lint-php.yml b/.github/workflows/lint-php.yml
index 7be6843..9cfb484 100644
--- a/.github/workflows/lint-php.yml
+++ b/.github/workflows/lint-php.yml
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- php-versions: ["7.4", "8.0"]
+ php-versions: ["7.4", "8.0", "8.1"]
name: php-lint
diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml
new file mode 100644
index 0000000..4531215
--- /dev/null
+++ b/.github/workflows/phpunit-mysql.yml
@@ -0,0 +1,113 @@
+name: PHPUnit
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+ - stable*
+
+env:
+ # Location of the phpunit.xml and phpunit.integration.xml files
+ PHPUNIT_CONFIG: ./tests/phpunit.xml
+ PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
+
+jobs:
+ phpunit-mysql:
+ runs-on: ubuntu-latest
+
+ strategy:
+ # do not stop on another job's failure
+ fail-fast: false
+ matrix:
+ php-versions: ['7.4', '8.0', '8.1']
+ server-versions: ['master']
+
+ services:
+ mysql:
+ image: mariadb:10.5
+ ports:
+ - 4444:3306/tcp
+ env:
+ MYSQL_ROOT_PASSWORD: rootpassword
+ options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
+
+ steps:
+ - name: Set app env
+ run: |
+ # Split and keep last
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
+
+ - name: Enable ONLY_FULL_GROUP_BY MySQL option
+ run: |
+ echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
+ echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
+
+ - name: Checkout server
+ uses: actions/checkout@v3
+ with:
+ submodules: true
+ repository: nextcloud/server
+ ref: ${{ matrix.server-versions }}
+
+ - name: Checkout app
+ uses: actions/checkout@v3
+ with:
+ path: apps/${{ env.APP_NAME }}
+
+ - name: Set up php ${{ matrix.php-versions }}
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ tools: phpunit
+ extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
+ coverage: none
+
+ - name: Set up PHPUnit
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer i
+
+ - name: Set up Nextcloud
+ env:
+ DB_PORT: 4444
+ run: |
+ mkdir data
+ ./occ maintenance:install --verbose --database=mysql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
+ ./occ app:enable --force ${{ env.APP_NAME }}
+ php -S localhost:8080 &
+
+ - name: Check PHPUnit config file existence
+ id: check_phpunit
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
+
+ - name: PHPUnit
+ # Only run if phpunit config file exists
+ if: steps.check_phpunit.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
+
+ - name: Check PHPUnit integration config file existence
+ id: check_integration
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ - name: PHPUnit integration
+ # Only run if phpunit integration config file exists
+ if: steps.check_integration.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ summary:
+ runs-on: ubuntu-latest
+ needs: phpunit-mysql
+
+ if: always()
+
+ name: phpunit-mysql-summary
+
+ steps:
+ - name: Summary status
+ run: if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-oci.yml b/.github/workflows/phpunit-oci.yml
new file mode 100644
index 0000000..390c50e
--- /dev/null
+++ b/.github/workflows/phpunit-oci.yml
@@ -0,0 +1,105 @@
+name: PHPUnit
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+ - stable*
+
+env:
+ # Location of the phpunit.xml and phpunit.integration.xml files
+ PHPUNIT_CONFIG: ./tests/phpunit.xml
+ PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
+
+jobs:
+ phpunit-oci:
+ runs-on: ubuntu-20.04
+
+ strategy:
+ # do not stop on another job's failure
+ fail-fast: false
+ matrix:
+ php-versions: ['8.0']
+ server-versions: ['master']
+
+ services:
+ oracle:
+ image: deepdiver/docker-oracle-xe-11g # 'wnameless/oracle-xe-11g-r2'
+ ports:
+ - 1521:1521/tcp
+
+ steps:
+ - name: Set app env
+ run: |
+ # Split and keep last
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
+
+ - name: Checkout server
+ uses: actions/checkout@v3
+ with:
+ submodules: true
+ repository: nextcloud/server
+ ref: ${{ matrix.server-versions }}
+
+ - name: Checkout app
+ uses: actions/checkout@v3
+ with:
+ path: apps/${{ env.APP_NAME }}
+
+ - name: Set up php ${{ matrix.php-versions }}
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, oci8
+ tools: phpunit
+ coverage: none
+
+ - name: Set up PHPUnit
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer i
+
+ - name: Set up Nextcloud
+ env:
+ DB_PORT: 1521
+ run: |
+ mkdir data
+ ./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin
+ ./occ app:enable --force ${{ env.APP_NAME }}
+ php -S localhost:8080 &
+
+ - name: Check PHPUnit config file existence
+ id: check_phpunit
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
+
+ - name: PHPUnit
+ # Only run if phpunit config file exists
+ if: steps.check_phpunit.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
+
+ - name: Check PHPUnit integration config file existence
+ id: check_integration
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ - name: PHPUnit integration
+ # Only run if phpunit integration config file exists
+ if: steps.check_integration.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ summary:
+ runs-on: ubuntu-latest
+ needs: phpunit-oci
+
+ if: always()
+
+ name: phpunit-oci-summary
+
+ steps:
+ - name: Summary status
+ run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml
new file mode 100644
index 0000000..09894e4
--- /dev/null
+++ b/.github/workflows/phpunit-pgsql.yml
@@ -0,0 +1,110 @@
+name: PHPUnit
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+ - stable*
+
+env:
+ # Location of the phpunit.xml and phpunit.integration.xml files
+ PHPUNIT_CONFIG: ./tests/phpunit.xml
+ PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
+
+jobs:
+ phpunit-pgsql:
+ runs-on: ubuntu-latest
+
+ strategy:
+ # do not stop on another job's failure
+ fail-fast: false
+ matrix:
+ php-versions: ['8.0']
+ server-versions: ['master']
+
+ services:
+ postgres:
+ image: postgres
+ ports:
+ - 4444:5432/tcp
+ env:
+ POSTGRES_USER: root
+ POSTGRES_PASSWORD: rootpassword
+ POSTGRES_DB: nextcloud
+ options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
+
+ steps:
+ - name: Set app env
+ run: |
+ # Split and keep last
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
+
+ - name: Checkout server
+ uses: actions/checkout@v3
+ with:
+ submodules: true
+ repository: nextcloud/server
+ ref: ${{ matrix.server-versions }}
+
+ - name: Checkout app
+ uses: actions/checkout@v3
+ with:
+ path: apps/${{ env.APP_NAME }}
+
+ - name: Set up php ${{ matrix.php-versions }}
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ tools: phpunit
+ extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql
+ coverage: none
+
+ - name: Set up PHPUnit
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer i
+
+ - name: Set up Nextcloud
+ env:
+ DB_PORT: 4444
+ run: |
+ mkdir data
+ ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
+ ./occ app:enable --force ${{ env.APP_NAME }}
+ php -S localhost:8080 &
+
+ - name: Check PHPUnit config file existence
+ id: check_phpunit
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
+
+ - name: PHPUnit
+ # Only run if phpunit config file exists
+ if: steps.check_phpunit.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
+
+ - name: Check PHPUnit integration config file existence
+ id: check_integration
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ - name: PHPUnit integration
+ # Only run if phpunit integration config file exists
+ if: steps.check_integration.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ summary:
+ runs-on: ubuntu-latest
+ needs: phpunit-pgsql
+
+ if: always()
+
+ name: phpunit-pgsql-summary
+
+ steps:
+ - name: Summary status
+ run: if ${{ needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml
new file mode 100644
index 0000000..5992ce2
--- /dev/null
+++ b/.github/workflows/phpunit-sqlite.yml
@@ -0,0 +1,99 @@
+name: PHPUnit
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+ - stable*
+
+env:
+ # Location of the phpunit.xml and phpunit.integration.xml files
+ PHPUNIT_CONFIG: ./tests/phpunit.xml
+ PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
+
+jobs:
+ phpunit-sqlite:
+ runs-on: ubuntu-latest
+
+ strategy:
+ # do not stop on another job's failure
+ fail-fast: false
+ matrix:
+ php-versions: ['8.0']
+ server-versions: ['master']
+
+ steps:
+ - name: Set app env
+ run: |
+ # Split and keep last
+ echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
+
+ - name: Checkout server
+ uses: actions/checkout@v3
+ with:
+ submodules: true
+ repository: nextcloud/server
+ ref: ${{ matrix.server-versions }}
+
+ - name: Checkout app
+ uses: actions/checkout@v3
+ with:
+ path: apps/${{ env.APP_NAME }}
+
+ - name: Set up php ${{ matrix.php-versions }}
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ tools: phpunit
+ extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
+ coverage: none
+
+ - name: Set up PHPUnit
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer i
+
+ - name: Set up Nextcloud
+ env:
+ DB_PORT: 4444
+ run: |
+ mkdir data
+ ./occ maintenance:install --verbose --database=sqlite --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
+ ./occ app:enable --force ${{ env.APP_NAME }}
+ php -S localhost:8080 &
+
+ - name: Check PHPUnit config file existence
+ id: check_phpunit
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
+
+ - name: PHPUnit
+ # Only run if phpunit config file exists
+ if: steps.check_phpunit.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
+
+ - name: Check PHPUnit integration config file existence
+ id: check_integration
+ uses: andstor/file-existence-action@v1
+ with:
+ files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ - name: PHPUnit integration
+ # Only run if phpunit integration config file exists
+ if: steps.check_integration.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
+
+ summary:
+ runs-on: ubuntu-latest
+ needs: phpunit-sqlite
+
+ if: always()
+
+ name: phpunit-sqlite-summary
+
+ steps:
+ - name: Summary status
+ run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi
diff --git a/phpunit.integration.xml b/phpunit.integration.xml
deleted file mode 100644
index eae19f1..0000000
--- a/phpunit.integration.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<phpunit bootstrap="tests/bootstrap.php" colors="true">
- <testsuites>
- <testsuite name="integration">
- <directory>./tests/Integration</directory>
- </testsuite>
- </testsuites>
-</phpunit>
diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index 82c96d6..0000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<phpunit bootstrap="tests/bootstrap.php" colors="true">
- <testsuites>
- <testsuite name="unit">
- <directory>./tests/Unit</directory>
- </testsuite>
- </testsuites>
-</phpunit>
diff --git a/tests/Unit/Controller/AdminControllerTest.php b/tests/Unit/Controller/AdminControllerTest.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Controller/AdminControllerTest.php
+++ /dev/null
diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php
deleted file mode 100644
index cfbe78f..0000000
--- a/tests/Unit/Controller/PageControllerTest.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-namespace OCA\Privacy\Tests\Unit\Controller;
-
-use PHPUnit_Framework_TestCase;
-
-use OCP\AppFramework\Http\TemplateResponse;
-
-use OCA\Privacy\Controller\PageController;
-
-class PageControllerTest extends PHPUnit_Framework_TestCase {
- private $controller;
- private $userId = 'john';
-
- protected function setUp(): void {
- $request = $this->getMockBuilder('OCP\IRequest')->getMock();
-
- $this->controller = new PageController(
- 'privacy', $request, $this->userId
- );
- }
-
- public function testIndex() {
- $result = $this->controller->index();
-
- $this->assertEquals('index', $result->getTemplateName());
- $this->assertTrue($result instanceof TemplateResponse);
- }
-}
diff --git a/tests/Unit/Controller/PersonalControllerTest.php b/tests/Unit/Controller/PersonalControllerTest.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Controller/PersonalControllerTest.php
+++ /dev/null
diff --git a/tests/Unit/Migration/Version100Date20190217131943Test.php b/tests/Unit/Migration/Version100Date20190217131943Test.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Migration/Version100Date20190217131943Test.php
+++ /dev/null
diff --git a/tests/Unit/Settings/MissionSettingsTest.php b/tests/Unit/Settings/MissionSettingsTest.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Settings/MissionSettingsTest.php
+++ /dev/null
diff --git a/tests/Unit/Settings/PrivacySectionTest.php b/tests/Unit/Settings/PrivacySectionTest.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Settings/PrivacySectionTest.php
+++ /dev/null
diff --git a/tests/Unit/Settings/UserDataManifestoSettingsTest.php b/tests/Unit/Settings/UserDataManifestoSettingsTest.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Settings/UserDataManifestoSettingsTest.php
+++ /dev/null
diff --git a/tests/Unit/Settings/WhereIsMyDataSettingsTest.php b/tests/Unit/Settings/WhereIsMyDataSettingsTest.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Settings/WhereIsMyDataSettingsTest.php
+++ /dev/null
diff --git a/tests/Unit/Settings/WhoHasAccessSettingsTest.php b/tests/Unit/Settings/WhoHasAccessSettingsTest.php
deleted file mode 100644
index e69de29..0000000
--- a/tests/Unit/Settings/WhoHasAccessSettingsTest.php
+++ /dev/null
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 4f15097..550e061 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -12,7 +12,7 @@ require_once __DIR__.'/../../../lib/base.php';
// Fix for "Autoload path not allowed: .../privacy/tests/testcase.php"
\OC_App::loadApp('privacy');
-if (!class_exists('PHPUnit_Framework_TestCase')) {
+if (!class_exists('\PHPUnit\Framework\TestCase')) {
require_once('PHPUnit/Autoload.php');
}
diff --git a/tests/phpunit.integration.xml b/tests/phpunit.integration.xml
new file mode 100644
index 0000000..a328467
--- /dev/null
+++ b/tests/phpunit.integration.xml
@@ -0,0 +1,7 @@
+<phpunit bootstrap="bootstrap.php" colors="true">
+ <testsuites>
+ <testsuite name="integration">
+ <directory>./Integration</directory>
+ </testsuite>
+ </testsuites>
+</phpunit>