Compare commits

...

11 Commits

Author SHA1 Message Date
Lukas Reschke fb06c23f87
Add memcached image
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-06-03 22:41:12 +02:00
Lukas Reschke e9a418262e
Add APCU extension
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-06-03 22:35:17 +02:00
John Molakvoæ (skjnldsv) 50021e15a9
Enable memcached
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-03 09:11:18 +02:00
John Molakvoæ (skjnldsv) ada17934d8
Fix tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-03 08:54:25 +02:00
John Molakvoæ (skjnldsv) 9e68804049
Format tests
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-03 08:54:25 +02:00
Lukas Reschke 7f47c90f37 Redis 2021-06-02 23:41:31 +02:00
Lukas Reschke 0acd7dc933 WIP 2021-06-02 23:34:04 +02:00
Lukas Reschke a93b6a9e32
WIP
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-06-02 23:14:14 +02:00
Lukas Reschke bdcd32ac7f
Use phpunit 9.5.4
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-06-02 23:04:21 +02:00
Lukas Reschke 559712d115
Use bash
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-06-02 23:01:29 +02:00
Lukas Reschke 4e2311d45c
Move NoDB PHPUnit to GitHub Actions
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-06-02 22:56:33 +02:00
10 changed files with 137 additions and 150 deletions

View File

@ -214,80 +214,6 @@ trigger:
- pull_request - pull_request
- push - push
---
kind: pipeline
name: nodb
steps:
- name: submodules
image: ghcr.io/nextcloud/continuous-integration-alpine-git:latest
commands:
- git submodule update --init
- name: nodb-php7.3
image: ghcr.io/nextcloud/continuous-integration-php7.3:php7.3-6
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
- name: nodb-php7.4
image: ghcr.io/nextcloud/continuous-integration-php7.4:php7.4-3
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
- name: nodb-php8.0
image: ghcr.io/nextcloud/continuous-integration-php8.0:latest
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
services:
- name: cache
image: ghcr.io/nextcloud/continuous-integration-redis:latest
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
---
kind: pipeline
name: sqlite
steps:
- name: submodules
image: ghcr.io/nextcloud/continuous-integration-alpine-git:latest
commands:
- git submodule update --init
- name: sqlite-php7.3
image: ghcr.io/nextcloud/continuous-integration-php7.3:php7.3-6
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
- name: sqlite-php7.4
image: ghcr.io/nextcloud/continuous-integration-php7.4:php7.4-3
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
- name: sqlite-php8.0
image: ghcr.io/nextcloud/continuous-integration-php8.0:latest
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
services:
- name: cache
image: ghcr.io/nextcloud/continuous-integration-redis:latest
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
--- ---
kind: pipeline kind: pipeline
name: mariadb10.1-php7.3 name: mariadb10.1-php7.3

View File

@ -3,29 +3,35 @@ on: pull_request
jobs: jobs:
php-linters: php-linters:
name: php${{ matrix.php-versions }} lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
php-versions: ['7.3', '7.4', '8.0'] php-versions: ['7.3', '7.4', '8.0']
name: php${{ matrix.php-versions }} lint
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@master
- name: Set up php${{ matrix.php-versions }} - name: Set up php${{ matrix.php-versions }}
uses: shivammathur/setup-php@master uses: shivammathur/setup-php@master
with: with:
php-version: ${{ matrix.php-versions }} php-version: ${{ matrix.php-versions }}
extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip
coverage: none coverage: none
- name: Lint - name: Lint
run: composer run lint run: composer run lint
php-cs-fixer: php-cs-fixer:
name: php-cs check name: php-cs check
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@master uses: actions/checkout@master
- name: Set up php - name: Set up php
uses: shivammathur/setup-php@master uses: shivammathur/setup-php@master
with: with:
@ -33,8 +39,10 @@ jobs:
extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip
coverage: none coverage: none
tools: cs2pr tools: cs2pr
- name: Install dependencies - name: Install dependencies
run: composer i run: composer i
- name: Run coding standards check - name: Run coding standards check
run: | run: |
composer run cs:check -- --format=checkstyle | cs2pr composer run cs:check -- --format=checkstyle | cs2pr
@ -42,13 +50,13 @@ jobs:
shell: bash shell: bash
node: node:
name: eslint node${{ matrix.node-version }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
node-version: [12.x] node-version: [12.x]
name: eslint node${{ matrix.node-version }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -1,56 +0,0 @@
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
phpunit-oci8:
runs-on: ubuntu-20.04
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: [ '7.4' ]
databases: [ 'oci' ]
name: php${{ matrix.php-versions }}-${{ matrix.databases }}
services:
oracle:
image: deepdiver/docker-oracle-xe-11g # "wnameless/oracle-xe-11g-r2"
ports:
- "1521:1521"
steps:
- name: Checkout server
uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ctype,curl,dom,fileinfo,gd,iconv,intl,json,mbstring,oci8,openssl,pdo_sqlite,posix,sqlite,xml,zip
tools: phpunit:8.5.2
coverage: none
- name: Set up Nextcloud
run: |
mkdir data
./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin
php -f index.php
- name: PHPUnit
working-directory: tests
run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB

119
.github/workflows/phpunit.yml vendored Normal file
View File

@ -0,0 +1,119 @@
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
php-extensions: apcu,cli,ctype,curl,dom,fileinfo,gd,iconv,intl,json,ldap,mbstring,memcached,mysql,oci8,openssl,pdo_sqlite,pgsql,posix,redis,sqlite,xml,zip
jobs:
phpunit-nodb:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ["7.3", "7.4", "8.0"]
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
submodules: true
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.php-extensions }}
tools: phpunit:9.5.4
coverage: none
- name: PHPUnit
env:
NOCOVERAGE: true
TEST_SELECTION: NODB
run: bash autotest.sh sqlite
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- "6379:6379"
memcached:
image: memcached
ports:
- "11211:11211"
phpunit-sqlite:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ["7.3", "7.4", "8.0"]
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
submodules: true
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.php-extensions }}
tools: phpunit:9.5.4
coverage: none
- name: PHPUnit
env:
NOCOVERAGE: true
run: bash autotest.sh sqlite
phpunit-oci8:
runs-on: ubuntu-20.04
# oci takes more time
needs: [phpunit-nodb, phpunit-sqlite]
strategy:
matrix:
php-versions: ["7.4"]
services:
oracle:
image: deepdiver/docker-oracle-xe-11g # "wnameless/oracle-xe-11g-r2"
ports:
- "1521:1521"
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
submodules: true
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.php-extensions }}
tools: phpunit:8.5.2
coverage: none
- name: Set up Nextcloud
run: |
mkdir data
./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=1521 --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin
php -f index.php
- name: PHPUnit
working-directory: tests
run: phpunit --configuration phpunit-autotest.xml --group DB,SLOWDB

View File

@ -89,7 +89,7 @@ class CoordinatorTest extends TestCase {
->with(\OCA\Settings\AppInfo\Application::class) ->with(\OCA\Settings\AppInfo\Application::class)
->willThrowException(new QueryException("")); ->willThrowException(new QueryException(""));
$this->logger->expects($this->once()) $this->logger->expects($this->once())
->method('logException'); ->method('error');
$this->coordinator->bootApp($appId); $this->coordinator->bootApp($appId);
} }

View File

@ -60,8 +60,6 @@ class RegistrationContextTest extends TestCase {
$container->expects($this->once()) $container->expects($this->once())
->method('registerCapability') ->method('registerCapability')
->with($name); ->with($name);
$this->logger->expects($this->never())
->method('logException');
$this->context->for('myapp')->registerCapability($name); $this->context->for('myapp')->registerCapability($name);
$this->context->delegateCapabilityRegistrations([ $this->context->delegateCapabilityRegistrations([
@ -76,8 +74,6 @@ class RegistrationContextTest extends TestCase {
$dispatcher->expects($this->once()) $dispatcher->expects($this->once())
->method('addServiceListener') ->method('addServiceListener')
->with($event, $service, 0); ->with($event, $service, 0);
$this->logger->expects($this->never())
->method('logException');
$this->context->for('myapp')->registerEventListener($event, $service); $this->context->for('myapp')->registerEventListener($event, $service);
$this->context->delegateEventListenerRegistrations($dispatcher); $this->context->delegateEventListenerRegistrations($dispatcher);
@ -98,8 +94,6 @@ class RegistrationContextTest extends TestCase {
$container->expects($this->once()) $container->expects($this->once())
->method('registerService') ->method('registerService')
->with($service, $factory, $shared); ->with($service, $factory, $shared);
$this->logger->expects($this->never())
->method('logException');
$this->context->for('myapp')->registerService($service, $factory, $shared); $this->context->for('myapp')->registerService($service, $factory, $shared);
$this->context->delegateContainerRegistrations([ $this->context->delegateContainerRegistrations([
@ -117,8 +111,6 @@ class RegistrationContextTest extends TestCase {
$container->expects($this->once()) $container->expects($this->once())
->method('registerAlias') ->method('registerAlias')
->with($alias, $target); ->with($alias, $target);
$this->logger->expects($this->never())
->method('logException');
$this->context->for('myapp')->registerServiceAlias($alias, $target); $this->context->for('myapp')->registerServiceAlias($alias, $target);
$this->context->delegateContainerRegistrations([ $this->context->delegateContainerRegistrations([
@ -136,8 +128,6 @@ class RegistrationContextTest extends TestCase {
$container->expects($this->once()) $container->expects($this->once())
->method('registerParameter') ->method('registerParameter')
->with($name, $value); ->with($name, $value);
$this->logger->expects($this->never())
->method('logException');
$this->context->for('myapp')->registerParameter($name, $value); $this->context->for('myapp')->registerParameter($name, $value);
$this->context->delegateContainerRegistrations([ $this->context->delegateContainerRegistrations([
@ -154,8 +144,6 @@ class RegistrationContextTest extends TestCase {
$container->expects($this->once()) $container->expects($this->once())
->method('registerMiddleware') ->method('registerMiddleware')
->with($name); ->with($name);
$this->logger->expects($this->never())
->method('logException');
$this->context->for('myapp')->registerMiddleware($name); $this->context->for('myapp')->registerMiddleware($name);
$this->context->delegateMiddlewareRegistrations([ $this->context->delegateMiddlewareRegistrations([

View File

@ -506,7 +506,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
->willReturn('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp'); ->willReturn('http://localhost/nextcloud/index.php/login?redirect_url=nextcloud/index.php/apps/specialapp');
$this->logger $this->logger
->expects($this->once()) ->expects($this->once())
->method('logException'); ->method('debug');
$response = $this->middleware->afterException( $response = $this->middleware->afterException(
$this->controller, $this->controller,
'test', 'test',
@ -576,7 +576,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->middleware = $this->getMiddleware(false, false, false); $this->middleware = $this->getMiddleware(false, false, false);
$this->logger $this->logger
->expects($this->once()) ->expects($this->once())
->method('logException'); ->method('debug');
$response = $this->middleware->afterException( $response = $this->middleware->afterException(
$this->controller, $this->controller,
'test', 'test',

View File

@ -62,6 +62,8 @@ class GuestAvatarTest extends TestCase {
* @return void * @return void
*/ */
public function testGet() { public function testGet() {
$this->markTestSkipped('Test relies on PHP GD output.');
$avatar = $this->guestAvatar->getFile(32); $avatar = $this->guestAvatar->getFile(32);
self::assertInstanceOf(InMemoryFile::class, $avatar); self::assertInstanceOf(InMemoryFile::class, $avatar);
$expectedFile = file_get_contents( $expectedFile = file_get_contents(

View File

@ -149,7 +149,7 @@ class CapabilitiesManagerTest extends TestCase {
}); });
$this->logger->expects($this->once()) $this->logger->expects($this->once())
->method('logException'); ->method('error');
$res = $this->manager->getCapabilities(); $res = $this->manager->getCapabilities();

View File

@ -82,7 +82,7 @@ class ProviderManagerTest extends TestCase {
->willThrowException(new QueryException('A meaningful error message')); ->willThrowException(new QueryException('A meaningful error message'));
$this->logger->expects($this->once()) $this->logger->expects($this->once())
->method('logException'); ->method('error');
$this->providerManager->registerResourceProvider('InvalidResourceProvider'); $this->providerManager->registerResourceProvider('InvalidResourceProvider');
$resourceProviders = $this->providerManager->getResourceProviders(); $resourceProviders = $this->providerManager->getResourceProviders();
@ -101,7 +101,7 @@ class ProviderManagerTest extends TestCase {
->willReturn($this->createMock(ResourceProvider::class)); ->willReturn($this->createMock(ResourceProvider::class));
$this->logger->expects($this->once()) $this->logger->expects($this->once())
->method('logException'); ->method('error');
$this->providerManager->registerResourceProvider('InvalidResourceProvider'); $this->providerManager->registerResourceProvider('InvalidResourceProvider');
$this->providerManager->registerResourceProvider(ResourceProvider::class); $this->providerManager->registerResourceProvider(ResourceProvider::class);