aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml26
-rw-r--r--.zappr.yaml26
-rw-r--r--COPYING.md2
-rw-r--r--README.md6
-rw-r--r--app/AppKernel.php22
-rwxr-xr-xapp/DoctrineMigrations/Version20180405182455.php21
-rw-r--r--app/DoctrineMigrations/Version20181128203230.php45
-rw-r--r--app/autoload.php13
-rw-r--r--app/config/config.yml1
-rw-r--r--app/config/config_test.yml1
-rw-r--r--app/config/parameters.yml.dist2
-rw-r--r--app/config/parameters_test.yml1
-rw-r--r--app/config/services_test.yml12
-rw-r--r--app/config/tests/parameters_test.mysql.yml1
-rw-r--r--app/config/tests/parameters_test.pgsql.yml1
-rw-r--r--app/config/tests/parameters_test.sqlite.yml1
-rwxr-xr-xbin/console12
-rw-r--r--composer.json81
-rw-r--r--phpunit.xml.dist4
-rw-r--r--src/Wallabag/AnnotationBundle/DataFixtures/AnnotationFixtures.php (renamed from src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php)17
-rw-r--r--src/Wallabag/ApiBundle/Entity/AccessToken.php16
-rw-r--r--src/Wallabag/ApiBundle/Entity/AuthCode.php16
-rw-r--r--src/Wallabag/ApiBundle/Entity/RefreshToken.php16
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php (renamed from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php)15
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/EntryFixtures.php (renamed from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php)16
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php (renamed from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php)15
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php (renamed from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php)15
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/TagFixtures.php (renamed from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php)15
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/TaggingRuleFixtures.php (renamed from src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php)14
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php25
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php38
-rw-r--r--src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php2
-rw-r--r--src/Wallabag/CoreBundle/Entity/TaggingRule.php2
-rw-r--r--src/Wallabag/UserBundle/DataFixtures/UserFixtures.php (renamed from src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php)15
-rw-r--r--tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php3
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php84
-rw-r--r--tests/Wallabag/ApiBundle/WallabagApiTestCase.php19
-rw-r--r--tests/Wallabag/CoreBundle/Command/InstallCommandTest.php18
-rw-r--r--tests/Wallabag/ImportBundle/Command/ImportCommandTest.php4
-rw-r--r--web/app.php7
-rw-r--r--web/app_dev.php12
41 files changed, 325 insertions, 337 deletions
diff --git a/.travis.yml b/.travis.yml
index 39306343..9d7fd3a0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,12 +4,6 @@ services:
4 - rabbitmq 4 - rabbitmq
5 - redis 5 - redis
6 6
7# used for HHVM
8addons:
9 apt:
10 packages:
11 - tidy
12
13# cache vendor dirs 7# cache vendor dirs
14cache: 8cache:
15 apt: true 9 apt: true
@@ -21,10 +15,9 @@ cache:
21 - $HOME/.yarn-cache 15 - $HOME/.yarn-cache
22 16
23php: 17php:
24 - 5.6
25 - 7.0
26 - 7.1 18 - 7.1
27 - 7.2 19 - 7.2
20 - 7.3
28 - nightly 21 - nightly
29 22
30node_js: 23node_js:
@@ -38,10 +31,11 @@ env:
38matrix: 31matrix:
39 fast_finish: true 32 fast_finish: true
40 include: 33 include:
41 - php: 7.0 34 - php: 7.2
42 env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite 35 env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite
43 allow_failures: 36 allow_failures:
44 - php: nightly 37 - php: nightly
38 - php: 7.3
45 39
46# exclude v1 branches 40# exclude v1 branches
47branches: 41branches:
@@ -63,14 +57,6 @@ before_script:
63 - if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi 57 - if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
64 - composer self-update --no-progress 58 - composer self-update --no-progress
65 - if [[ $DB = pgsql ]]; then psql -c 'create database wallabag_test;' -U postgres; fi; 59 - if [[ $DB = pgsql ]]; then psql -c 'create database wallabag_test;' -U postgres; fi;
66 # increase swap to avoid "proc_open(): fork failed - Cannot allocate memory"
67 # this should be removed when no more PHP 5 build will be defined
68 - sudo swapon -s
69 - sudo fallocate -l 4G /swapfile
70 - sudo chmod 600 /swapfile
71 - sudo mkswap /swapfile
72 - sudo swapon /swapfile
73 - sudo swapon -s
74 60
75script: 61script:
76 - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist 62 - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist
@@ -78,11 +64,9 @@ script:
78 - make prepare DB=$DB 64 - make prepare DB=$DB
79 - echo "travis_fold:end:prepare" 65 - echo "travis_fold:end:prepare"
80 66
81 - echo "travis_fold:start:fixtures" 67 - make fixtures
82 - php bin/console doctrine:fixtures:load --no-interaction --env=test
83 - echo "travis_fold:end:fixtures"
84 68
85 - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi; 69 - if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then SYMFONY_PHPUNIT_VERSION=6.5 ./bin/simple-phpunit -v ; fi;
86 - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi; 70 - if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi;
87 - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi; 71 - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;
88 - if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi; 72 - 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
index f90cd809..00000000
--- a/.zappr.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
1# see https://zappr.opensource.zalan.do/
2autobranch: false
3commit: false
4approvals:
5 minimum: 1
6 ignore: pr_opener
7 pattern: "^(:\\+1:|👍)$"
8 veto:
9 pattern: "^(:\\-1:|👎)$"
10 from:
11 orgs:
12 - wallabag
13 collaborators: true
14specification:
15 title:
16 minimum-length:
17 enabled: true
18 length: 8
19 body:
20 minimum-length:
21 enabled: true
22 length: 8
23 contains-url: false
24 contains-issue-number: false
25 template:
26 differs-from-body: true
diff --git a/COPYING.md b/COPYING.md
index 6be863d3..72b9d5d0 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -1,4 +1,4 @@
1Copyright (c) 2013-2017 Nicolas Lœuillet 1Copyright (c) 2013-current Nicolas Lœuillet
2 2
3Permission is hereby granted, free of charge, to any person obtaining a copy 3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to deal 4of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 57392da2..e00c7ea0 100644
--- a/README.md
+++ b/README.md
@@ -19,10 +19,10 @@ Then you can install wallabag by executing the following commands:
19 19
20``` 20```
21git clone https://github.com/wallabag/wallabag.git 21git clone https://github.com/wallabag/wallabag.git
22cd wallabag && make install 22cd wallabag && make install
23``` 23```
24 24
25Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/virtualhosts.html) to use your wallabag. 25Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/virtualhosts.html) to use your wallabag.
26 26
27# Run on YunoHost 27# Run on YunoHost
28[![Install Wallabag with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wallabag2) 28[![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
30Wallabag app for [YunoHost](https://yunohost.org). See [here](https://github.com/YunoHost-Apps/wallabag2_ynh) 30Wallabag app for [YunoHost](https://yunohost.org). See [here](https://github.com/YunoHost-Apps/wallabag2_ynh)
31 31
32# License 32# License
33Copyright © 2013-2018 Nicolas Lœuillet <nicolas@loeuillet.org> 33Copyright © 2013-current Nicolas Lœuillet <nicolas@loeuillet.org>
34This work is free. You can redistribute it and/or modify it under the 34This work is free. You can redistribute it and/or modify it under the
35terms of the MIT License. See the COPYING file for more details. 35terms of the MIT License. See the COPYING file for more details.
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 546794de..7d19e9ab 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -1,6 +1,7 @@
1<?php 1<?php
2 2
3use Symfony\Component\Config\Loader\LoaderInterface; 3use Symfony\Component\Config\Loader\LoaderInterface;
4use Symfony\Component\DependencyInjection\ContainerBuilder;
4use Symfony\Component\HttpKernel\Kernel; 5use Symfony\Component\HttpKernel\Kernel;
5 6
6class AppKernel extends Kernel 7class AppKernel extends Kernel
@@ -46,18 +47,26 @@ class AppKernel extends Kernel
46 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); 47 $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
47 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 48 $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
48 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 49 $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
49 $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
50 $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); 50 $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
51 $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
52 51
53 if ('test' === $this->getEnvironment()) { 52 if ('test' === $this->getEnvironment()) {
54 $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle(); 53 $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle();
55 } 54 }
55
56 if ('dev' === $this->getEnvironment()) {
57 $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
58 $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
59 }
56 } 60 }
57 61
58 return $bundles; 62 return $bundles;
59 } 63 }
60 64
65 public function getRootDir()
66 {
67 return __DIR__;
68 }
69
61 public function getCacheDir() 70 public function getCacheDir()
62 { 71 {
63 return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); 72 return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
@@ -70,7 +79,8 @@ class AppKernel extends Kernel
70 79
71 public function registerContainerConfiguration(LoaderInterface $loader) 80 public function registerContainerConfiguration(LoaderInterface $loader)
72 { 81 {
73 $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml'); 82 $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
83
74 $loader->load(function ($container) { 84 $loader->load(function ($container) {
75 if ($container->getParameter('use_webpack_dev_server')) { 85 if ($container->getParameter('use_webpack_dev_server')) {
76 $container->loadFromExtension('framework', [ 86 $container->loadFromExtension('framework', [
@@ -86,5 +96,11 @@ class AppKernel extends Kernel
86 ]); 96 ]);
87 } 97 }
88 }); 98 });
99
100 $loader->load(function (ContainerBuilder $container) {
101 // $container->setParameter('container.autowiring.strict_mode', true);
102 // $container->setParameter('container.dumper.inline_class_loader', true);
103 $container->addObjectResource($this);
104 });
89 } 105 }
90} 106}
diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php
index 71879c0e..50fe97c7 100755
--- a/app/DoctrineMigrations/Version20180405182455.php
+++ b/app/DoctrineMigrations/Version20180405182455.php
@@ -2,27 +2,15 @@
2 2
3namespace Application\Migrations; 3namespace Application\Migrations;
4 4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema; 5use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface; 6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9 7
10/** 8/**
11 * Add archived_at column and set its value to updated_at for is_archived entries. 9 * Add archived_at column and set its value to updated_at for is_archived entries.
12 */ 10 */
13class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface 11class Version20180405182455 extends WallabagMigration
14{ 12{
15 /** 13 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 /**
26 * @param Schema $schema 14 * @param Schema $schema
27 */ 15 */
28 public function up(Schema $schema) 16 public function up(Schema $schema)
@@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI
60 48
61 $entryTable->dropColumn('archived_at'); 49 $entryTable->dropColumn('archived_at');
62 } 50 }
63
64 private function getTable($tableName)
65 {
66 return $this->container->getParameter('database_table_prefix') . $tableName;
67 }
68} 51}
diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php
new file mode 100644
index 00000000..d1b09fc7
--- /dev/null
+++ b/app/DoctrineMigrations/Version20181128203230.php
@@ -0,0 +1,45 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Schema\Schema;
6use Wallabag\CoreBundle\Doctrine\WallabagMigration;
7
8/**
9 * Fix varchar field from vendor to work with utf8mb4.
10 */
11class Version20181128203230 extends WallabagMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
19
20 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
21 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)');
22 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL');
23 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)');
24 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
25 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)');
26 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)');
27 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)');
28 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
29 }
30
31 public function down(Schema $schema)
32 {
33 $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
34
35 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
36 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)');
37 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL');
38 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)');
39 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
40 $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)');
41 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)');
42 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)');
43 $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)');
44 }
45}
diff --git a/app/autoload.php b/app/autoload.php
deleted file mode 100644
index c5f664dc..00000000
--- a/app/autoload.php
+++ /dev/null
@@ -1,13 +0,0 @@
1<?php
2
3use Composer\Autoload\ClassLoader;
4use Doctrine\Common\Annotations\AnnotationRegistry;
5
6/**
7 * @var ClassLoader
8 */
9$loader = require __DIR__ . '/../vendor/autoload.php';
10
11AnnotationRegistry::registerLoader([$loader, 'loadClass']);
12
13return $loader;
diff --git a/app/config/config.yml b/app/config/config.yml
index 092f3ec0..ee0f0a38 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -46,7 +46,6 @@ twig:
46doctrine: 46doctrine:
47 dbal: 47 dbal:
48 driver: "%database_driver%" 48 driver: "%database_driver%"
49 driver_class: "%database_driver_class%"
50 host: "%database_host%" 49 host: "%database_host%"
51 port: "%database_port%" 50 port: "%database_port%"
52 dbname: "%database_name%" 51 dbname: "%database_name%"
diff --git a/app/config/config_test.yml b/app/config/config_test.yml
index 11e0feb7..216f8431 100644
--- a/app/config/config_test.yml
+++ b/app/config/config_test.yml
@@ -24,7 +24,6 @@ swiftmailer:
24doctrine: 24doctrine:
25 dbal: 25 dbal:
26 driver: "%test_database_driver%" 26 driver: "%test_database_driver%"
27 driver_class: "%test_database_driver_class%"
28 host: "%test_database_host%" 27 host: "%test_database_host%"
29 port: "%test_database_port%" 28 port: "%test_database_port%"
30 dbname: "%test_database_name%" 29 dbname: "%test_database_name%"
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index d21f20e0..13e2584f 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -11,8 +11,6 @@ parameters:
11 # database_password: %env.database_password% 11 # database_password: %env.database_password%
12 12
13 database_driver: pdo_mysql 13 database_driver: pdo_mysql
14 database_driver_class: ~
15 # database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
16 database_host: 127.0.0.1 14 database_host: 127.0.0.1
17 database_port: ~ 15 database_port: ~
18 database_name: wallabag 16 database_name: wallabag
diff --git a/app/config/parameters_test.yml b/app/config/parameters_test.yml
index 64e51976..257d2ace 100644
--- a/app/config/parameters_test.yml
+++ b/app/config/parameters_test.yml
@@ -8,4 +8,3 @@ parameters:
8 test_database_path: "%env(TEST_DATABASE_PATH)%" 8 test_database_path: "%env(TEST_DATABASE_PATH)%"
9 env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite" 9 env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite"
10 test_database_charset: utf8 10 test_database_charset: utf8
11 test_database_driver_class: ~
diff --git a/app/config/services_test.yml b/app/config/services_test.yml
index a300f75d..1b3aff63 100644
--- a/app/config/services_test.yml
+++ b/app/config/services_test.yml
@@ -22,17 +22,17 @@ services:
22 - "%kernel.cache_dir%/doctrine/metadata" 22 - "%kernel.cache_dir%/doctrine/metadata"
23 23
24 # fixtures 24 # fixtures
25 Wallabag\AnnotationBundle\DataFixtures\ORM\: 25 Wallabag\UserBundle\DataFixtures\:
26 resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/ORM/*' 26 resource: '../../src/Wallabag/UserBundle/DataFixtures/*'
27 tags: ['doctrine.fixture.orm'] 27 tags: ['doctrine.fixture.orm']
28 autowire: true 28 autowire: true
29 29
30 Wallabag\CoreBundle\DataFixtures\ORM\: 30 Wallabag\CoreBundle\DataFixtures\:
31 resource: '../../src/Wallabag/CoreBundle/DataFixtures/ORM/*' 31 resource: '../../src/Wallabag/CoreBundle/DataFixtures/*'
32 tags: ['doctrine.fixture.orm'] 32 tags: ['doctrine.fixture.orm']
33 autowire: true 33 autowire: true
34 34
35 Wallabag\UserBundle\DataFixtures\ORM\: 35 Wallabag\AnnotationBundle\DataFixtures\:
36 resource: '../../src/Wallabag/UserBundle/DataFixtures/ORM/*' 36 resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/*'
37 tags: ['doctrine.fixture.orm'] 37 tags: ['doctrine.fixture.orm']
38 autowire: true 38 autowire: true
diff --git a/app/config/tests/parameters_test.mysql.yml b/app/config/tests/parameters_test.mysql.yml
index 0b7b82eb..36b227fb 100644
--- a/app/config/tests/parameters_test.mysql.yml
+++ b/app/config/tests/parameters_test.mysql.yml
@@ -1,6 +1,5 @@
1parameters: 1parameters:
2 test_database_driver: pdo_mysql 2 test_database_driver: pdo_mysql
3 test_database_driver_class: ~
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 3306 4 test_database_port: 3306
6 test_database_name: wallabag_test 5 test_database_name: wallabag_test
diff --git a/app/config/tests/parameters_test.pgsql.yml b/app/config/tests/parameters_test.pgsql.yml
index ea249324..60f51df6 100644
--- a/app/config/tests/parameters_test.pgsql.yml
+++ b/app/config/tests/parameters_test.pgsql.yml
@@ -1,6 +1,5 @@
1parameters: 1parameters:
2 test_database_driver: pdo_pgsql 2 test_database_driver: pdo_pgsql
3 test_database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 4 test_database_port:
6 test_database_name: wallabag_test 5 test_database_name: wallabag_test
diff --git a/app/config/tests/parameters_test.sqlite.yml b/app/config/tests/parameters_test.sqlite.yml
index 64cd984b..2b92d579 100644
--- a/app/config/tests/parameters_test.sqlite.yml
+++ b/app/config/tests/parameters_test.sqlite.yml
@@ -1,6 +1,5 @@
1parameters: 1parameters:
2 test_database_driver: pdo_sqlite 2 test_database_driver: pdo_sqlite
3 test_database_driver_class: ~
4 test_database_host: localhost 3 test_database_host: localhost
5 test_database_port: 4 test_database_port:
6 test_database_name: ~ 5 test_database_name: ~
diff --git a/bin/console b/bin/console
index 49247c94..8cef40b2 100755
--- a/bin/console
+++ b/bin/console
@@ -6,19 +6,17 @@ use Symfony\Component\Console\Input\ArgvInput;
6use Symfony\Component\Debug\Debug; 6use Symfony\Component\Debug\Debug;
7 7
8// if you don't want to setup permissions the proper way, just uncomment the following PHP line 8// if you don't want to setup permissions the proper way, just uncomment the following PHP line
9// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information 9// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
10// for more information
10//umask(0000); 11//umask(0000);
11 12
12set_time_limit(0); 13set_time_limit(0);
13 14
14/** 15require __DIR__.'/../vendor/autoload.php';
15 * @var Composer\Autoload\ClassLoader $loader
16 */
17$loader = require __DIR__.'/../app/autoload.php';
18 16
19$input = new ArgvInput(); 17$input = new ArgvInput();
20$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); 18$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev', true);
21$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; 19$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption('--no-debug', true) && $env !== 'prod';
22 20
23if ($debug) { 21if ($debug) {
24 Debug::enable(); 22 Debug::enable();
diff --git a/composer.json b/composer.json
index 6d5415ab..405b1188 100644
--- a/composer.json
+++ b/composer.json
@@ -28,7 +28,7 @@
28 "issues": "https://github.com/wallabag/wallabag/issues" 28 "issues": "https://github.com/wallabag/wallabag/issues"
29 }, 29 },
30 "require": { 30 "require": {
31 "php": ">=5.6.0", 31 "php": ">=7.1.0",
32 "ext-pcre": "*", 32 "ext-pcre": "*",
33 "ext-dom": "*", 33 "ext-dom": "*",
34 "ext-curl": "*", 34 "ext-curl": "*",
@@ -44,45 +44,44 @@
44 "ext-tokenizer": "*", 44 "ext-tokenizer": "*",
45 "ext-pdo": "*", 45 "ext-pdo": "*",
46 "symfony/symfony": "3.4.*", 46 "symfony/symfony": "3.4.*",
47 "doctrine/orm": "^2.5.12", 47 "doctrine/orm": "^2.6",
48 "doctrine/doctrine-bundle": "^1.8.0", 48 "doctrine/doctrine-bundle": "^1.9",
49 "doctrine/doctrine-cache-bundle": "^1.3.2", 49 "doctrine/doctrine-cache-bundle": "^1.3",
50 "twig/extensions": "^1.5.1", 50 "twig/extensions": "^1.5",
51 "symfony/swiftmailer-bundle": "^2.6.7", 51 "symfony/swiftmailer-bundle": "^3.2",
52 "symfony/monolog-bundle": "^3.1.2", 52 "symfony/monolog-bundle": "^3.1",
53 "sensio/distribution-bundle": "^5.0.21", 53 "sensio/distribution-bundle": "^5.0",
54 "sensio/framework-extra-bundle": "^5.2.1", 54 "sensio/framework-extra-bundle": "^5.2",
55 "incenteev/composer-parameter-handler": "^2.1.2", 55 "incenteev/composer-parameter-handler": "^2.1",
56 "nelmio/cors-bundle": "~1.5", 56 "nelmio/cors-bundle": "~1.5",
57 "friendsofsymfony/rest-bundle": "~2.1", 57 "friendsofsymfony/rest-bundle": "~2.1",
58 "jms/serializer-bundle": "~2.2", 58 "jms/serializer-bundle": "~2.2",
59 "nelmio/api-doc-bundle": "^2.13.2", 59 "nelmio/api-doc-bundle": "^2.13.2",
60 "mgargano/simplehtmldom": "~1.5", 60 "mgargano/simplehtmldom": "~1.5",
61 "wallabag/tcpdf": "^6.2.15", 61 "wallabag/tcpdf": "^6.2.26",
62 "simplepie/simplepie": "~1.5", 62 "simplepie/simplepie": "~1.5",
63 "willdurand/hateoas-bundle": "~1.3", 63 "willdurand/hateoas-bundle": "~1.3",
64 "liip/theme-bundle": "^1.4.6", 64 "liip/theme-bundle": "^1.4.6",
65 "lexik/form-filter-bundle": "^5.0.4", 65 "lexik/form-filter-bundle": "^5.0",
66 "j0k3r/graby": "^1.0", 66 "j0k3r/graby": "^1.0",
67 "friendsofsymfony/user-bundle": "2.0.*", 67 "friendsofsymfony/user-bundle": "2.0.*",
68 "friendsofsymfony/oauth-server-bundle": "^1.5.2", 68 "friendsofsymfony/oauth-server-bundle": "^1.5",
69 "stof/doctrine-extensions-bundle": "^1.2", 69 "stof/doctrine-extensions-bundle": "^1.2",
70 "scheb/two-factor-bundle": "^2.14.0", 70 "scheb/two-factor-bundle": "^2.14",
71 "grandt/phpepub": "^4.0.7", 71 "grandt/phpepub": "dev-master",
72 "wallabag/php-mobi": "~1.0.0", 72 "wallabag/php-mobi": "~1.0",
73 "kphoen/rulerz-bundle": "~0.13", 73 "kphoen/rulerz-bundle": "~0.13",
74 "guzzlehttp/guzzle": "^5.3.1", 74 "guzzlehttp/guzzle": "^5.3.1",
75 "doctrine/doctrine-migrations-bundle": "^1.3", 75 "doctrine/doctrine-migrations-bundle": "^1.3",
76 "paragonie/random_compat": "^2.0.11", 76 "craue/config-bundle": "dev-utf8mb4",
77 "craue/config-bundle": "~2.0",
78 "mnapoli/piwik-twig-extension": "^1.0", 77 "mnapoli/piwik-twig-extension": "^1.0",
79 "ocramius/proxy-manager": "^1.0.2", 78 "ocramius/proxy-manager": "^1.0.2",
80 "white-october/pagerfanta-bundle": "^1.1.0", 79 "white-october/pagerfanta-bundle": "^1.1",
81 "php-amqplib/rabbitmq-bundle": "^1.14", 80 "php-amqplib/rabbitmq-bundle": "^1.14",
82 "predis/predis": "^1.1.1", 81 "predis/predis": "v1.1.x-dev",
83 "javibravo/simpleue": "^2.0", 82 "javibravo/simpleue": "^2.0",
84 "symfony/dom-crawler": "^3.3.13", 83 "symfony/dom-crawler": "^3.4",
85 "friendsofsymfony/jsrouting-bundle": "^2.2.1", 84 "friendsofsymfony/jsrouting-bundle": "^2.2",
86 "bdunogier/guzzle-site-authenticator": "^1.0.0@dev", 85 "bdunogier/guzzle-site-authenticator": "^1.0.0@dev",
87 "defuse/php-encryption": "^2.1", 86 "defuse/php-encryption": "^2.1",
88 "html2text/html2text": "^4.1" 87 "html2text/html2text": "^4.1"
@@ -90,10 +89,10 @@
90 "require-dev": { 89 "require-dev": {
91 "doctrine/doctrine-fixtures-bundle": "~3.0", 90 "doctrine/doctrine-fixtures-bundle": "~3.0",
92 "sensio/generator-bundle": "^3.0", 91 "sensio/generator-bundle": "^3.0",
93 "symfony/phpunit-bridge": "3.4.x-dev", 92 "symfony/phpunit-bridge": "^3.4",
94 "friendsofphp/php-cs-fixer": "~2.0", 93 "friendsofphp/php-cs-fixer": "~2.13",
95 "m6web/redis-mock": "^2.0", 94 "m6web/redis-mock": "^4.1",
96 "dama/doctrine-test-bundle": "^4.0" 95 "dama/doctrine-test-bundle": "^5.0"
97 }, 96 },
98 "scripts": { 97 "scripts": {
99 "post-cmd": [ 98 "post-cmd": [
@@ -122,18 +121,38 @@
122 } 121 }
123 }, 122 },
124 "autoload": { 123 "autoload": {
125 "psr-4": { "Wallabag\\": "src/Wallabag/" }, 124 "psr-4": {
126 "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] 125 "Wallabag\\": "src/Wallabag/"
126 },
127 "classmap": [
128 "app/AppKernel.php",
129 "app/AppCache.php"
130 ]
127 }, 131 },
128 "autoload-dev": { 132 "autoload-dev": {
129 "psr-4": { "Tests\\": "tests/" } 133 "psr-4": {
134 "Tests\\": "tests/"
135 },
136 "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
130 }, 137 },
131 "config": { 138 "config": {
132 "bin-dir": "bin", 139 "bin-dir": "bin",
133 "platform": { 140 "platform": {
134 "php": "5.6.0" 141 "php": "7.1"
135 } 142 }
136 }, 143 },
137 "minimum-stability": "dev", 144 "minimum-stability": "dev",
138 "prefer-stable": true 145 "prefer-stable": true,
146 "repositories": [
147 {
148 "type": "vcs",
149 "url": "https://github.com/Daniel-KM/PHPePub",
150 "comment": "The most up-to-date PHPePub as of now"
151 },
152 {
153 "type": "vcs",
154 "url": "https://github.com/wallabag/CraueConfigBundle",
155 "comment": "To handle utf8mb4 field size"
156 }
157 ]
139} 158}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 951b5a14..426a5e72 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -4,7 +4,7 @@
4 xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd" 4 xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
5 backupGlobals="false" 5 backupGlobals="false"
6 colors="true" 6 colors="true"
7 bootstrap="app/autoload.php" 7 bootstrap="vendor/autoload.php"
8> 8>
9 9
10 <testsuites> 10 <testsuites>
@@ -15,7 +15,7 @@
15 15
16 <php> 16 <php>
17 <ini name="error_reporting" value="-1" /> 17 <ini name="error_reporting" value="-1" />
18 <server name="KERNEL_DIR" value="app/" /> 18 <server name="KERNEL_CLASS" value="AppKernel" />
19 <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" /> 19 <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
20 </php> 20 </php>
21 21
diff --git a/src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php b/src/Wallabag/AnnotationBundle/DataFixtures/AnnotationFixtures.php
index 20e07fa3..ed46cea9 100644
--- a/src/Wallabag/AnnotationBundle/DataFixtures/ORM/LoadAnnotationData.php
+++ b/src/Wallabag/AnnotationBundle/DataFixtures/AnnotationFixtures.php
@@ -1,13 +1,15 @@
1<?php 1<?php
2 2
3namespace Wallabag\AnnotationBundle\DataFixtures\ORM; 3namespace Wallabag\AnnotationBundle\DataFixtures;
4 4
5use Doctrine\Common\DataFixtures\AbstractFixture; 5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface; 6use Doctrine\Common\DataFixtures\DependentFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\AnnotationBundle\Entity\Annotation; 8use Wallabag\AnnotationBundle\Entity\Annotation;
9use Wallabag\CoreBundle\DataFixtures\EntryFixtures;
10use Wallabag\UserBundle\DataFixtures\UserFixtures;
9 11
10class LoadAnnotationData extends AbstractFixture implements OrderedFixtureInterface 12class AnnotationFixtures extends Fixture implements DependentFixtureInterface
11{ 13{
12 /** 14 /**
13 * {@inheritdoc} 15 * {@inheritdoc}
@@ -38,8 +40,11 @@ class LoadAnnotationData extends AbstractFixture implements OrderedFixtureInterf
38 /** 40 /**
39 * {@inheritdoc} 41 * {@inheritdoc}
40 */ 42 */
41 public function getOrder() 43 public function getDependencies()
42 { 44 {
43 return 35; 45 return [
46 EntryFixtures::class,
47 UserFixtures::class,
48 ];
44 } 49 }
45} 50}
diff --git a/src/Wallabag/ApiBundle/Entity/AccessToken.php b/src/Wallabag/ApiBundle/Entity/AccessToken.php
index c09a0c80..5e4099dd 100644
--- a/src/Wallabag/ApiBundle/Entity/AccessToken.php
+++ b/src/Wallabag/ApiBundle/Entity/AccessToken.php
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
8/** 8/**
9 * @ORM\Table("oauth2_access_tokens") 9 * @ORM\Table("oauth2_access_tokens")
10 * @ORM\Entity 10 * @ORM\Entity
11 * @ORM\AttributeOverrides({
12 * @ORM\AttributeOverride(name="token",
13 * column=@ORM\Column(
14 * name = "token",
15 * type = "string",
16 * length = 191
17 * )
18 * ),
19 * @ORM\AttributeOverride(name="scope",
20 * column=@ORM\Column(
21 * name = "scope",
22 * type = "string",
23 * length = 191
24 * )
25 * )
26 * })
11 */ 27 */
12class AccessToken extends BaseAccessToken 28class AccessToken extends BaseAccessToken
13{ 29{
diff --git a/src/Wallabag/ApiBundle/Entity/AuthCode.php b/src/Wallabag/ApiBundle/Entity/AuthCode.php
index 4d4b09fe..5fa205ac 100644
--- a/src/Wallabag/ApiBundle/Entity/AuthCode.php
+++ b/src/Wallabag/ApiBundle/Entity/AuthCode.php
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode;
8/** 8/**
9 * @ORM\Table("oauth2_auth_codes") 9 * @ORM\Table("oauth2_auth_codes")
10 * @ORM\Entity 10 * @ORM\Entity
11 * @ORM\AttributeOverrides({
12 * @ORM\AttributeOverride(name="token",
13 * column=@ORM\Column(
14 * name = "token",
15 * type = "string",
16 * length = 191
17 * )
18 * ),
19 * @ORM\AttributeOverride(name="scope",
20 * column=@ORM\Column(
21 * name = "scope",
22 * type = "string",
23 * length = 191
24 * )
25 * )
26 * })
11 */ 27 */
12class AuthCode extends BaseAuthCode 28class AuthCode extends BaseAuthCode
13{ 29{
diff --git a/src/Wallabag/ApiBundle/Entity/RefreshToken.php b/src/Wallabag/ApiBundle/Entity/RefreshToken.php
index 822a02d8..dd8e9c63 100644
--- a/src/Wallabag/ApiBundle/Entity/RefreshToken.php
+++ b/src/Wallabag/ApiBundle/Entity/RefreshToken.php
@@ -8,6 +8,22 @@ use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken;
8/** 8/**
9 * @ORM\Table("oauth2_refresh_tokens") 9 * @ORM\Table("oauth2_refresh_tokens")
10 * @ORM\Entity 10 * @ORM\Entity
11 * @ORM\AttributeOverrides({
12 * @ORM\AttributeOverride(name="token",
13 * column=@ORM\Column(
14 * name = "token",
15 * type = "string",
16 * length = 191
17 * )
18 * ),
19 * @ORM\AttributeOverride(name="scope",
20 * column=@ORM\Column(
21 * name = "scope",
22 * type = "string",
23 * length = 191
24 * )
25 * )
26 * })
11 */ 27 */
12class RefreshToken extends BaseRefreshToken 28class RefreshToken extends BaseRefreshToken
13{ 29{
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php
index 3d4d5def..c54e9f2c 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ConfigFixtures.php
@@ -1,13 +1,14 @@
1<?php 1<?php
2 2
3namespace Wallabag\CoreBundle\DataFixtures\ORM; 3namespace Wallabag\CoreBundle\DataFixtures;
4 4
5use Doctrine\Common\DataFixtures\AbstractFixture; 5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface; 6use Doctrine\Common\DataFixtures\DependentFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\Config; 8use Wallabag\CoreBundle\Entity\Config;
9use Wallabag\UserBundle\DataFixtures\UserFixtures;
9 10
10class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface 11class ConfigFixtures extends Fixture implements DependentFixtureInterface
11{ 12{
12 /** 13 /**
13 * {@inheritdoc} 14 * {@inheritdoc}
@@ -60,8 +61,10 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
60 /** 61 /**
61 * {@inheritdoc} 62 * {@inheritdoc}
62 */ 63 */
63 public function getOrder() 64 public function getDependencies()
64 { 65 {
65 return 20; 66 return [
67 UserFixtures::class,
68 ];
66 } 69 }
67} 70}
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/EntryFixtures.php
index 62fb5fa6..0bd58487 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/EntryFixtures.php
@@ -1,13 +1,14 @@
1<?php 1<?php
2 2
3namespace Wallabag\CoreBundle\DataFixtures\ORM; 3namespace Wallabag\CoreBundle\DataFixtures;
4 4
5use Doctrine\Common\DataFixtures\AbstractFixture; 5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface; 6use Doctrine\Common\DataFixtures\DependentFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\UserBundle\DataFixtures\UserFixtures;
9 10
10class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface 11class EntryFixtures extends Fixture implements DependentFixtureInterface
11{ 12{
12 /** 13 /**
13 * {@inheritdoc} 14 * {@inheritdoc}
@@ -112,8 +113,11 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
112 /** 113 /**
113 * {@inheritdoc} 114 * {@inheritdoc}
114 */ 115 */
115 public function getOrder() 116 public function getDependencies()
116 { 117 {
117 return 30; 118 return [
119 UserFixtures::class,
120 TagFixtures::class,
121 ];
118 } 122 }
119} 123}
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
index 3fe88e7f..cc7d1f59 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php
@@ -1,15 +1,14 @@
1<?php 1<?php
2 2
3namespace Wallabag\CoreBundle\DataFixtures\ORM; 3namespace Wallabag\CoreBundle\DataFixtures;
4 4
5use Craue\ConfigBundle\Entity\Setting; 5use Craue\ConfigBundle\Entity\Setting;
6use Doctrine\Common\DataFixtures\AbstractFixture; 6use Doctrine\Bundle\FixturesBundle\Fixture;
7use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
8use Doctrine\Common\Persistence\ObjectManager; 7use Doctrine\Common\Persistence\ObjectManager;
9use Symfony\Component\DependencyInjection\ContainerAwareInterface; 8use Symfony\Component\DependencyInjection\ContainerAwareInterface;
10use Symfony\Component\DependencyInjection\ContainerInterface; 9use Symfony\Component\DependencyInjection\ContainerInterface;
11 10
12class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface 11class SettingFixtures extends Fixture implements ContainerAwareInterface
13{ 12{
14 /** 13 /**
15 * @var ContainerInterface 14 * @var ContainerInterface
@@ -36,12 +35,4 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
36 35
37 $manager->flush(); 36 $manager->flush();
38 } 37 }
39
40 /**
41 * {@inheritdoc}
42 */
43 public function getOrder()
44 {
45 return 29;
46 }
47} 38}
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php b/src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
index 866f55a4..c73173e8 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
@@ -1,13 +1,14 @@
1<?php 1<?php
2 2
3namespace Wallabag\CoreBundle\DataFixtures\ORM; 3namespace Wallabag\CoreBundle\DataFixtures;
4 4
5use Doctrine\Common\DataFixtures\AbstractFixture; 5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface; 6use Doctrine\Common\DataFixtures\DependentFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\SiteCredential; 8use Wallabag\CoreBundle\Entity\SiteCredential;
9use Wallabag\UserBundle\DataFixtures\UserFixtures;
9 10
10class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureInterface 11class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface
11{ 12{
12 /** 13 /**
13 * {@inheritdoc} 14 * {@inheritdoc}
@@ -27,8 +28,10 @@ class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureIn
27 /** 28 /**
28 * {@inheritdoc} 29 * {@inheritdoc}
29 */ 30 */
30 public function getOrder() 31 public function getDependencies()
31 { 32 {
32 return 50; 33 return [
34 UserFixtures::class,
35 ];
33 } 36 }
34} 37}
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php b/src/Wallabag/CoreBundle/DataFixtures/TagFixtures.php
index 0ecfd18b..d78dd0b8 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTagData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/TagFixtures.php
@@ -1,13 +1,12 @@
1<?php 1<?php
2 2
3namespace Wallabag\CoreBundle\DataFixtures\ORM; 3namespace Wallabag\CoreBundle\DataFixtures;
4 4
5use Doctrine\Common\DataFixtures\AbstractFixture; 5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 6use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\Tag; 7use Wallabag\CoreBundle\Entity\Tag;
9 8
10class LoadTagData extends AbstractFixture implements OrderedFixtureInterface 9class TagFixtures extends Fixture
11{ 10{
12 /** 11 /**
13 * {@inheritdoc} 12 * {@inheritdoc}
@@ -44,12 +43,4 @@ class LoadTagData extends AbstractFixture implements OrderedFixtureInterface
44 43
45 $manager->flush(); 44 $manager->flush();
46 } 45 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function getOrder()
52 {
53 return 25;
54 }
55} 46}
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php b/src/Wallabag/CoreBundle/DataFixtures/TaggingRuleFixtures.php
index 55abd63c..78ff314a 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/TaggingRuleFixtures.php
@@ -1,13 +1,13 @@
1<?php 1<?php
2 2
3namespace Wallabag\CoreBundle\DataFixtures\ORM; 3namespace Wallabag\CoreBundle\DataFixtures;
4 4
5use Doctrine\Common\DataFixtures\AbstractFixture; 5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface; 6use Doctrine\Common\DataFixtures\DependentFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\TaggingRule; 8use Wallabag\CoreBundle\Entity\TaggingRule;
9 9
10class LoadTaggingRuleData extends AbstractFixture implements OrderedFixtureInterface 10class TaggingRuleFixtures extends Fixture implements DependentFixtureInterface
11{ 11{
12 /** 12 /**
13 * {@inheritdoc} 13 * {@inheritdoc}
@@ -49,8 +49,10 @@ class LoadTaggingRuleData extends AbstractFixture implements OrderedFixtureInter
49 /** 49 /**
50 * {@inheritdoc} 50 * {@inheritdoc}
51 */ 51 */
52 public function getOrder() 52 public function getDependencies()
53 { 53 {
54 return 40; 54 return [
55 ConfigFixtures::class,
56 ];
55 } 57 }
56} 58}
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php
deleted file mode 100644
index eb5b203f..00000000
--- a/src/Wallabag/CoreBundle/Doctrine/DBAL/Driver/CustomPostgreSQLDriver.php
+++ /dev/null
@@ -1,25 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine\DBAL\Driver;
4
5use Doctrine\DBAL\Connection;
6use Doctrine\DBAL\Driver\PDOPgSql\Driver;
7use Wallabag\CoreBundle\Doctrine\DBAL\Schema\CustomPostgreSqlSchemaManager;
8
9/**
10 * This custom driver allow to use a different schema manager
11 * So we can fix the PostgreSQL 10 problem.
12 *
13 * @see https://github.com/wallabag/wallabag/issues/3479
14 * @see https://github.com/doctrine/dbal/issues/2868
15 */
16class CustomPostgreSQLDriver extends Driver
17{
18 /**
19 * {@inheritdoc}
20 */
21 public function getSchemaManager(Connection $conn)
22 {
23 return new CustomPostgreSqlSchemaManager($conn);
24 }
25}
diff --git a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php b/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php
deleted file mode 100644
index 439ae17d..00000000
--- a/src/Wallabag/CoreBundle/Doctrine/DBAL/Schema/CustomPostgreSqlSchemaManager.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Doctrine\DBAL\Schema;
4
5use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
6use Doctrine\DBAL\Schema\Sequence;
7
8/**
9 * This custom schema manager fix the PostgreSQL 10 problem.
10 *
11 * @see https://github.com/wallabag/wallabag/issues/3479
12 * @see https://github.com/doctrine/dbal/issues/2868
13 */
14class CustomPostgreSqlSchemaManager extends PostgreSqlSchemaManager
15{
16 /**
17 * {@inheritdoc}
18 */
19 protected function _getPortableSequenceDefinition($sequence)
20 {
21 $sequenceName = $sequence['relname'];
22 if ('public' !== $sequence['schemaname']) {
23 $sequenceName = $sequence['schemaname'] . '.' . $sequence['relname'];
24 }
25
26 $query = 'SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName);
27
28 // the `method_exists` is only to avoid test to fail:
29 // DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticConnection doesn't support the `getServerVersion`
30 if (method_exists($this->_conn->getWrappedConnection(), 'getServerVersion') && (float) ($this->_conn->getWrappedConnection()->getServerVersion()) >= 10) {
31 $query = "SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = 'public' AND sequencename = " . $this->_conn->quote($sequenceName);
32 }
33
34 $data = $this->_conn->fetchAll($query);
35
36 return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
37 }
38}
diff --git a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
index 7aa2409a..4a3fef3b 100644
--- a/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
+++ b/src/Wallabag/CoreBundle/Doctrine/WallabagMigration.php
@@ -2,8 +2,8 @@
2 2
3namespace Wallabag\CoreBundle\Doctrine; 3namespace Wallabag\CoreBundle\Doctrine;
4 4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema; 5use Doctrine\DBAL\Schema\Schema;
6use Doctrine\Migrations\AbstractMigration;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface; 7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface; 8use Symfony\Component\DependencyInjection\ContainerInterface;
9 9
diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
index 84e11e26..c1be3165 100644
--- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php
+++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php
@@ -3,7 +3,7 @@
3namespace Wallabag\CoreBundle\Entity; 3namespace Wallabag\CoreBundle\Entity;
4 4
5use Doctrine\ORM\Mapping as ORM; 5use Doctrine\ORM\Mapping as ORM;
6use KPhoen\RulerZBundle\Validator\Constraints as RulerZAssert; 6use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert;
7use Symfony\Component\Validator\Constraints as Assert; 7use Symfony\Component\Validator\Constraints as Assert;
8 8
9/** 9/**
diff --git a/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/UserBundle/DataFixtures/UserFixtures.php
index 26dbda3b..1e375e09 100644
--- a/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php
+++ b/src/Wallabag/UserBundle/DataFixtures/UserFixtures.php
@@ -1,13 +1,12 @@
1<?php 1<?php
2 2
3namespace Wallabag\UserBundle\DataFixtures\ORM; 3namespace Wallabag\UserBundle\DataFixtures;
4 4
5use Doctrine\Common\DataFixtures\AbstractFixture; 5use Doctrine\Bundle\FixturesBundle\Fixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager; 6use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\UserBundle\Entity\User; 7use Wallabag\UserBundle\Entity\User;
9 8
10class LoadUserData extends AbstractFixture implements OrderedFixtureInterface 9class UserFixtures extends Fixture
11{ 10{
12 /** 11 /**
13 * {@inheritdoc} 12 * {@inheritdoc}
@@ -50,12 +49,4 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
50 49
51 $manager->flush(); 50 $manager->flush();
52 } 51 }
53
54 /**
55 * {@inheritdoc}
56 */
57 public function getOrder()
58 {
59 return 10;
60 }
61} 52}
diff --git a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
index 96474468..537283f2 100644
--- a/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
+++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
@@ -100,8 +100,7 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
100 $this->assertSame('my quote', $content['quote']); 100 $this->assertSame('my quote', $content['quote']);
101 101
102 /** @var Annotation $annotation */ 102 /** @var Annotation $annotation */
103 $annotation = $this->client->getContainer() 103 $annotation = $em
104 ->get('doctrine.orm.entity_manager')
105 ->getRepository('WallabagAnnotationBundle:Annotation') 104 ->getRepository('WallabagAnnotationBundle:Annotation')
106 ->findLastAnnotationByPageId($entry->getId(), 1); 105 ->findLastAnnotationByPageId($entry->getId(), 1);
107 106
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 6b26376d..3696f8f9 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -15,7 +15,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
15 $entry = $this->client->getContainer() 15 $entry = $this->client->getContainer()
16 ->get('doctrine.orm.entity_manager') 16 ->get('doctrine.orm.entity_manager')
17 ->getRepository('WallabagCoreBundle:Entry') 17 ->getRepository('WallabagCoreBundle:Entry')
18 ->findOneBy(['user' => 1, 'isArchived' => false]); 18 ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]);
19 19
20 if (!$entry) { 20 if (!$entry) {
21 $this->markTestSkipped('No content found in db.'); 21 $this->markTestSkipped('No content found in db.');
@@ -41,7 +41,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
41 $entry = $this->client->getContainer() 41 $entry = $this->client->getContainer()
42 ->get('doctrine.orm.entity_manager') 42 ->get('doctrine.orm.entity_manager')
43 ->getRepository('WallabagCoreBundle:Entry') 43 ->getRepository('WallabagCoreBundle:Entry')
44 ->findOneBy(['user' => 1, 'url' => 'http://0.0.0.0/entry2']); 44 ->findOneBy(['user' => $this->getUserId(), 'url' => 'http://0.0.0.0/entry2']);
45 45
46 if (!$entry) { 46 if (!$entry) {
47 $this->markTestSkipped('No content found in db.'); 47 $this->markTestSkipped('No content found in db.');
@@ -60,7 +60,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
60 $entry = $this->client->getContainer() 60 $entry = $this->client->getContainer()
61 ->get('doctrine.orm.entity_manager') 61 ->get('doctrine.orm.entity_manager')
62 ->getRepository('WallabagCoreBundle:Entry') 62 ->getRepository('WallabagCoreBundle:Entry')
63 ->findOneBy(['user' => 1, 'isArchived' => false]); 63 ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]);
64 64
65 if (!$entry) { 65 if (!$entry) {
66 $this->markTestSkipped('No content found in db.'); 66 $this->markTestSkipped('No content found in db.');
@@ -108,7 +108,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
108 $entry = $this->client->getContainer() 108 $entry = $this->client->getContainer()
109 ->get('doctrine.orm.entity_manager') 109 ->get('doctrine.orm.entity_manager')
110 ->getRepository('WallabagCoreBundle:Entry') 110 ->getRepository('WallabagCoreBundle:Entry')
111 ->findOneBy(['user' => 2, 'isArchived' => false]); 111 ->findOneBy(['user' => $this->getUserId('bob'), 'isArchived' => false]);
112 112
113 if (!$entry) { 113 if (!$entry) {
114 $this->markTestSkipped('No content found in db.'); 114 $this->markTestSkipped('No content found in db.');
@@ -185,7 +185,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
185 $entry = $this->client->getContainer() 185 $entry = $this->client->getContainer()
186 ->get('doctrine.orm.entity_manager') 186 ->get('doctrine.orm.entity_manager')
187 ->getRepository('WallabagCoreBundle:Entry') 187 ->getRepository('WallabagCoreBundle:Entry')
188 ->findOneByUser(1); 188 ->findOneByUser($this->getUserId());
189 189
190 if (!$entry) { 190 if (!$entry) {
191 $this->markTestSkipped('No content found in db.'); 191 $this->markTestSkipped('No content found in db.');
@@ -394,7 +394,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
394 $entry = $this->client->getContainer() 394 $entry = $this->client->getContainer()
395 ->get('doctrine.orm.entity_manager') 395 ->get('doctrine.orm.entity_manager')
396 ->getRepository('WallabagCoreBundle:Entry') 396 ->getRepository('WallabagCoreBundle:Entry')
397 ->findOneByUser(1, ['id' => 'asc']); 397 ->findOneByUser($this->getUserId(), ['id' => 'asc']);
398 398
399 if (!$entry) { 399 if (!$entry) {
400 $this->markTestSkipped('No content found in db.'); 400 $this->markTestSkipped('No content found in db.');
@@ -440,7 +440,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
440 $this->assertNull($content['starred_at']); 440 $this->assertNull($content['starred_at']);
441 $this->assertNull($content['archived_at']); 441 $this->assertNull($content['archived_at']);
442 $this->assertSame('New title for my article', $content['title']); 442 $this->assertSame('New title for my article', $content['title']);
443 $this->assertSame(1, $content['user_id']); 443 $this->assertSame($this->getUserId(), $content['user_id']);
444 $this->assertCount(2, $content['tags']); 444 $this->assertCount(2, $content['tags']);
445 $this->assertNull($content['origin_url']); 445 $this->assertNull($content['origin_url']);
446 $this->assertSame('my content', $content['content']); 446 $this->assertSame('my content', $content['content']);
@@ -455,7 +455,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
455 public function testPostSameEntry() 455 public function testPostSameEntry()
456 { 456 {
457 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); 457 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
458 $entry = new Entry($em->getReference(User::class, 1)); 458 $entry = new Entry($em->getReference(User::class, $this->getUserId()));
459 $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'); 459 $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');
460 $entry->setArchived(true); 460 $entry->setArchived(true);
461 $entry->addTag((new Tag())->setLabel('google')); 461 $entry->addTag((new Tag())->setLabel('google'));
@@ -535,7 +535,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
535 $this->assertSame(1, $content['is_starred']); 535 $this->assertSame(1, $content['is_starred']);
536 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); 536 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
537 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['archived_at']))->getTimestamp()); 537 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['archived_at']))->getTimestamp());
538 $this->assertSame(1, $content['user_id']); 538 $this->assertSame($this->getUserId(), $content['user_id']);
539 } 539 }
540 540
541 public function testPostArchivedAndStarredEntryWithoutQuotes() 541 public function testPostArchivedAndStarredEntryWithoutQuotes()
@@ -584,7 +584,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
584 $entry = $this->client->getContainer() 584 $entry = $this->client->getContainer()
585 ->get('doctrine.orm.entity_manager') 585 ->get('doctrine.orm.entity_manager')
586 ->getRepository('WallabagCoreBundle:Entry') 586 ->getRepository('WallabagCoreBundle:Entry')
587 ->findOneByUser(1); 587 ->findOneByUser($this->getUserId());
588 588
589 if (!$entry) { 589 if (!$entry) {
590 $this->markTestSkipped('No content found in db.'); 590 $this->markTestSkipped('No content found in db.');
@@ -611,7 +611,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
611 $this->assertSame($entry->getUrl(), $content['url']); 611 $this->assertSame($entry->getUrl(), $content['url']);
612 $this->assertSame('New awesome title', $content['title']); 612 $this->assertSame('New awesome title', $content['title']);
613 $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag'); 613 $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag');
614 $this->assertSame(1, $content['user_id']); 614 $this->assertSame($this->getUserId(), $content['user_id']);
615 $this->assertSame('de_AT', $content['language']); 615 $this->assertSame('de_AT', $content['language']);
616 $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']); 616 $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']);
617 $this->assertContains('sponge', $content['published_by']); 617 $this->assertContains('sponge', $content['published_by']);
@@ -626,7 +626,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
626 $entry = $this->client->getContainer() 626 $entry = $this->client->getContainer()
627 ->get('doctrine.orm.entity_manager') 627 ->get('doctrine.orm.entity_manager')
628 ->getRepository('WallabagCoreBundle:Entry') 628 ->getRepository('WallabagCoreBundle:Entry')
629 ->findOneByUser(1); 629 ->findOneByUser($this->getUserId());
630 630
631 if (!$entry) { 631 if (!$entry) {
632 $this->markTestSkipped('No content found in db.'); 632 $this->markTestSkipped('No content found in db.');
@@ -660,7 +660,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
660 $entry = $this->client->getContainer() 660 $entry = $this->client->getContainer()
661 ->get('doctrine.orm.entity_manager') 661 ->get('doctrine.orm.entity_manager')
662 ->getRepository('WallabagCoreBundle:Entry') 662 ->getRepository('WallabagCoreBundle:Entry')
663 ->findOneByUser(1); 663 ->findOneByUser($this->getUserId());
664 664
665 if (!$entry) { 665 if (!$entry) {
666 $this->markTestSkipped('No content found in db.'); 666 $this->markTestSkipped('No content found in db.');
@@ -691,7 +691,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
691 $entry = $this->client->getContainer() 691 $entry = $this->client->getContainer()
692 ->get('doctrine.orm.entity_manager') 692 ->get('doctrine.orm.entity_manager')
693 ->getRepository('WallabagCoreBundle:Entry') 693 ->getRepository('WallabagCoreBundle:Entry')
694 ->findOneByUser(1); 694 ->findOneByUser($this->getUserId());
695 695
696 if (!$entry) { 696 if (!$entry) {
697 $this->markTestSkipped('No content found in db.'); 697 $this->markTestSkipped('No content found in db.');
@@ -723,7 +723,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
723 $entry = $this->client->getContainer() 723 $entry = $this->client->getContainer()
724 ->get('doctrine.orm.entity_manager') 724 ->get('doctrine.orm.entity_manager')
725 ->getRepository('WallabagCoreBundle:Entry') 725 ->getRepository('WallabagCoreBundle:Entry')
726 ->findOneByUser(1); 726 ->findOneByUser($this->getUserId());
727 727
728 if (!$entry) { 728 if (!$entry) {
729 $this->markTestSkipped('No content found in db.'); 729 $this->markTestSkipped('No content found in db.');
@@ -768,7 +768,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
768 $entry = $this->client->getContainer() 768 $entry = $this->client->getContainer()
769 ->get('doctrine.orm.entity_manager') 769 ->get('doctrine.orm.entity_manager')
770 ->getRepository('WallabagCoreBundle:Entry') 770 ->getRepository('WallabagCoreBundle:Entry')
771 ->findOneByUser(1); 771 ->findOneByUser($this->getUserId());
772 772
773 if (!$entry) { 773 if (!$entry) {
774 $this->markTestSkipped('No content found in db.'); 774 $this->markTestSkipped('No content found in db.');
@@ -833,7 +833,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
833 $entry = $this->client->getContainer() 833 $entry = $this->client->getContainer()
834 ->get('doctrine.orm.entity_manager') 834 ->get('doctrine.orm.entity_manager')
835 ->getRepository('WallabagCoreBundle:Entry') 835 ->getRepository('WallabagCoreBundle:Entry')
836 ->findOneBy(['user' => 1, 'isArchived' => true]); 836 ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]);
837 837
838 if (!$entry) { 838 if (!$entry) {
839 $this->markTestSkipped('No content found in db.'); 839 $this->markTestSkipped('No content found in db.');
@@ -855,7 +855,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
855 $entry = $this->client->getContainer() 855 $entry = $this->client->getContainer()
856 ->get('doctrine.orm.entity_manager') 856 ->get('doctrine.orm.entity_manager')
857 ->getRepository('WallabagCoreBundle:Entry') 857 ->getRepository('WallabagCoreBundle:Entry')
858 ->findOneBy(['user' => 1, 'isStarred' => true]); 858 ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]);
859 859
860 if (!$entry) { 860 if (!$entry) {
861 $this->markTestSkipped('No content found in db.'); 861 $this->markTestSkipped('No content found in db.');
@@ -877,7 +877,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
877 $entry = $this->client->getContainer() 877 $entry = $this->client->getContainer()
878 ->get('doctrine.orm.entity_manager') 878 ->get('doctrine.orm.entity_manager')
879 ->getRepository('WallabagCoreBundle:Entry') 879 ->getRepository('WallabagCoreBundle:Entry')
880 ->findOneBy(['user' => 1, 'isArchived' => true]); 880 ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]);
881 881
882 if (!$entry) { 882 if (!$entry) {
883 $this->markTestSkipped('No content found in db.'); 883 $this->markTestSkipped('No content found in db.');
@@ -903,7 +903,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
903 $entry = $this->client->getContainer() 903 $entry = $this->client->getContainer()
904 ->get('doctrine.orm.entity_manager') 904 ->get('doctrine.orm.entity_manager')
905 ->getRepository('WallabagCoreBundle:Entry') 905 ->getRepository('WallabagCoreBundle:Entry')
906 ->findOneBy(['user' => 1, 'isStarred' => true]); 906 ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]);
907 907
908 if (!$entry) { 908 if (!$entry) {
909 $this->markTestSkipped('No content found in db.'); 909 $this->markTestSkipped('No content found in db.');
@@ -920,32 +920,27 @@ class EntryRestControllerTest extends WallabagApiTestCase
920 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); 920 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
921 } 921 }
922 922
923 public function dataForEntriesExistWithUrl() 923 public function testGetEntriesExistsWithReturnId()
924 { 924 {
925 return [ 925 $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2&return_id=1');
926 'with_id' => [ 926
927 'url' => '/api/entries/exists?url=http://0.0.0.0/entry2&return_id=1', 927 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
928 'expectedValue' => 2, 928
929 ], 929 $content = json_decode($this->client->getResponse()->getContent(), true);
930 'without_id' => [ 930
931 'url' => '/api/entries/exists?url=http://0.0.0.0/entry2', 931 // it returns a database id, we don't know it, so we only check it's greater than the lowest possible value
932 'expectedValue' => true, 932 $this->assertGreaterThan(1, $content['exists']);
933 ],
934 ];
935 } 933 }
936 934
937 /** 935 public function testGetEntriesExistsWithoutReturnId()
938 * @dataProvider dataForEntriesExistWithUrl
939 */
940 public function testGetEntriesExists($url, $expectedValue)
941 { 936 {
942 $this->client->request('GET', $url); 937 $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2');
943 938
944 $this->assertSame(200, $this->client->getResponse()->getStatusCode()); 939 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
945 940
946 $content = json_decode($this->client->getResponse()->getContent(), true); 941 $content = json_decode($this->client->getResponse()->getContent(), true);
947 942
948 $this->assertSame($expectedValue, $content['exists']); 943 $this->assertTrue($content['exists']);
949 } 944 }
950 945
951 public function testGetEntriesExistsWithManyUrls() 946 public function testGetEntriesExistsWithManyUrls()
@@ -960,7 +955,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
960 955
961 $this->assertArrayHasKey($url1, $content); 956 $this->assertArrayHasKey($url1, $content);
962 $this->assertArrayHasKey($url2, $content); 957 $this->assertArrayHasKey($url2, $content);
963 $this->assertSame(2, $content[$url1]); 958 // it returns a database id, we don't know it, so we only check it's greater than the lowest possible value
959 $this->assertGreaterThan(1, $content[$url1]);
964 $this->assertNull($content[$url2]); 960 $this->assertNull($content[$url2]);
965 } 961 }
966 962
@@ -1002,7 +998,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1002 { 998 {
1003 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 999 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
1004 ->getRepository('WallabagCoreBundle:Entry') 1000 ->getRepository('WallabagCoreBundle:Entry')
1005 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); 1001 ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
1006 1002
1007 if (!$entry) { 1003 if (!$entry) {
1008 $this->markTestSkipped('No content found in db.'); 1004 $this->markTestSkipped('No content found in db.');
@@ -1038,7 +1034,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1038 { 1034 {
1039 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 1035 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
1040 ->getRepository('WallabagCoreBundle:Entry') 1036 ->getRepository('WallabagCoreBundle:Entry')
1041 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); 1037 ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
1042 1038
1043 $tags = $entry->getTags(); 1039 $tags = $entry->getTags();
1044 1040
@@ -1062,7 +1058,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1062 1058
1063 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 1059 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
1064 ->getRepository('WallabagCoreBundle:Entry') 1060 ->getRepository('WallabagCoreBundle:Entry')
1065 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); 1061 ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId());
1066 1062
1067 $tags = $entry->getTags(); 1063 $tags = $entry->getTags();
1068 $this->assertCount(4, $tags); 1064 $this->assertCount(4, $tags);
@@ -1082,7 +1078,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1082 public function testDeleteEntriesTagsListAction() 1078 public function testDeleteEntriesTagsListAction()
1083 { 1079 {
1084 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); 1080 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
1085 $entry = new Entry($em->getReference(User::class, 1)); 1081 $entry = new Entry($em->getReference(User::class, $this->getUserId()));
1086 $entry->setUrl('http://0.0.0.0/test-entry'); 1082 $entry->setUrl('http://0.0.0.0/test-entry');
1087 $entry->addTag((new Tag())->setLabel('foo-tag')); 1083 $entry->addTag((new Tag())->setLabel('foo-tag'));
1088 $entry->addTag((new Tag())->setLabel('bar-tag')); 1084 $entry->addTag((new Tag())->setLabel('bar-tag'));
@@ -1150,7 +1146,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1150 public function testDeleteEntriesListAction() 1146 public function testDeleteEntriesListAction()
1151 { 1147 {
1152 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); 1148 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
1153 $em->persist((new Entry($em->getReference(User::class, 1)))->setUrl('http://0.0.0.0/test-entry1')); 1149 $em->persist((new Entry($em->getReference(User::class, $this->getUserId())))->setUrl('http://0.0.0.0/test-entry1'));
1154 1150
1155 $em->flush(); 1151 $em->flush();
1156 $em->clear(); 1152 $em->clear();
@@ -1208,7 +1204,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1208 public function testRePostEntryAndReUsePublishedAt() 1204 public function testRePostEntryAndReUsePublishedAt()
1209 { 1205 {
1210 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); 1206 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
1211 $entry = new Entry($em->getReference(User::class, 1)); 1207 $entry = new Entry($em->getReference(User::class, $this->getUserId()));
1212 $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »'); 1208 $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »');
1213 $entry->setContent('hihi'); 1209 $entry->setContent('hihi');
1214 $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'); 1210 $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');
diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
index 0c52aea0..fd2e113e 100644
--- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
+++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php
@@ -48,4 +48,23 @@ abstract class WallabagApiTestCase extends WebTestCase
48 48
49 return $client; 49 return $client;
50 } 50 }
51
52 /**
53 * Return the ID for the user admin.
54 * Used because on heavy testing we don't want to re-create the database on each run.
55 * Which means "admin" user won't have id 1 all the time.
56 *
57 * @param string $username
58 *
59 * @return int
60 */
61 protected function getUserId($username = 'admin')
62 {
63 return $this->client
64 ->getContainer()
65 ->get('doctrine.orm.entity_manager')
66 ->getRepository('WallabagUserBundle:User')
67 ->findOneByUserName($username)
68 ->getId();
69 }
51} 70}
diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
index bd351b18..d8928451 100644
--- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
@@ -18,6 +18,18 @@ use Wallabag\CoreBundle\Command\InstallCommand;
18 18
19class InstallCommandTest extends WallabagCoreTestCase 19class InstallCommandTest extends WallabagCoreTestCase
20{ 20{
21 public static function setUpBeforeClass()
22 {
23 // disable doctrine-test-bundle
24 StaticDriver::setKeepStaticConnections(false);
25 }
26
27 public static function tearDownAfterClass()
28 {
29 // enable doctrine-test-bundle
30 StaticDriver::setKeepStaticConnections(true);
31 }
32
21 public function setUp() 33 public function setUp()
22 { 34 {
23 parent::setUp(); 35 parent::setUp();
@@ -51,9 +63,6 @@ class InstallCommandTest extends WallabagCoreTestCase
51 parent::setUp(); 63 parent::setUp();
52 } 64 }
53 65
54 // disable doctrine-test-bundle
55 StaticDriver::setKeepStaticConnections(false);
56
57 $this->resetDatabase($this->getClient()); 66 $this->resetDatabase($this->getClient());
58 } 67 }
59 68
@@ -62,6 +71,7 @@ class InstallCommandTest extends WallabagCoreTestCase
62 $databasePath = getenv('TEST_DATABASE_PATH'); 71 $databasePath = getenv('TEST_DATABASE_PATH');
63 // Remove variable environnement 72 // Remove variable environnement
64 putenv('TEST_DATABASE_PATH'); 73 putenv('TEST_DATABASE_PATH');
74
65 if ($databasePath && file_exists($databasePath)) { 75 if ($databasePath && file_exists($databasePath)) {
66 unlink($databasePath); 76 unlink($databasePath);
67 } else { 77 } else {
@@ -71,8 +81,6 @@ class InstallCommandTest extends WallabagCoreTestCase
71 $this->resetDatabase($client); 81 $this->resetDatabase($client);
72 } 82 }
73 83
74 // enable doctrine-test-bundle
75 StaticDriver::setKeepStaticConnections(true);
76 parent::tearDown(); 84 parent::tearDown();
77 } 85 }
78 86
diff --git a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
index f95320a4..8e1c528d 100644
--- a/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
+++ b/tests/Wallabag/ImportBundle/Command/ImportCommandTest.php
@@ -84,6 +84,8 @@ class ImportCommandTest extends WallabagCoreTestCase
84 84
85 public function testRunImportCommandWithUserId() 85 public function testRunImportCommandWithUserId()
86 { 86 {
87 $this->logInAs('admin');
88
87 $application = new Application($this->getClient()->getKernel()); 89 $application = new Application($this->getClient()->getKernel());
88 $application->add(new ImportCommand()); 90 $application->add(new ImportCommand());
89 91
@@ -92,7 +94,7 @@ class ImportCommandTest extends WallabagCoreTestCase
92 $tester = new CommandTester($command); 94 $tester = new CommandTester($command);
93 $tester->execute([ 95 $tester->execute([
94 'command' => $command->getName(), 96 'command' => $command->getName(),
95 'username' => 1, 97 'username' => $this->getLoggedInUserId(),
96 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json', 98 'filepath' => $application->getKernel()->getContainer()->getParameter('kernel.project_dir') . '/tests/Wallabag/ImportBundle/fixtures/wallabag-v2-read.json',
97 '--useUserId' => true, 99 '--useUserId' => true,
98 '--importer' => 'v2', 100 '--importer' => 'v2',
diff --git a/web/app.php b/web/app.php
index 4c2c4650..3427e133 100644
--- a/web/app.php
+++ b/web/app.php
@@ -2,14 +2,9 @@
2 2
3use Symfony\Component\HttpFoundation\Request; 3use Symfony\Component\HttpFoundation\Request;
4 4
5/** 5require __DIR__.'/../vendor/autoload.php';
6 * @var Composer\Autoload\ClassLoader
7 */
8$loader = require __DIR__.'/../app/autoload.php';
9include_once __DIR__.'/../var/bootstrap.php.cache';
10 6
11$kernel = new AppKernel('prod', false); 7$kernel = new AppKernel('prod', false);
12$kernel->loadClassCache();
13//$kernel = new AppCache($kernel); 8//$kernel = new AppCache($kernel);
14 9
15// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter 10// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
diff --git a/web/app_dev.php b/web/app_dev.php
index 8456754d..57e1a433 100644
--- a/web/app_dev.php
+++ b/web/app_dev.php
@@ -1,10 +1,10 @@
1<?php 1<?php
2 2
3use Symfony\Component\HttpFoundation\Request;
4use Symfony\Component\Debug\Debug; 3use Symfony\Component\Debug\Debug;
4use Symfony\Component\HttpFoundation\Request;
5 5
6// If you don't want to setup permissions the proper way, just uncomment the following PHP line 6// If you don't want to setup permissions the proper way, just uncomment the following PHP line
7// read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup 7// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
8// for more information 8// for more information
9//umask(0000); 9//umask(0000);
10 10
@@ -12,20 +12,16 @@ use Symfony\Component\Debug\Debug;
12// Feel free to remove this, extend it, or make something more sophisticated. 12// Feel free to remove this, extend it, or make something more sophisticated.
13if (isset($_SERVER['HTTP_CLIENT_IP']) 13if (isset($_SERVER['HTTP_CLIENT_IP'])
14 || isset($_SERVER['HTTP_X_FORWARDED_FOR']) 14 || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
15 || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') 15 || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'], true) || PHP_SAPI === 'cli-server')
16) { 16) {
17 header('HTTP/1.0 403 Forbidden'); 17 header('HTTP/1.0 403 Forbidden');
18 exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); 18 exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
19} 19}
20 20
21/** 21require __DIR__.'/../vendor/autoload.php';
22 * @var Composer\Autoload\ClassLoader $loader
23 */
24$loader = require __DIR__.'/../app/autoload.php';
25Debug::enable(); 22Debug::enable();
26 23
27$kernel = new AppKernel('dev', true); 24$kernel = new AppKernel('dev', true);
28$kernel->loadClassCache();
29$request = Request::createFromGlobals(); 25$request = Request::createFromGlobals();
30$response = $kernel->handle($request); 26$response = $kernel->handle($request);
31$response->send(); 27$response->send();