Skip to content

Commit

Permalink
Doctrine fix (#1113)
Browse files Browse the repository at this point in the history
## Satisfy Scrutinizer
- Fixing some scrutinizer deprication warnings around doctrine
  - Removing type constants and usage of Doctrine/DBAL/types/types
  - Added doctrine/orm to composer dev-dependencies
- fixed some minor issues reported by scrutinizer
- update phpunit to ^8.5
## Satisfy Travis-ci
- Added PHP 7.4 to Travis-ci
  - Switched Distribution from Trusty to Xenial due to missing module error on Trusty
- Removed and added some configuration entries due to travis-ci hints
- removed external coverage test, because we don't have one
- switch NC branch to stable19
  • Loading branch information
dartcafe authored Sep 21, 2020
1 parent 9547334 commit 517170d
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 99 deletions.
19 changes: 9 additions & 10 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
filter:
excluded_paths:
- 'l10n/*'
- 'js/vendor/*'
excluded_paths:
- 'l10n/*'
- 'js/vendor/*'

imports:
- javascript
- php
- javascript
- php

tools:
external_code_coverage:
timeout: 60
external_code_coverage: false

build:
tests:
override:
- jshint-run --config .jshintrc
tests:
override:
- jshint-run --config .jshintrc
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sudo: false
dist: trusty
dist: xenial
language: php
os: linux

services:
- mysql
Expand All @@ -9,6 +9,7 @@ services:
php:
- 7.2
- 7.3
- 7.4

addons:
apt:
Expand All @@ -17,9 +18,9 @@ addons:

env:
global:
- CORE_BRANCH=stable17
- CORE_BRANCH=stable19
- APP_NAME=polls
matrix:
jobs:
- DB=mysql
- DB=pgsql
- DB=sqlite
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
},
"require-dev": {
"christophwurst/nextcloud": "^19.0",
"phpunit/phpunit": "^8.2",
"phpunit/phpunit": "^8.5",
"league/factory-muffin": "^3.0",
"league/factory-muffin-faker": "^2.0",
"nextcloud/coding-standard": "^0.3.0"
"nextcloud/coding-standard": "^0.3.0",
"doctrine/orm": "^2.7"
},
"scripts": {
"cs:check": "php-cs-fixer fix --dry-run --diff",
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/OptionApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OCA\Polls\Controller;

use \Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\Polls\Exceptions\NotAuthorizedException;

Expand Down
2 changes: 1 addition & 1 deletion lib/Cron/NotificationCron.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace OCA\Polls\Cron;

use OC\BackgroundJob\TimedJob;
use OCP\BackgroundJob\TimedJob;
use OCA\Polls\Service\MailService;

class NotificationCron extends TimedJob {
Expand Down
63 changes: 31 additions & 32 deletions lib/Migration/Version0009Date20181125061900.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

namespace OCA\Polls\Migration;

use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\IConfig;
use OCP\IDBConnection;
Expand Down Expand Up @@ -64,57 +63,57 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op

if (!$schema->hasTable('polls_events')) {
$table = $schema->createTable('polls_events');
$table->addColumn('id', Type::INTEGER, [
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('hash', Type::STRING, [
$table->addColumn('hash', 'string', [
'notnull' => false,
'length' => 64,
]);
$table->addColumn('type', Type::BIGINT, [
$table->addColumn('type', 'bigint', [
'notnull' => false,
'length' => 16,
]);
$table->addColumn('title', Type::STRING, [
$table->addColumn('title', 'string', [
'notnull' => true,
'length' => 128,
]);
$table->addColumn('description', Type::STRING, [
$table->addColumn('description', 'string', [
'notnull' => true,
'length' => 1024,
]);
$table->addColumn('owner', Type::STRING, [
$table->addColumn('owner', 'string', [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('created', Type::DATETIME, [
$table->addColumn('created', 'datetime', [
'notnull' => false,
]);
$table->addColumn('access', Type::STRING, [
$table->addColumn('access', 'string', [
'notnull' => false,
'length' => 1024,
]);
$table->addColumn('expire', Type::DATETIME, [
$table->addColumn('expire', 'datetime', [
'notnull' => false,
]);
$table->addColumn('is_anonymous', Type::INTEGER, [
$table->addColumn('is_anonymous', 'integer', [
'notnull' => false,
'default' => 0,
]);
$table->addColumn('full_anonymous', Type::INTEGER, [
$table->addColumn('full_anonymous', 'integer', [
'notnull' => false,
'default' => 0,
]);
$table->addColumn('allow_maybe', Type::INTEGER, [
$table->addColumn('allow_maybe', 'integer', [
'notnull' => false,
'default' => 1,
]);
$table->setPrimaryKey(['id']);
} else {
$table = $schema->getTable('polls_events');
if (!$table->hasColumn('allow_maybe')) {
$table->addColumn('allow_maybe', Type::INTEGER, [
$table->addColumn('allow_maybe', 'integer', [
'notnull' => false,
'default' => 1,
]);
Expand All @@ -123,18 +122,18 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op

if (!$schema->hasTable('polls_options')) {
$table = $schema->createTable('polls_options');
$table->addColumn('id', Type::INTEGER, [
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('poll_id', Type::INTEGER, [
$table->addColumn('poll_id', 'integer', [
'notnull' => false,
]);
$table->addColumn('poll_option_text', Type::STRING, [
$table->addColumn('poll_option_text', 'string', [
'notnull' => false,
'length' => 256,
]);
$table->addColumn('timestamp', Type::INTEGER, [
$table->addColumn('timestamp', 'integer', [
'notnull' => false,
'default' => 0
]);
Expand All @@ -143,27 +142,27 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op

if (!$schema->hasTable('polls_votes')) {
$table = $schema->createTable('polls_votes');
$table->addColumn('id', Type::INTEGER, [
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('poll_id', Type::INTEGER, [
$table->addColumn('poll_id', 'integer', [
'notnull' => false,
]);
$table->addColumn('user_id', Type::STRING, [
$table->addColumn('user_id', 'string', [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('vote_option_id', Type::INTEGER, [
$table->addColumn('vote_option_id', 'integer', [
'notnull' => true,
'default' => 0,
'length' => 64,
]);
$table->addColumn('vote_option_text', Type::STRING, [
$table->addColumn('vote_option_text', 'string', [
'notnull' => false,
'length' => 256,
]);
$table->addColumn('vote_answer', Type::STRING, [
$table->addColumn('vote_answer', 'string', [
'notnull' => false,
'length' => 64,
]);
Expand All @@ -172,22 +171,22 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op

if (!$schema->hasTable('polls_comments')) {
$table = $schema->createTable('polls_comments');
$table->addColumn('id', Type::INTEGER, [
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('poll_id', Type::INTEGER, [
$table->addColumn('poll_id', 'integer', [
'notnull' => false,
]);
$table->addColumn('user_id', Type::STRING, [
$table->addColumn('user_id', 'string', [
'notnull' => true,
'length' => 64,
]);
$table->addColumn('dt', Type::STRING, [
$table->addColumn('dt', 'string', [
'notnull' => true,
'length' => 32,
]);
$table->addColumn('comment', Type::STRING, [
$table->addColumn('comment', 'string', [
'notnull' => false,
'length' => 1024,
]);
Expand All @@ -196,14 +195,14 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op

if (!$schema->hasTable('polls_notif')) {
$table = $schema->createTable('polls_notif');
$table->addColumn('id', Type::INTEGER, [
$table->addColumn('id', 'integer', [
'autoincrement' => true,
'notnull' => true,
]);
$table->addColumn('poll_id', Type::INTEGER, [
$table->addColumn('poll_id', 'integer', [
'notnull' => false,
]);
$table->addColumn('user_id', Type::STRING, [
$table->addColumn('user_id', 'string', [
'notnull' => true,
'length' => 64,
]);
Expand Down
Loading

0 comments on commit 517170d

Please sign in to comment.