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

github.com/nextcloud/notifications.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>2020-11-12 10:58:03 +0300
committerGitHub <noreply@github.com>2020-11-12 10:58:03 +0300
commit9706ec9842a011be9890a20083bc23aae04cf46e (patch)
tree0cfd8b3f71c63399c427b2e8990a4ac9f769a209
parent5ee91044e28b22fd0d5d9a692c2d02ffca5ddad4 (diff)
parent449b38055eaa94c750724691109bad3b0543cf52 (diff)
Merge pull request #796 from nextcloud/backport/793/stable20v20.0.2RC2v20.0.2RC1v20.0.2
[stable20] Fix loading notifications without a message on oracle
-rw-r--r--.github/workflows/oci.yml73
-rw-r--r--.travis.yml2
-rw-r--r--lib/Handler.php2
-rw-r--r--tests/Unit/HandlerTest.php56
4 files changed, 130 insertions, 3 deletions
diff --git a/.github/workflows/oci.yml b/.github/workflows/oci.yml
new file mode 100644
index 0000000..34ee5aa
--- /dev/null
+++ b/.github/workflows/oci.yml
@@ -0,0 +1,73 @@
+name: PHPUnit
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+ - stable*
+
+env:
+ APP_NAME: notifications
+
+jobs:
+ oci:
+ runs-on: ubuntu-latest
+
+ strategy:
+ # do not stop on another job's failure
+ fail-fast: false
+ matrix:
+ php-versions: ['7.4']
+ databases: ['oci']
+ server-versions: ['stable20']
+
+ name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
+
+ 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:
+ repository: nextcloud/server
+ ref: ${{ matrix.server-versions }}
+
+ - 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: Checkout app
+ uses: actions/checkout@v2
+ with:
+ path: apps/${{ env.APP_NAME }}
+
+ - name: Set up PHPUnit
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer i
+
+ - name: Set up php ${{ matrix.php-versions }}
+ uses: "shivammathur/setup-php@v2"
+ with:
+ php-version: "${{ matrix.php-versions }}"
+ extensions: mbstring, iconv, fileinfo, intl, oci8
+ 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
+ ./occ app:enable --force ${{ env.APP_NAME }}
+
+ - name: PHPUnit
+ working-directory: apps/${{ env.APP_NAME }}/tests/Unit
+ run: phpunit -c phpunit.xml
diff --git a/.travis.yml b/.travis.yml
index e426407..6c21549 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -70,8 +70,6 @@ matrix:
env: DB=mysql
- php: 7.3
env: DB=pgsql
- - php: 7.3
- env: DB=oracle
- php: 7.2
env: DB=mysql;INTEGRATION=1
allow_failures:
diff --git a/lib/Handler.php b/lib/Handler.php
index 2a16a2b..4bf1d95 100644
--- a/lib/Handler.php
+++ b/lib/Handler.php
@@ -307,7 +307,7 @@ class Handler {
->setObject($row['object_type'], $row['object_id'])
->setSubject($row['subject'], (array) json_decode($row['subject_parameters'], true));
- if ($row['message'] !== '') {
+ if ($row['message'] !== '' && $row['message'] !== null) {
$notification->setMessage($row['message'], (array) json_decode($row['message_parameters'], true));
}
if ($row['link'] !== '' && $row['link'] !== null) {
diff --git a/tests/Unit/HandlerTest.php b/tests/Unit/HandlerTest.php
index d6f7ea4..23cec0a 100644
--- a/tests/Unit/HandlerTest.php
+++ b/tests/Unit/HandlerTest.php
@@ -106,6 +106,62 @@ class HandlerTest extends TestCase {
$this->assertSame(0, $this->handler->count($limitedNotification2), 'Wrong notification count for user2 after deleting');
}
+ public function testFullEmptyMessageForOracle() {
+ $notification = $this->getNotification([
+ 'getApp' => 'testing_notifications',
+ 'getUser' => 'test_user1',
+ 'getDateTime' => new \DateTime(),
+ 'getObjectType' => 'notification',
+ 'getObjectId' => '1337',
+ 'getSubject' => 'subject',
+ 'getSubjectParameters' => [],
+ 'getMessage' => '',
+ 'getMessageParameters' => [],
+ 'getLink' => 'link',
+ 'getIcon' => 'icon',
+ 'getActions' => [
+ [
+ 'getLabel' => 'action_label',
+ 'getLink' => 'action_link',
+ 'getRequestType' => 'GET',
+ 'isPrimary' => false,
+ ]
+ ],
+ ]);
+ $limitedNotification1 = $this->getNotification([
+ 'getApp' => 'testing_notifications',
+ 'getUser' => 'test_user1',
+ ]);
+ $limitedNotification2 = $this->getNotification([
+ 'getApp' => 'testing_notifications',
+ 'getUser' => 'test_user2',
+ ]);
+
+ // Make sure there is no notification
+ $this->assertSame(0, $this->handler->count($limitedNotification1), 'Wrong notification count for user1 before adding');
+ $notifications = $this->handler->get($limitedNotification1);
+ $this->assertCount(0, $notifications, 'Wrong notification count for user1 before beginning');
+ $this->assertSame(0, $this->handler->count($limitedNotification2), 'Wrong notification count for user2 before adding');
+ $notifications = $this->handler->get($limitedNotification2);
+ $this->assertCount(0, $notifications, 'Wrong notification count for user2 before beginning');
+
+ // Add and count
+ $this->assertGreaterThan(0, $this->handler->add($notification));
+ $this->assertSame(1, $this->handler->count($limitedNotification1), 'Wrong notification count for user1 after adding');
+ $this->assertSame(0, $this->handler->count($limitedNotification2), 'Wrong notification count for user2 after adding');
+
+ // Get and count
+ $notifications = $this->handler->get($limitedNotification1);
+ $this->assertCount(1, $notifications, 'Wrong notification get for user1 after adding');
+ $notifications = $this->handler->get($limitedNotification2);
+ $this->assertCount(0, $notifications, 'Wrong notification get for user2 after adding');
+
+ // Delete and count again
+ $this->handler->delete($notification);
+ $this->assertSame(0, $this->handler->count($limitedNotification1), 'Wrong notification count for user1 after deleting');
+ $this->assertSame(0, $this->handler->count($limitedNotification2), 'Wrong notification count for user2 after deleting');
+ }
+
public function testDeleteById() {
$notification = $this->getNotification([
'getApp' => 'testing_notifications',