]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #3758 from wallabag/dropping-php5
authorJérémy Benoist <j0k3r@users.noreply.github.com>
Thu, 29 Nov 2018 15:41:23 +0000 (16:41 +0100)
committerGitHub <noreply@github.com>
Thu, 29 Nov 2018 15:41:23 +0000 (16:41 +0100)
Dropping PHP < 7.1

41 files changed:
.travis.yml
.zappr.yaml [deleted file]
COPYING.md
README.md
app/AppKernel.php
app/DoctrineMigrations/Version20180405182455.php
app/DoctrineMigrations/Version20181128203230.php [new file with mode: 0644]
app/autoload.php [deleted file]
app/config/config.yml
app/config/config_test.yml
app/config/parameters.yml.dist
app/config/parameters_test.yml
app/config/services_test.yml
app/config/tests/parameters_test.mysql.yml
app/config/tests/parameters_test.pgsql.yml
app/config/tests/parameters_test.sqlite.yml
bin/console
composer.json
phpunit.xml.dist
src/Wallabag/AnnotationBundle/DataFixtures/AnnotationFixtures.php [moved from src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php with 67% similarity]
src/Wallabag/ApiBundle/Entity/AccessToken.php
src/Wallabag/ApiBundle/Entity/AuthCode.php
src/Wallabag/ApiBundle/Entity/RefreshToken.php
src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php [moved from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php with 81% similarity]
src/Wallabag/CoreBundle/DataFixtures/EntryFixtures.php [moved from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php with 90% similarity]
src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php [moved from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php with 71% similarity]
src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php [moved from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php with 58% similarity]
src/Wallabag/CoreBundle/DataFixtures/TagFixtures.php [moved from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php with 70% similarity]
src/Wallabag/CoreBundle/DataFixtures/TaggingRuleFixtures.php [moved from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php with 77% similarity]
src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php [deleted file]
src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php [deleted file]
src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
src/Wallabag/CoreBundle/Entity/TaggingRule.php
src/Wallabag/UserBundle/DataFixtures/UserFixtures.php [moved from src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php with 79% similarity]
tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
tests/Wallabag/ApiBundle/WallabagApiTestCase.php
tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
web/app.php
web/app_dev.php

index 393063439ddf7def288d330a88467304a6d994b3..9d7fd3a0da32b36504f0187a0c888efef48c8018 100644 (file)
@@ -4,12 +4,6 @@ services:
     - rabbitmq
     - redis
 
-# used for HHVM
-addons:
-    apt:
-        packages:
-            - tidy
-
 # cache vendor dirs
 cache:
     apt: true
@@ -21,10 +15,9 @@ cache:
         - $HOME/.yarn-cache
 
 php:
-    - 5.6
-    - 7.0
     - 7.1
     - 7.2
+    - 7.3
     - nightly
 
 node_js:
@@ -38,10 +31,11 @@ env:
 matrix:
     fast_finish: true
     include:
-        - php: 7.0
+        - php: 7.2
           env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite
     allow_failures:
         - php: nightly
+        - php: 7.3
 
 # exclude v1 branches
 branches:
@@ -63,14 +57,6 @@ before_script:
     - if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
     - composer self-update --no-progress
     - if [[ $DB = pgsql ]]; then psql -c 'create database wallabag_test;' -U postgres; fi;
-    # increase swap to avoid "proc_open(): fork failed - Cannot allocate memory"
-    # this should be removed when no more PHP 5 build will be defined
-    - sudo swapon -s
-    - sudo fallocate -l 4G /swapfile
-    - sudo chmod 600 /swapfile
-    - sudo mkswap /swapfile
-    - sudo swapon /swapfile
-    - sudo swapon -s
 
 script:
     - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist
@@ -78,11 +64,9 @@ script:
     - make prepare DB=$DB
     - echo "travis_fold:end:prepare"
 
-    - echo "travis_fold:start:fixtures"
-    - php bin/console doctrine:fixtures:load --no-interaction --env=test
-    - echo "travis_fold:end:fixtures"
+    - make fixtures
 
-    - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi;
+    - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then SYMFONY_PHPUNIT_VERSION=6.5 ./bin/simple-phpunit -v ; fi;
     - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi;
     - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;
     - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi;
diff --git a/.zappr.yaml b/.zappr.yaml
deleted file mode 100644 (file)
index f90cd80..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# see https://zappr.opensource.zalan.do/
-autobranch: false
-commit: false
-approvals:
-  minimum: 1
-  ignore: pr_opener
-  pattern: "^(:\\+1:|👍)$"
-  veto:
-    pattern: "^(:\\-1:|👎)$"
-  from:
-    orgs:
-      - wallabag
-    collaborators: true
-specification:
-  title:
-    minimum-length:
-      enabled: true
-      length: 8
-  body:
-    minimum-length:
-      enabled: true
-      length: 8
-    contains-url: false
-    contains-issue-number: false
-  template:
-    differs-from-body: true
index 6be863d32ab8283476090e19ff809f66d93de578..72b9d5d0f393ef861e033288e82a2696bfb2d1db 100644 (file)
@@ -1,4 +1,4 @@
-Copyright (c) 2013-2017 Nicolas Lœuillet
+Copyright (c) 2013-current Nicolas Lœuillet
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
index 57392da2d10be75f5dc75048750e4f3e59d45517..e00c7ea061c26a68dcd6f9b3dd49fe1073e8e7ee 100644 (file)
--- a/README.md
+++ b/README.md
@@ -19,10 +19,10 @@ Then you can install wallabag by executing the following commands:
 
 ```
 git clone https://github.com/wallabag/wallabag.git
-cd wallabag && make install 
+cd wallabag && make install
 ```
 
-Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/virtualhosts.html) to use your wallabag. 
+Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/virtualhosts.html) to use your wallabag.
 
 # Run on YunoHost
 [![Install Wallabag with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wallabag2)
@@ -30,6 +30,6 @@ Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/v
 Wallabag app for [YunoHost](https://yunohost.org). See [here](https://github.com/YunoHost-Apps/wallabag2_ynh)
 
 # License
-Copyright © 2013-2018 Nicolas Lœuillet <nicolas@loeuillet.org>
+Copyright © 2013-current Nicolas Lœuillet <nicolas@loeuillet.org>
 This work is free. You can redistribute it and/or modify it under the
 terms of the MIT License. See the COPYING file for more details.
index 546794deb92c3724582f47757087affff38dc6e7..7d19e9abc0ee590cafb09ec0215b08a2d21c67fa 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Symfony\Component\Config\Loader\LoaderInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\HttpKernel\Kernel;
 
 class AppKernel extends Kernel
@@ -46,18 +47,26 @@ class AppKernel extends Kernel
             $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
             $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
             $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
-            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
             $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
-            $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
 
             if ('test' === $this->getEnvironment()) {
                 $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle();
             }
+
+            if ('dev' === $this->getEnvironment()) {
+                $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
+                $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
+            }
         }
 
         return $bundles;
     }
 
+    public function getRootDir()
+    {
+        return __DIR__;
+    }
+
     public function getCacheDir()
     {
         return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
@@ -70,7 +79,8 @@ class AppKernel extends Kernel
 
     public function registerContainerConfiguration(LoaderInterface $loader)
     {
-        $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml');
+        $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
+
         $loader->load(function ($container) {
             if ($container->getParameter('use_webpack_dev_server')) {
                 $container->loadFromExtension('framework', [
@@ -86,5 +96,11 @@ class AppKernel extends Kernel
                 ]);
             }
         });
+
+        $loader->load(function (ContainerBuilder $container) {
+            // $container->setParameter('container.autowiring.strict_mode', true);
+            // $container->setParameter('container.dumper.inline_class_loader', true);
+            $container->addObjectResource($this);
+        });
     }
 }
index 71879c0ea57350fb4634c11c737578f122bc593c..50fe97c76e44194939c446bc8eba19487cf2b6a9 100755 (executable)
@@ -2,26 +2,14 @@
 
 namespace Application\Migrations;
 
-use Doctrine\DBAL\Migrations\AbstractMigration;
 use Doctrine\DBAL\Schema\Schema;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
+use Wallabag\CoreBundle\Doctrine\WallabagMigration;
 
 /**
  * Add archived_at column and set its value to updated_at for is_archived entries.
  */
-class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface
+class Version20180405182455 extends WallabagMigration
 {
-    /**
-     * @var ContainerInterface
-     */
-    private $container;
-
-    public function setContainer(ContainerInterface $container = null)
-    {
-        $this->container = $container;
-    }
-
     /**
      * @param Schema $schema
      */
@@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI
 
         $entryTable->dropColumn('archived_at');
     }
-
-    private function getTable($tableName)
-    {
-        return $this->container->getParameter('database_table_prefix') . $tableName;
-    }
 }
diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php
new file mode 100644 (file)
index 0000000..d1b09fc
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Schema\Schema;
+use Wallabag\CoreBundle\Doctrine\WallabagMigration;
+
+/**
+ * Fix varchar field from vendor to work with utf8mb4.
+ */
+class Version20181128203230 extends WallabagMigration
+{
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
+
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
+    }
+
+    public function down(Schema $schema)
+    {
+        $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
+
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
+        $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)');
+        $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)');
+    }
+}
diff --git a/app/autoload.php b/app/autoload.php
deleted file mode 100644 (file)
index c5f664d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-use Composer\Autoload\ClassLoader;
-use Doctrine\Common\Annotations\AnnotationRegistry;
-
-/**
- * @var ClassLoader
- */
-$loader = require __DIR__ . '/../vendor/autoload.php';
-
-AnnotationRegistry::registerLoader([$loader, 'loadClass']);
-
-return $loader;
index 092f3ec04860f342aecbfffb607252a45d168c80..ee0f0a38a8caf73f359ded5b914ce566818614ad 100644 (file)
@@ -46,7 +46,6 @@ twig:
 doctrine:
     dbal:
         driver: "%database_driver%"
-        driver_class: "%database_driver_class%"
         host: "%database_host%"
         port: "%database_port%"
         dbname: "%database_name%"
index 11e0feb778d92c48a71732150e110cb3e9376680..216f84316078b06734b5ff37543e787f183803e4 100644 (file)
@@ -24,7 +24,6 @@ swiftmailer:
 doctrine:
     dbal:
         driver: "%test_database_driver%"
-        driver_class: "%test_database_driver_class%"
         host: "%test_database_host%"
         port: "%test_database_port%"
         dbname: "%test_database_name%"
index d21f20e074710d7317a5728eac060da08ef166ae..13e2584f25b9a192a7816da2fe7bb34c1ee5de22 100644 (file)
@@ -11,8 +11,6 @@ parameters:
     # database_password: %env.database_password%
 
     database_driver: pdo_mysql
-    database_driver_class: ~
-    # database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
     database_host: 127.0.0.1
     database_port: ~
     database_name: wallabag
index 64e51976595d461ddac5ee77b1fe3cc269bf25da..257d2acecbc4ba637b4f316628993647c01c3d1b 100644 (file)
@@ -8,4 +8,3 @@ parameters:
     test_database_path: "%env(TEST_DATABASE_PATH)%"
     env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite"
     test_database_charset: utf8
-    test_database_driver_class: ~
index a300f75de19f26d24952c12d0c7c85a96e7fcbd3..1b3aff63ec3285d232b2e1f475de6e1745a90f47 100644 (file)
@@ -22,17 +22,17 @@ services:
             - "%kernel.cache_dir%/doctrine/metadata"
 
     # fixtures
-    Wallabag\AnnotationBundle\DataFixtures\ORM\:
-        resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/ORM/*'
+    Wallabag\UserBundle\DataFixtures\:
+        resource: '../../src/Wallabag/UserBundle/DataFixtures/*'
         tags: ['doctrine.fixture.orm']
         autowire: true
 
-    Wallabag\CoreBundle\DataFixtures\ORM\:
-        resource: '../../src/Wallabag/CoreBundle/DataFixtures/ORM/*'
+    Wallabag\CoreBundle\DataFixtures\:
+        resource: '../../src/Wallabag/CoreBundle/DataFixtures/*'
         tags: ['doctrine.fixture.orm']
         autowire: true
 
-    Wallabag\UserBundle\DataFixtures\ORM\:
-        resource: '../../src/Wallabag/UserBundle/DataFixtures/ORM/*'
+    Wallabag\AnnotationBundle\DataFixtures\:
+        resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/*'
         tags: ['doctrine.fixture.orm']
         autowire: true
index 0b7b82eb922cd7686bc970e766e099b9952116b8..36b227fbc800f11ce6dbebb0a9d8eade68d728be 100644 (file)
@@ -1,6 +1,5 @@
 parameters:
     test_database_driver: pdo_mysql
-    test_database_driver_class: ~
     test_database_host: localhost
     test_database_port: 3306
     test_database_name: wallabag_test
index ea249324e0eff08518a1ba52c27ae4e391b25b71..60f51df6d84e0c6631d15de618726bd294c4acfd 100644 (file)
@@ -1,6 +1,5 @@
 parameters:
     test_database_driver: pdo_pgsql
-    test_database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
     test_database_host: localhost
     test_database_port:
     test_database_name: wallabag_test
index 64cd984b9c01d74b911f7a32796c69bd12b0ba76..2b92d579f5d1db332c3aa68c523734c15e94043c 100644 (file)
@@ -1,6 +1,5 @@
 parameters:
     test_database_driver: pdo_sqlite
-    test_database_driver_class: ~
     test_database_host: localhost
     test_database_port:
     test_database_name: ~
index 49247c94dc5995f095d97c30235b038800abf13f..8cef40b2c30e69ad27e362291ad00379bec98a80 100755 (executable)
@@ -6,19 +6,17 @@ use Symfony\Component\Console\Input\ArgvInput;
 use Symfony\Component\Debug\Debug;
 
 // if you don't want to setup permissions the proper way, just uncomment the following PHP line
-// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
+// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
+// for more information
 //umask(0000);
 
 set_time_limit(0);
 
-/**
- * @var Composer\Autoload\ClassLoader $loader
- */
-$loader = require __DIR__.'/../app/autoload.php';
+require __DIR__.'/../vendor/autoload.php';
 
 $input = new ArgvInput();
-$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
-$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
+$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev', true);
+$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption('--no-debug', true) && $env !== 'prod';
 
 if ($debug) {
     Debug::enable();
index 6d5415ab7bffed73cf0b8575a252b3a37de8f057..405b1188777359006e6d62ddf3330091d0445cff 100644 (file)
@@ -28,7 +28,7 @@
         "issues": "https://github.com/wallabag/wallabag/issues"
     },
     "require": {
-        "php": ">=5.6.0",
+        "php": ">=7.1.0",
         "ext-pcre": "*",
         "ext-dom": "*",
         "ext-curl": "*",
         "ext-tokenizer": "*",
         "ext-pdo": "*",
         "symfony/symfony": "3.4.*",
-        "doctrine/orm": "^2.5.12",
-        "doctrine/doctrine-bundle": "^1.8.0",
-        "doctrine/doctrine-cache-bundle": "^1.3.2",
-        "twig/extensions": "^1.5.1",
-        "symfony/swiftmailer-bundle": "^2.6.7",
-        "symfony/monolog-bundle": "^3.1.2",
-        "sensio/distribution-bundle": "^5.0.21",
-        "sensio/framework-extra-bundle": "^5.2.1",
-        "incenteev/composer-parameter-handler": "^2.1.2",
+        "doctrine/orm": "^2.6",
+        "doctrine/doctrine-bundle": "^1.9",
+        "doctrine/doctrine-cache-bundle": "^1.3",
+        "twig/extensions": "^1.5",
+        "symfony/swiftmailer-bundle": "^3.2",
+        "symfony/monolog-bundle": "^3.1",
+        "sensio/distribution-bundle": "^5.0",
+        "sensio/framework-extra-bundle": "^5.2",
+        "incenteev/composer-parameter-handler": "^2.1",
         "nelmio/cors-bundle": "~1.5",
         "friendsofsymfony/rest-bundle": "~2.1",
         "jms/serializer-bundle": "~2.2",
         "nelmio/api-doc-bundle": "^2.13.2",
         "mgargano/simplehtmldom": "~1.5",
-        "wallabag/tcpdf": "^6.2.15",
+        "wallabag/tcpdf": "^6.2.26",
         "simplepie/simplepie": "~1.5",
         "willdurand/hateoas-bundle": "~1.3",
         "liip/theme-bundle": "^1.4.6",
-        "lexik/form-filter-bundle": "^5.0.4",
+        "lexik/form-filter-bundle": "^5.0",
         "j0k3r/graby": "^1.0",
         "friendsofsymfony/user-bundle": "2.0.*",
-        "friendsofsymfony/oauth-server-bundle": "^1.5.2",
+        "friendsofsymfony/oauth-server-bundle": "^1.5",
         "stof/doctrine-extensions-bundle": "^1.2",
-        "scheb/two-factor-bundle": "^2.14.0",
-        "grandt/phpepub": "^4.0.7",
-        "wallabag/php-mobi": "~1.0.0",
+        "scheb/two-factor-bundle": "^2.14",
+        "grandt/phpepub": "dev-master",
+        "wallabag/php-mobi": "~1.0",
         "kphoen/rulerz-bundle": "~0.13",
         "guzzlehttp/guzzle": "^5.3.1",
         "doctrine/doctrine-migrations-bundle": "^1.3",
-        "paragonie/random_compat": "^2.0.11",
-        "craue/config-bundle": "~2.0",
+        "craue/config-bundle": "dev-utf8mb4",
         "mnapoli/piwik-twig-extension": "^1.0",
         "ocramius/proxy-manager": "^1.0.2",
-        "white-october/pagerfanta-bundle": "^1.1.0",
+        "white-october/pagerfanta-bundle": "^1.1",
         "php-amqplib/rabbitmq-bundle": "^1.14",
-        "predis/predis": "^1.1.1",
+        "predis/predis": "v1.1.x-dev",
         "javibravo/simpleue": "^2.0",
-        "symfony/dom-crawler": "^3.3.13",
-        "friendsofsymfony/jsrouting-bundle": "^2.2.1",
+        "symfony/dom-crawler": "^3.4",
+        "friendsofsymfony/jsrouting-bundle": "^2.2",
         "bdunogier/guzzle-site-authenticator": "^1.0.0@dev",
         "defuse/php-encryption": "^2.1",
         "html2text/html2text": "^4.1"
     "require-dev": {
         "doctrine/doctrine-fixtures-bundle": "~3.0",
         "sensio/generator-bundle": "^3.0",
-        "symfony/phpunit-bridge": "3.4.x-dev",
-        "friendsofphp/php-cs-fixer": "~2.0",
-        "m6web/redis-mock": "^2.0",
-        "dama/doctrine-test-bundle": "^4.0"
+        "symfony/phpunit-bridge": "^3.4",
+        "friendsofphp/php-cs-fixer": "~2.13",
+        "m6web/redis-mock": "^4.1",
+        "dama/doctrine-test-bundle": "^5.0"
     },
     "scripts": {
         "post-cmd": [
         }
     },
     "autoload": {
-        "psr-4": { "Wallabag\\": "src/Wallabag/" },
-        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
+        "psr-4": {
+            "Wallabag\\": "src/Wallabag/"
+        },
+        "classmap": [
+            "app/AppKernel.php",
+            "app/AppCache.php"
+        ]
     },
     "autoload-dev": {
-        "psr-4": { "Tests\\": "tests/" }
+        "psr-4": {
+            "Tests\\": "tests/"
+        },
+        "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
     },
     "config": {
         "bin-dir": "bin",
         "platform": {
-            "php": "5.6.0"
+            "php": "7.1"
         }
     },
     "minimum-stability": "dev",
-    "prefer-stable": true
+    "prefer-stable": true,
+    "repositories": [
+        {
+            "type": "vcs",
+            "url": "https://github.com/Daniel-KM/PHPePub",
+            "comment": "The most up-to-date PHPePub as of now"
+        },
+        {
+            "type": "vcs",
+            "url": "https://github.com/wallabag/CraueConfigBundle",
+            "comment": "To handle utf8mb4 field size"
+        }
+    ]
 }
index 951b5a145c5100e1cd17aa9bccdf64993a6dd66d..426a5e72064a980b86d9c18aa79fdb465615b3f3 100644 (file)
@@ -4,7 +4,7 @@
          xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
          backupGlobals="false"
          colors="true"
-         bootstrap="app/autoload.php"
+         bootstrap="vendor/autoload.php"
 >
 
     <testsuites>
@@ -15,7 +15,7 @@
 
     <php>
         <ini name="error_reporting" value="-1" />
-        <server name="KERNEL_DIR" value="app/" />
+        <server name="KERNEL_CLASS" value="AppKernel" />
         <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
     </php>
 
similarity index 67%
rename from src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php
rename to src/Wallabag/AnnotationBundle/DataFixtures/AnnotationFixtures.php
index 20e07fa31fe87d2e8aeb2d23478dc099ac55e80f..ed46cea9bd13a197e717b792c0106d020cb7fdff 100644 (file)
@@ -1,13 +1,15 @@
 <?php
 
-namespace Wallabag\AnnotationBundle\DataFixtures\ORM;
+namespace Wallabag\AnnotationBundle\DataFixtures;
 
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Common\DataFixtures\DependentFixtureInterface;
 use Doctrine\Common\Persistence\ObjectManager;
 use Wallabag\AnnotationBundle\Entity\Annotation;
+use Wallabag\CoreBundle\DataFixtures\EntryFixtures;
+use Wallabag\UserBundle\DataFixtures\UserFixtures;
 
-class LoadAnnotationData extends AbstractFixture implements OrderedFixtureInterface
+class AnnotationFixtures extends Fixture implements DependentFixtureInterface
 {
     /**
      * {@inheritdoc}
@@ -38,8 +40,11 @@ class LoadAnnotationData extends AbstractFixture implements OrderedFixtureInterf
     /**
      * {@inheritdoc}
      */
-    public function getOrder()
+    public function getDependencies()
     {
-        return 35;
+        return [
+            EntryFixtures::class,
+            UserFixtures::class,
+        ];
     }
 }
index c09a0c803a44467b7b62f241c2fca65cf54b2b39..5e4099dddc8aa1b506c199d9c79f4dcccb3c9eeb 100644 (file)
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
 /**
  * @ORM\Table("oauth2_access_tokens")
  * @ORM\Entity
+ * @ORM\AttributeOverrides({
+ *     @ORM\AttributeOverride(name="token",
+ *         column=@ORM\Column(
+ *             name   = "token",
+ *             type   = "string",
+ *             length = 191
+ *         )
+ *     ),
+ *     @ORM\AttributeOverride(name="scope",
+ *         column=@ORM\Column(
+ *             name   = "scope",
+ *             type   = "string",
+ *             length = 191
+ *         )
+ *     )
+ * })
  */
 class AccessToken extends BaseAccessToken
 {
index 4d4b09fea7178ac9fed0f1bec0483db96d89d331..5fa205ac7ad54d5e9540f1c02b8712293cd2bce4 100644 (file)
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode;
 /**
  * @ORM\Table("oauth2_auth_codes")
  * @ORM\Entity
+ * @ORM\AttributeOverrides({
+ *     @ORM\AttributeOverride(name="token",
+ *         column=@ORM\Column(
+ *             name   = "token",
+ *             type   = "string",
+ *             length = 191
+ *         )
+ *     ),
+ *     @ORM\AttributeOverride(name="scope",
+ *         column=@ORM\Column(
+ *             name   = "scope",
+ *             type   = "string",
+ *             length = 191
+ *         )
+ *     )
+ * })
  */
 class AuthCode extends BaseAuthCode
 {
index 822a02d8d5753b84baedcadb660f2c0f2636c758..dd8e9c63e5469e8e72801ae660e54ca95fe6ad6e 100644 (file)
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken;
 /**
  * @ORM\Table("oauth2_refresh_tokens")
  * @ORM\Entity
+ * @ORM\AttributeOverrides({
+ *     @ORM\AttributeOverride(name="token",
+ *         column=@ORM\Column(
+ *             name   = "token",
+ *             type   = "string",
+ *             length = 191
+ *         )
+ *     ),
+ *     @ORM\AttributeOverride(name="scope",
+ *         column=@ORM\Column(
+ *             name   = "scope",
+ *             type   = "string",
+ *             length = 191
+ *         )
+ *     )
+ * })
  */
 class RefreshToken extends BaseRefreshToken
 {
similarity index 81%
rename from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
rename to src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php
index 3d4d5def9aa2c6c02d97652bc62b8f764046159f..c54e9f2c3fa1b9391fd97079728df4eda639c437 100644 (file)
@@ -1,13 +1,14 @@
 <?php
 
-namespace Wallabag\CoreBundle\DataFixtures\ORM;
+namespace Wallabag\CoreBundle\DataFixtures;
 
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Common\DataFixtures\DependentFixtureInterface;
 use Doctrine\Common\Persistence\ObjectManager;
 use Wallabag\CoreBundle\Entity\Config;
+use Wallabag\UserBundle\DataFixtures\UserFixtures;
 
-class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
+class ConfigFixtures extends Fixture implements DependentFixtureInterface
 {
     /**
      * {@inheritdoc}
@@ -60,8 +61,10 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
     /**
      * {@inheritdoc}
      */
-    public function getOrder()
+    public function getDependencies()
     {
-        return 20;
+        return [
+            UserFixtures::class,
+        ];
     }
 }
similarity index 90%
rename from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
rename to src/Wallabag/CoreBundle/DataFixtures/EntryFixtures.php
index 62fb5fa68b9a630a0f1a8ec9acdd9595438059c1..0bd58487c4e3459cd07f65cb26d9b6732ea35816 100644 (file)
@@ -1,13 +1,14 @@
 <?php
 
-namespace Wallabag\CoreBundle\DataFixtures\ORM;
+namespace Wallabag\CoreBundle\DataFixtures;
 
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Common\DataFixtures\DependentFixtureInterface;
 use Doctrine\Common\Persistence\ObjectManager;
 use Wallabag\CoreBundle\Entity\Entry;
+use Wallabag\UserBundle\DataFixtures\UserFixtures;
 
-class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
+class EntryFixtures extends Fixture implements DependentFixtureInterface
 {
     /**
      * {@inheritdoc}
@@ -112,8 +113,11 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
     /**
      * {@inheritdoc}
      */
-    public function getOrder()
+    public function getDependencies()
     {
-        return 30;
+        return [
+            UserFixtures::class,
+            TagFixtures::class,
+        ];
     }
 }
similarity index 71%
rename from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
rename to src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
index 3fe88e7fda0978c7bdca0241a9d5b98c565d9aa9..cc7d1f59dc6f5e3e3a192559efdd959816772562 100644 (file)
@@ -1,15 +1,14 @@
 <?php
 
-namespace Wallabag\CoreBundle\DataFixtures\ORM;
+namespace Wallabag\CoreBundle\DataFixtures;
 
 use Craue\ConfigBundle\Entity\Setting;
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
 use Doctrine\Common\Persistence\ObjectManager;
 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
-class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
+class SettingFixtures extends Fixture implements ContainerAwareInterface
 {
     /**
      * @var ContainerInterface
@@ -36,12 +35,4 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
 
         $manager->flush();
     }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getOrder()
-    {
-        return 29;
-    }
 }
similarity index 58%
rename from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php
rename to src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
index 866f55a403d40bf8bf5b9a753006c5dec8693dba..c73173e8db808643bbe77f0d8f44491f1031b09b 100644 (file)
@@ -1,13 +1,14 @@
 <?php
 
-namespace Wallabag\CoreBundle\DataFixtures\ORM;
+namespace Wallabag\CoreBundle\DataFixtures;
 
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Common\DataFixtures\DependentFixtureInterface;
 use Doctrine\Common\Persistence\ObjectManager;
 use Wallabag\CoreBundle\Entity\SiteCredential;
+use Wallabag\UserBundle\DataFixtures\UserFixtures;
 
-class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureInterface
+class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface
 {
     /**
      * {@inheritdoc}
@@ -27,8 +28,10 @@ class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureIn
     /**
      * {@inheritdoc}
      */
-    public function getOrder()
+    public function getDependencies()
     {
-        return 50;
+        return [
+            UserFixtures::class,
+        ];
     }
 }
similarity index 70%
rename from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php
rename to src/Wallabag/CoreBundle/DataFixtures/TagFixtures.php
index 0ecfd18b55ddab8c00f1616586f78a9f576af5c3..d78dd0b82481dbf9d28899f4d78f02ed8b7731f7 100644 (file)
@@ -1,13 +1,12 @@
 <?php
 
-namespace Wallabag\CoreBundle\DataFixtures\ORM;
+namespace Wallabag\CoreBundle\DataFixtures;
 
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
 use Doctrine\Common\Persistence\ObjectManager;
 use Wallabag\CoreBundle\Entity\Tag;
 
-class LoadTagData extends AbstractFixture implements OrderedFixtureInterface
+class TagFixtures extends Fixture
 {
     /**
      * {@inheritdoc}
@@ -44,12 +43,4 @@ class LoadTagData extends AbstractFixture implements OrderedFixtureInterface
 
         $manager->flush();
     }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getOrder()
-    {
-        return 25;
-    }
 }
similarity index 77%
rename from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php
rename to src/Wallabag/CoreBundle/DataFixtures/TaggingRuleFixtures.php
index 55abd63cda9a3d26562521eef55470ecd51f3376..78ff314a884f00e5ec7c453d68fd521c3fc57c4a 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 
-namespace Wallabag\CoreBundle\DataFixtures\ORM;
+namespace Wallabag\CoreBundle\DataFixtures;
 
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
+use Doctrine\Common\DataFixtures\DependentFixtureInterface;
 use Doctrine\Common\Persistence\ObjectManager;
 use Wallabag\CoreBundle\Entity\TaggingRule;
 
-class LoadTaggingRuleData extends AbstractFixture implements OrderedFixtureInterface
+class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
 {
     /**
      * {@inheritdoc}
@@ -49,8 +49,10 @@ class LoadTaggingRuleData extends AbstractFixture implements OrderedFixtureInter
     /**
      * {@inheritdoc}
      */
-    public function getOrder()
+    public function getDependencies()
     {
-        return 40;
+        return [
+            ConfigFixtures::class,
+        ];
     }
 }
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php
deleted file mode 100644 (file)
index eb5b203..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-namespace Wallabag\CoreBundle\Doctrine\DBAL\Driver;
-
-use Doctrine\DBAL\Connection;
-use Doctrine\DBAL\Driver\PDOPgSql\Driver;
-use Wallabag\CoreBundle\Doctrine\DBAL\Schema\CustomPostgreSqlSchemaManager;
-
-/**
- * This custom driver allow to use a different schema manager
- * So we can fix the PostgreSQL 10 problem.
- *
- * @see https://github.com/wallabag/wallabag/issues/3479
- * @see https://github.com/doctrine/dbal/issues/2868
- */
-class CustomPostgreSQLDriver extends Driver
-{
-    /**
-     * {@inheritdoc}
-     */
-    public function getSchemaManager(Connection $conn)
-    {
-        return new CustomPostgreSqlSchemaManager($conn);
-    }
-}
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php
deleted file mode 100644 (file)
index 439ae17..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-namespace Wallabag\CoreBundle\Doctrine\DBAL\Schema;
-
-use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
-use Doctrine\DBAL\Schema\Sequence;
-
-/**
- * This custom schema manager fix the PostgreSQL 10 problem.
- *
- * @see https://github.com/wallabag/wallabag/issues/3479
- * @see https://github.com/doctrine/dbal/issues/2868
- */
-class CustomPostgreSqlSchemaManager extends PostgreSqlSchemaManager
-{
-    /**
-     * {@inheritdoc}
-     */
-    protected function _getPortableSequenceDefinition($sequence)
-    {
-        $sequenceName = $sequence['relname'];
-        if ('public' !== $sequence['schemaname']) {
-            $sequenceName = $sequence['schemaname'] . '.' . $sequence['relname'];
-        }
-
-        $query = 'SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName);
-
-        // the `method_exists` is only to avoid test to fail:
-        // DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticConnection doesn't support the `getServerVersion`
-        if (method_exists($this->_conn->getWrappedConnection(), 'getServerVersion') && (float) ($this->_conn->getWrappedConnection()->getServerVersion()) >= 10) {
-            $query = "SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = 'public' AND sequencename = " . $this->_conn->quote($sequenceName);
-        }
-
-        $data = $this->_conn->fetchAll($query);
-
-        return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
-    }
-}
index 7aa2409a120c0c6de2459588a671fb1a64ed9964..4a3fef3b10e398a1304604061c67c9da6a5d2f2d 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace Wallabag\CoreBundle\Doctrine;
 
-use Doctrine\DBAL\Migrations\AbstractMigration;
 use Doctrine\DBAL\Schema\Schema;
+use Doctrine\Migrations\AbstractMigration;
 use Symfony\Component\DependencyInjection\ContainerAwareInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
index 84e11e261f3657d2e6f5225b0bd5a15358bc33b9..c1be3165d7085185b07d27329ee47fbaff8fc7df 100644 (file)
@@ -3,7 +3,7 @@
 namespace Wallabag\CoreBundle\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
-use KPhoen\RulerZBundle\Validator\Constraints as RulerZAssert;
+use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert;
 use Symfony\Component\Validator\Constraints as Assert;
 
 /**
similarity index 79%
rename from src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php
rename to src/Wallabag/UserBundle/DataFixtures/UserFixtures.php
index 26dbda3b2d02df4c0927fa8809d24b887f085d27..1e375e09ef2ffb899dd7846f50797cfbd4e70e29 100644 (file)
@@ -1,13 +1,12 @@
 <?php
 
-namespace Wallabag\UserBundle\DataFixtures\ORM;
+namespace Wallabag\UserBundle\DataFixtures;
 
-use Doctrine\Common\DataFixtures\AbstractFixture;
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
+use Doctrine\Bundle\FixturesBundle\Fixture;
 use Doctrine\Common\Persistence\ObjectManager;
 use Wallabag\UserBundle\Entity\User;
 
-class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
+class UserFixtures extends Fixture
 {
     /**
      * {@inheritdoc}
@@ -50,12 +49,4 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
 
         $manager->flush();
     }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getOrder()
-    {
-        return 10;
-    }
 }
index 964744684ef07c8e7ae52e8b4a274e04a82ddb19..537283f2539a8127a35a478d9a80f738f5180a62 100644 (file)
@@ -100,8 +100,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
         $this->assertSame('my quote', $content['quote']);
 
         /** @var Annotation $annotation */
-        $annotation = $this->client->getContainer()
-            ->get('doctrine.orm.entity_manager')
+        $annotation = $em
             ->getRepository('WallabagAnnotationBundle:Annotation')
             ->findLastAnnotationByPageId($entry->getId(), 1);
 
index 6b26376dbfb4a7709392a29e3d1dede3e3f3bc12..3696f8f90865805d08d84ff22da2e0940566c967 100644 (file)
@@ -15,7 +15,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'isArchived' => false]);
+            ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -41,7 +41,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'url' => 'http://0.0.0.0/entry2']);
+            ->findOneBy(['user' => $this->getUserId(), 'url' => 'http://0.0.0.0/entry2']);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -60,7 +60,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'isArchived' => false]);
+            ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -108,7 +108,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 2, 'isArchived' => false]);
+            ->findOneBy(['user' => $this->getUserId('bob'), 'isArchived' => false]);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -185,7 +185,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneByUser(1);
+            ->findOneByUser($this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -394,7 +394,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneByUser(1, ['id' => 'asc']);
+            ->findOneByUser($this->getUserId(), ['id' => 'asc']);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -440,7 +440,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertNull($content['starred_at']);
         $this->assertNull($content['archived_at']);
         $this->assertSame('New title for my article', $content['title']);
-        $this->assertSame(1, $content['user_id']);
+        $this->assertSame($this->getUserId(), $content['user_id']);
         $this->assertCount(2, $content['tags']);
         $this->assertNull($content['origin_url']);
         $this->assertSame('my content', $content['content']);
@@ -455,7 +455,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
     public function testPostSameEntry()
     {
         $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
-        $entry = new Entry($em->getReference(User::class, 1));
+        $entry = new Entry($em->getReference(User::class, $this->getUserId()));
         $entry->setUrl('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html');
         $entry->setArchived(true);
         $entry->addTag((new Tag())->setLabel('google'));
@@ -535,7 +535,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertSame(1, $content['is_starred']);
         $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
         $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['archived_at']))->getTimestamp());
-        $this->assertSame(1, $content['user_id']);
+        $this->assertSame($this->getUserId(), $content['user_id']);
     }
 
     public function testPostArchivedAndStarredEntryWithoutQuotes()
@@ -584,7 +584,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneByUser(1);
+            ->findOneByUser($this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -611,7 +611,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertSame($entry->getUrl(), $content['url']);
         $this->assertSame('New awesome title', $content['title']);
         $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag');
-        $this->assertSame(1, $content['user_id']);
+        $this->assertSame($this->getUserId(), $content['user_id']);
         $this->assertSame('de_AT', $content['language']);
         $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']);
         $this->assertContains('sponge', $content['published_by']);
@@ -626,7 +626,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneByUser(1);
+            ->findOneByUser($this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -660,7 +660,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneByUser(1);
+            ->findOneByUser($this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -691,7 +691,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
         ->get('doctrine.orm.entity_manager')
         ->getRepository('WallabagCoreBundle:Entry')
-        ->findOneByUser(1);
+        ->findOneByUser($this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -723,7 +723,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneByUser(1);
+            ->findOneByUser($this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -768,7 +768,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneByUser(1);
+            ->findOneByUser($this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -833,7 +833,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'isArchived' => true]);
+            ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -855,7 +855,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'isStarred' => true]);
+            ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -877,7 +877,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'isArchived' => true]);
+            ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -903,7 +903,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $entry = $this->client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findOneBy(['user' => 1, 'isStarred' => true]);
+            ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]);
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -920,32 +920,27 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
     }
 
-    public function dataForEntriesExistWithUrl()
+    public function testGetEntriesExistsWithReturnId()
     {
-        return [
-            'with_id' => [
-                'url' => '/api/entries/exists?url=http://0.0.0.0/entry2&return_id=1',
-                'expectedValue' => 2,
-            ],
-            'without_id' => [
-                'url' => '/api/entries/exists?url=http://0.0.0.0/entry2',
-                'expectedValue' => true,
-            ],
-        ];
+        $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2&return_id=1');
+
+        $this->assertSame(200, $this->client->getResponse()->getStatusCode());
+
+        $content = json_decode($this->client->getResponse()->getContent(), true);
+
+        // it returns a database id, we don't know it, so we only check it's greater than the lowest possible value
+        $this->assertGreaterThan(1, $content['exists']);
     }
 
-    /**
-     * @dataProvider dataForEntriesExistWithUrl
-     */
-    public function testGetEntriesExists($url, $expectedValue)
+    public function testGetEntriesExistsWithoutReturnId()
     {
-        $this->client->request('GET', $url);
+        $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2');
 
         $this->assertSame(200, $this->client->getResponse()->getStatusCode());
 
         $content = json_decode($this->client->getResponse()->getContent(), true);
 
-        $this->assertSame($expectedValue, $content['exists']);
+        $this->assertTrue($content['exists']);
     }
 
     public function testGetEntriesExistsWithManyUrls()
@@ -960,7 +955,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
 
         $this->assertArrayHasKey($url1, $content);
         $this->assertArrayHasKey($url2, $content);
-        $this->assertSame(2, $content[$url1]);
+        // it returns a database id, we don't know it, so we only check it's greater than the lowest possible value
+        $this->assertGreaterThan(1, $content[$url1]);
         $this->assertNull($content[$url2]);
     }
 
@@ -1002,7 +998,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
     {
         $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
+            ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
 
         if (!$entry) {
             $this->markTestSkipped('No content found in db.');
@@ -1038,7 +1034,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
     {
         $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
+            ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
 
         $tags = $entry->getTags();
 
@@ -1062,7 +1058,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
 
         $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Entry')
-            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
+            ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
 
         $tags = $entry->getTags();
         $this->assertCount(4, $tags);
@@ -1082,7 +1078,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
     public function testDeleteEntriesTagsListAction()
     {
         $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
-        $entry = new Entry($em->getReference(User::class, 1));
+        $entry = new Entry($em->getReference(User::class, $this->getUserId()));
         $entry->setUrl('http://0.0.0.0/test-entry');
         $entry->addTag((new Tag())->setLabel('foo-tag'));
         $entry->addTag((new Tag())->setLabel('bar-tag'));
@@ -1150,7 +1146,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
     public function testDeleteEntriesListAction()
     {
         $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
-        $em->persist((new Entry($em->getReference(User::class, 1)))->setUrl('http://0.0.0.0/test-entry1'));
+        $em->persist((new Entry($em->getReference(User::class, $this->getUserId())))->setUrl('http://0.0.0.0/test-entry1'));
 
         $em->flush();
         $em->clear();
@@ -1208,7 +1204,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
     public function testRePostEntryAndReUsePublishedAt()
     {
         $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
-        $entry = new Entry($em->getReference(User::class, 1));
+        $entry = new Entry($em->getReference(User::class, $this->getUserId()));
         $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »');
         $entry->setContent('hihi');
         $entry->setUrl('https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html');
index 0c52aea06addf2deae3e94a45c0bd0b34530b87a..fd2e113e1a3996209b51769ba19faab9e57415f9 100644 (file)
@@ -48,4 +48,23 @@ abstract class WallabagApiTestCase extends WebTestCase
 
         return $client;
     }
+
+    /**
+     * Return the ID for the user admin.
+     * Used because on heavy testing we don't want to re-create the database on each run.
+     * Which means "admin" user won't have id 1 all the time.
+     *
+     * @param string $username
+     *
+     * @return int
+     */
+    protected function getUserId($username = 'admin')
+    {
+        return $this->client
+            ->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagUserBundle:User')
+            ->findOneByUserName($username)
+            ->getId();
+    }
 }
index bd351b187fd2671480c9a5bc262b600e26c572d7..d8928451121aa045b6dba6b22a3e7643852ebd34 100644 (file)
@@ -18,6 +18,18 @@ use Wallabag\CoreBundle\Command\InstallCommand;
 
 class InstallCommandTest extends WallabagCoreTestCase
 {
+    public static function setUpBeforeClass()
+    {
+        // disable doctrine-test-bundle
+        StaticDriver::setKeepStaticConnections(false);
+    }
+
+    public static function tearDownAfterClass()
+    {
+        // enable doctrine-test-bundle
+        StaticDriver::setKeepStaticConnections(true);
+    }
+
     public function setUp()
     {
         parent::setUp();
@@ -51,9 +63,6 @@ class InstallCommandTest extends WallabagCoreTestCase
             parent::setUp();
         }
 
-        // disable doctrine-test-bundle
-        StaticDriver::setKeepStaticConnections(false);
-
         $this->resetDatabase($this->getClient());
     }
 
@@ -62,6 +71,7 @@ class InstallCommandTest extends WallabagCoreTestCase
         $databasePath = getenv('TEST_DATABASE_PATH');
         // Remove variable environnement
         putenv('TEST_DATABASE_PATH');
+
         if ($databasePath && file_exists($databasePath)) {
             unlink($databasePath);
         } else {
@@ -71,8 +81,6 @@ class InstallCommandTest extends WallabagCoreTestCase
             $this->resetDatabase($client);
         }
 
-        // enable doctrine-test-bundle
-        StaticDriver::setKeepStaticConnections(true);
         parent::tearDown();
     }
 
index f95320a4affae0f4968a4f592ea7e9115ef4cd31..8e1c528de3373177de03a06db0b1937c6142adc7 100644 (file)
@@ -84,6 +84,8 @@ class ImportCommandTest extends WallabagCoreTestCase
 
     public function testRunImportCommandWithUserId()
     {
+        $this->logInAs('admin');
+
         $application = new Application($this->getClient()->getKernel());
         $application->add(new ImportCommand());
 
@@ -92,7 +94,7 @@ class ImportCommandTest extends WallabagCoreTestCase
         $tester = new CommandTester($command);
         $tester->execute([
             'command' => $command->getName(),
-            'username' => 1,
+            'username' => $this->getLoggedInUserId(),
             'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
             '--useUserId' => true,
             '--importer' => 'v2',
index 4c2c4650e167688724cd7e79b1735b80c2a8de96..3427e133e6ad89ff87f319e2b081b3b6c08278e4 100644 (file)
@@ -2,14 +2,9 @@
 
 use Symfony\Component\HttpFoundation\Request;
 
-/**
- * @var Composer\Autoload\ClassLoader
- */
-$loader = require __DIR__.'/../app/autoload.php';
-include_once __DIR__.'/../var/bootstrap.php.cache';
+require __DIR__.'/../vendor/autoload.php';
 
 $kernel = new AppKernel('prod', false);
-$kernel->loadClassCache();
 //$kernel = new AppCache($kernel);
 
 // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
index 8456754d561d4178778d0998ad35a466f676ed1b..57e1a433f6f56a4be7bd1bf60a516b281950f4a9 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 
-use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\Debug\Debug;
+use Symfony\Component\HttpFoundation\Request;
 
 // If you don't want to setup permissions the proper way, just uncomment the following PHP line
-// read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
+// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
 // for more information
 //umask(0000);
 
@@ -12,20 +12,16 @@ use Symfony\Component\Debug\Debug;
 // Feel free to remove this, extend it, or make something more sophisticated.
 if (isset($_SERVER['HTTP_CLIENT_IP'])
     || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
-    || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
+    || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'], true) || PHP_SAPI === 'cli-server')
 ) {
     header('HTTP/1.0 403 Forbidden');
     exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
 }
 
-/**
- * @var Composer\Autoload\ClassLoader $loader
- */
-$loader = require __DIR__.'/../app/autoload.php';
+require __DIR__.'/../vendor/autoload.php';
 Debug::enable();
 
 $kernel = new AppKernel('dev', true);
-$kernel->loadClassCache();
 $request = Request::createFromGlobals();
 $response = $kernel->handle($request);
 $response->send();