diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-09-28 22:57:11 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-09-28 22:57:11 +0200 |
commit | 917040d4a0b7694ca4f695c02243ffb4283d6901 (patch) | |
tree | 0bd70455b7748145a7b944d47c6845ba214b2b4d | |
parent | 4180fddac1aa011f121a1ab901f9f21aafa46112 (diff) | |
parent | fef4124130484ebdb8194b83a3278e6f970a46fb (diff) | |
download | wallabag-917040d4a0b7694ca4f695c02243ffb4283d6901.tar.gz wallabag-917040d4a0b7694ca4f695c02243ffb4283d6901.tar.zst wallabag-917040d4a0b7694ca4f695c02243ffb4283d6901.zip |
Merge pull request #1434 from wallabag/travis-db
Add multiple database tests on Travis
-rw-r--r-- | .travis.yml | 32 | ||||
-rw-r--r-- | app/config/config_test.yml | 11 | ||||
-rw-r--r-- | app/config/parameters.yml.dist | 12 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.mysql | 58 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.pgsql | 58 | ||||
-rw-r--r-- | app/config/tests/parameters.yml.dist.sqlite | 58 | ||||
-rw-r--r-- | build.xml | 52 | ||||
-rw-r--r-- | composer.json | 2 | ||||
-rw-r--r-- | composer.lock | 91 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | 13 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/ContentProxy.php | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 18 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | 42 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php | 6 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php | 14 |
16 files changed, 347 insertions, 126 deletions
diff --git a/.travis.yml b/.travis.yml index 8d0cf817..d5355820 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -3,6 +3,12 @@ language: php | |||
3 | # faster builds on docker-container setup | 3 | # faster builds on docker-container setup |
4 | sudo: false | 4 | sudo: false |
5 | 5 | ||
6 | # used for HHVM | ||
7 | addons: | ||
8 | apt: | ||
9 | packages: | ||
10 | - tidy | ||
11 | |||
6 | # cache vendor dirs | 12 | # cache vendor dirs |
7 | cache: | 13 | cache: |
8 | directories: | 14 | directories: |
@@ -13,29 +19,39 @@ php: | |||
13 | - 5.4 | 19 | - 5.4 |
14 | - 5.5 | 20 | - 5.5 |
15 | - 5.6 | 21 | - 5.6 |
22 | - 7.0 | ||
16 | - hhvm | 23 | - hhvm |
17 | - nightly | 24 | |
25 | env: | ||
26 | - DB=mysql | ||
27 | - DB=pgsql | ||
28 | - DB=sqlite | ||
18 | 29 | ||
19 | matrix: | 30 | matrix: |
20 | fast_finish: true | 31 | fast_finish: true |
32 | exclude: | ||
33 | - php: hhvm | ||
34 | env: DB=pgsql # driver for PostgreSQL currently unsupported by HHVM, requires 3rd party dependency | ||
21 | allow_failures: | 35 | allow_failures: |
36 | - php: 7.0 | ||
22 | - php: hhvm | 37 | - php: hhvm |
23 | - php: nightly | ||
24 | 38 | ||
25 | branches: | 39 | branches: |
26 | only: | 40 | only: |
27 | - v2 | 41 | - v2 |
28 | 42 | ||
29 | install: | 43 | before_script: |
30 | - composer self-update | 44 | - composer self-update |
31 | 45 | - if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi; | |
32 | # build coverage only on one build, to speed up results feedbacks | 46 | # disable xdebug since we don't use code-coverage for now |
33 | # before_script: | 47 | - if [[ $TRAVIS_PHP_VERSION != '5.6' && $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then phpenv config-rm xdebug.ini; fi |
48 | # build coverage only on one build, to speed up results feedbacks | ||
34 | # - if [[ "$TRAVIS_PHP_VERSION" = "5.6" ]]; then PHPUNIT_FLAGS="--coverage-clover=coverage.clover"; else PHPUNIT_FLAGS=""; fi; | 49 | # - if [[ "$TRAVIS_PHP_VERSION" = "5.6" ]]; then PHPUNIT_FLAGS="--coverage-clover=coverage.clover"; else PHPUNIT_FLAGS=""; fi; |
50 | - if [[ "$DB" = "pgsql" ]]; then psql -c 'create database wallabag;' -U postgres; fi; | ||
35 | 51 | ||
36 | script: | 52 | script: |
37 | - ant prepare | 53 | - ant prepare-$DB |
38 | - bin/phpunit --exclude-group command-doctrine --debug $PHPUNIT_FLAGS | 54 | - bin/phpunit --exclude-group command-doctrine -v |
39 | 55 | ||
40 | # after_script: | 56 | # after_script: |
41 | # - | | 57 | # - | |
diff --git a/app/config/config_test.yml b/app/config/config_test.yml index 4dca39d2..2fd489be 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml | |||
@@ -19,9 +19,14 @@ swiftmailer: | |||
19 | 19 | ||
20 | doctrine: | 20 | doctrine: |
21 | dbal: | 21 | dbal: |
22 | driver: pdo_sqlite | 22 | driver: "%test_database_driver%" |
23 | path: %kernel.root_dir%/../data/db/wallabag_test.sqlite | 23 | host: "%test_database_host%" |
24 | host: localhost | 24 | port: "%test_database_port%" |
25 | dbname: "%test_database_name%" | ||
26 | user: "%test_database_user%" | ||
27 | password: "%test_database_password%" | ||
28 | charset: UTF8 | ||
29 | path: "%test_database_path%" | ||
25 | orm: | 30 | orm: |
26 | metadata_cache_driver: | 31 | metadata_cache_driver: |
27 | type: service | 32 | type: service |
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index b3947207..c1f6bc1b 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist | |||
@@ -1,7 +1,7 @@ | |||
1 | # This file is a "template" of what your parameters.yml file should look like | 1 | # This file is a "template" of what your parameters.yml file should look like |
2 | parameters: | 2 | parameters: |
3 | database_driver: pdo_sqlite | 3 | database_driver: pdo_sqlite |
4 | database_host: 127.0.0.1 | 4 | database_host: 127.0.0.1 |
5 | database_port: ~ | 5 | database_port: ~ |
6 | database_name: symfony | 6 | database_name: symfony |
7 | database_user: root | 7 | database_user: root |
@@ -9,6 +9,14 @@ parameters: | |||
9 | database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" | 9 | database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" |
10 | database_table_prefix: wallabag_ | 10 | database_table_prefix: wallabag_ |
11 | 11 | ||
12 | test_database_driver: pdo_sqlite | ||
13 | test_database_host: 127.0.0.1 | ||
14 | test_database_port: ~ | ||
15 | test_database_name: ~ | ||
16 | test_database_user: ~ | ||
17 | test_database_password: ~ | ||
18 | test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite" | ||
19 | |||
12 | mailer_transport: smtp | 20 | mailer_transport: smtp |
13 | mailer_host: 127.0.0.1 | 21 | mailer_host: 127.0.0.1 |
14 | mailer_user: ~ | 22 | mailer_user: ~ |
diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql new file mode 100644 index 00000000..d8c23634 --- /dev/null +++ b/app/config/tests/parameters.yml.dist.mysql | |||
@@ -0,0 +1,58 @@ | |||
1 | # This file is a "template" of what your parameters.yml file should look like | ||
2 | parameters: | ||
3 | database_driver: pdo_sqlite | ||
4 | database_host: 127.0.0.1 | ||
5 | database_port: ~ | ||
6 | database_name: symfony | ||
7 | database_user: root | ||
8 | database_password: ~ | ||
9 | database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" | ||
10 | database_table_prefix: wallabag_ | ||
11 | |||
12 | test_database_driver: pdo_mysql | ||
13 | test_database_host: localhost | ||
14 | test_database_port: 3306 | ||
15 | test_database_name: wallabag | ||
16 | test_database_user: root | ||
17 | test_database_password: ~ | ||
18 | test_database_path: ~ | ||
19 | |||
20 | mailer_transport: smtp | ||
21 | mailer_host: 127.0.0.1 | ||
22 | mailer_user: ~ | ||
23 | mailer_password: ~ | ||
24 | |||
25 | locale: en | ||
26 | |||
27 | # A secret key that's used to generate certain security-related tokens | ||
28 | secret: ThisTokenIsNotSoSecretChangeIt | ||
29 | |||
30 | # wallabag misc | ||
31 | app.version: 2.0.0-alpha | ||
32 | |||
33 | # message to display at the bottom of the page | ||
34 | warning_message: > | ||
35 | You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a> | ||
36 | |||
37 | download_pictures: false # if true, pictures will be stored into data/assets for each article | ||
38 | |||
39 | # Entry view | ||
40 | share_twitter: true | ||
41 | share_mail: true | ||
42 | share_shaarli: true | ||
43 | shaarli_url: http://myshaarli.com | ||
44 | share_diaspora: true | ||
45 | diaspora_url: http://diasporapod.com | ||
46 | flattr: true | ||
47 | carrot: true | ||
48 | show_printlink: true | ||
49 | export_epub: true | ||
50 | export_mobi: true | ||
51 | export_pdf: true | ||
52 | |||
53 | # default user config | ||
54 | items_on_page: 12 | ||
55 | theme: material | ||
56 | language: en_US | ||
57 | from_email: no-reply@wallabag.org | ||
58 | rss_limit: 50 | ||
diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql new file mode 100644 index 00000000..7dc63880 --- /dev/null +++ b/app/config/tests/parameters.yml.dist.pgsql | |||
@@ -0,0 +1,58 @@ | |||
1 | # This file is a "template" of what your parameters.yml file should look like | ||
2 | parameters: | ||
3 | database_driver: pdo_sqlite | ||
4 | database_host: 127.0.0.1 | ||
5 | database_port: ~ | ||
6 | database_name: symfony | ||
7 | database_user: root | ||
8 | database_password: ~ | ||
9 | database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" | ||
10 | database_table_prefix: wallabag_ | ||
11 | |||
12 | test_database_driver: pdo_pgsql | ||
13 | test_database_host: localhost | ||
14 | test_database_port: | ||
15 | test_database_name: wallabag | ||
16 | test_database_user: travis | ||
17 | test_database_password: ~ | ||
18 | test_database_path: ~ | ||
19 | |||
20 | mailer_transport: smtp | ||
21 | mailer_host: 127.0.0.1 | ||
22 | mailer_user: ~ | ||
23 | mailer_password: ~ | ||
24 | |||
25 | locale: en | ||
26 | |||
27 | # A secret key that's used to generate certain security-related tokens | ||
28 | secret: ThisTokenIsNotSoSecretChangeIt | ||
29 | |||
30 | # wallabag misc | ||
31 | app.version: 2.0.0-alpha | ||
32 | |||
33 | # message to display at the bottom of the page | ||
34 | warning_message: > | ||
35 | You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a> | ||
36 | |||
37 | download_pictures: false # if true, pictures will be stored into data/assets for each article | ||
38 | |||
39 | # Entry view | ||
40 | share_twitter: true | ||
41 | share_mail: true | ||
42 | share_shaarli: true | ||
43 | shaarli_url: http://myshaarli.com | ||
44 | share_diaspora: true | ||
45 | diaspora_url: http://diasporapod.com | ||
46 | flattr: true | ||
47 | carrot: true | ||
48 | show_printlink: true | ||
49 | export_epub: true | ||
50 | export_mobi: true | ||
51 | export_pdf: true | ||
52 | |||
53 | # default user config | ||
54 | items_on_page: 12 | ||
55 | theme: material | ||
56 | language: en_US | ||
57 | from_email: no-reply@wallabag.org | ||
58 | rss_limit: 50 | ||
diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite new file mode 100644 index 00000000..3ef7cda4 --- /dev/null +++ b/app/config/tests/parameters.yml.dist.sqlite | |||
@@ -0,0 +1,58 @@ | |||
1 | # This file is a "template" of what your parameters.yml file should look like | ||
2 | parameters: | ||
3 | database_driver: pdo_sqlite | ||
4 | database_host: 127.0.0.1 | ||
5 | database_port: ~ | ||
6 | database_name: symfony | ||
7 | database_user: root | ||
8 | database_password: ~ | ||
9 | database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" | ||
10 | database_table_prefix: wallabag_ | ||
11 | |||
12 | test_database_driver: pdo_sqlite | ||
13 | test_database_host: localhost | ||
14 | test_database_port: | ||
15 | test_database_name: ~ | ||
16 | test_database_user: ~ | ||
17 | test_database_password: ~ | ||
18 | test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite" | ||
19 | |||
20 | mailer_transport: smtp | ||
21 | mailer_host: 127.0.0.1 | ||
22 | mailer_user: ~ | ||
23 | mailer_password: ~ | ||
24 | |||
25 | locale: en | ||
26 | |||
27 | # A secret key that's used to generate certain security-related tokens | ||
28 | secret: ThisTokenIsNotSoSecretChangeIt | ||
29 | |||
30 | # wallabag misc | ||
31 | app.version: 2.0.0-alpha | ||
32 | |||
33 | # message to display at the bottom of the page | ||
34 | warning_message: > | ||
35 | You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to <a href="https://github.com/wallabag/wallabag/issues">our issues list</a> and <a href="https://github.com/wallabag/wallabag/issues/new">open a new if necessary</a> | ||
36 | |||
37 | download_pictures: false # if true, pictures will be stored into data/assets for each article | ||
38 | |||
39 | # Entry view | ||
40 | share_twitter: true | ||
41 | share_mail: true | ||
42 | share_shaarli: true | ||
43 | shaarli_url: http://myshaarli.com | ||
44 | share_diaspora: true | ||
45 | diaspora_url: http://diasporapod.com | ||
46 | flattr: true | ||
47 | carrot: true | ||
48 | show_printlink: true | ||
49 | export_epub: true | ||
50 | export_mobi: true | ||
51 | export_pdf: true | ||
52 | |||
53 | # default user config | ||
54 | items_on_page: 12 | ||
55 | theme: material | ||
56 | language: en_US | ||
57 | from_email: no-reply@wallabag.org | ||
58 | rss_limit: 50 | ||
@@ -1,17 +1,23 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <project name="wallabag" default="build"> | 2 | <project name="wallabag" default="build"> |
3 | <target name="build" depends="prepare"/> | 3 | <target name="build" depends="clean,composer,prepare,phpunit"/> |
4 | <target name="prepare-mysql" depends="clean,composer,db_mysql,prepare"/> | ||
5 | <target name="prepare-sqlite" depends="clean,composer,db_sqlite,prepare"/> | ||
6 | <target name="prepare-pgsql" depends="clean,composer,db_pgsql,prepare"/> | ||
4 | 7 | ||
5 | <target name="clean" description="Cleanup build artifacts"> | 8 | <target name="clean" description="Cleanup build artifacts"> |
6 | <delete dir="${basedir}/app/cache"/> | 9 | <delete dir="${basedir}/app/cache"/> |
7 | </target> | 10 | </target> |
8 | 11 | ||
9 | <target name="prepare" depends="clean" description="Prepare for build"> | 12 | <target name="composer" description="Install deps using Composer"> |
10 | <exec executable="composer"> | 13 | <exec executable="composer"> |
11 | <arg value="install"/> | 14 | <arg value="install"/> |
12 | <arg value="--no-interaction"/> | 15 | <arg value="--no-interaction"/> |
13 | <arg value="--no-progress"/> | 16 | <arg value="--no-progress"/> |
14 | </exec> | 17 | </exec> |
18 | </target> | ||
19 | |||
20 | <target name="prepare" description="Prepare for build"> | ||
15 | <exec executable="php"> | 21 | <exec executable="php"> |
16 | <arg value="${basedir}/app/console"/> | 22 | <arg value="${basedir}/app/console"/> |
17 | <arg value="doctrine:database:drop"/> | 23 | <arg value="doctrine:database:drop"/> |
@@ -41,6 +47,48 @@ | |||
41 | </exec> | 47 | </exec> |
42 | </target> | 48 | </target> |
43 | 49 | ||
50 | <target name="db_mysql" description="Run test for MySQL"> | ||
51 | <delete dir="${basedir}/app/config/parameters.yml"/> | ||
52 | <exec executable="cp"> | ||
53 | <arg value="${basedir}/app/config/tests/parameters.yml.dist.mysql"/> | ||
54 | <arg value="${basedir}/app/config/parameters.yml"/> | ||
55 | </exec> | ||
56 | |||
57 | <exec executable="php"> | ||
58 | <arg value="${basedir}/app/console"/> | ||
59 | <arg value="cache:clear"/> | ||
60 | <arg value="--env=test"/> | ||
61 | </exec> | ||
62 | </target> | ||
63 | |||
64 | <target name="db_sqlite" description="Run test for SQLite"> | ||
65 | <delete dir="${basedir}/app/config/parameters.yml"/> | ||
66 | <exec executable="cp"> | ||
67 | <arg value="${basedir}/app/config/tests/parameters.yml.dist.sqlite"/> | ||
68 | <arg value="${basedir}/app/config/parameters.yml"/> | ||
69 | </exec> | ||
70 | |||
71 | <exec executable="php"> | ||
72 | <arg value="${basedir}/app/console"/> | ||
73 | <arg value="cache:clear"/> | ||
74 | <arg value="--env=test"/> | ||
75 | </exec> | ||
76 | </target> | ||
77 | |||
78 | <target name="db_pgsql" description="Run test for PostgreSQL"> | ||
79 | <delete dir="${basedir}/app/config/parameters.yml"/> | ||
80 | <exec executable="cp"> | ||
81 | <arg value="${basedir}/app/config/tests/parameters.yml.dist.pgsql"/> | ||
82 | <arg value="${basedir}/app/config/parameters.yml"/> | ||
83 | </exec> | ||
84 | |||
85 | <exec executable="php"> | ||
86 | <arg value="${basedir}/app/console"/> | ||
87 | <arg value="cache:clear"/> | ||
88 | <arg value="--env=test"/> | ||
89 | </exec> | ||
90 | </target> | ||
91 | |||
44 | <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage"> | 92 | <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage"> |
45 | <exec executable="phpunit" failonerror="true"> | 93 | <exec executable="phpunit" failonerror="true"> |
46 | <arg value="--coverage-html"/> | 94 | <arg value="--coverage-html"/> |
diff --git a/composer.json b/composer.json index 82fe61bd..babe9356 100644 --- a/composer.json +++ b/composer.json | |||
@@ -45,7 +45,7 @@ | |||
45 | "nelmio/api-doc-bundle": "~2.7", | 45 | "nelmio/api-doc-bundle": "~2.7", |
46 | "ezyang/htmlpurifier": "~4.6", | 46 | "ezyang/htmlpurifier": "~4.6", |
47 | "mgargano/simplehtmldom": "~1.5", | 47 | "mgargano/simplehtmldom": "~1.5", |
48 | "tecnick.com/tcpdf": "~6.2", | 48 | "tecnickcom/tcpdf": "~6.2", |
49 | "simplepie/simplepie": "~1.3.1", | 49 | "simplepie/simplepie": "~1.3.1", |
50 | "willdurand/hateoas-bundle": "~0.5.0", | 50 | "willdurand/hateoas-bundle": "~0.5.0", |
51 | "htmlawed/htmlawed": "~1.1.19", | 51 | "htmlawed/htmlawed": "~1.1.19", |
diff --git a/composer.lock b/composer.lock index ef060b5e..370d8ddd 100644 --- a/composer.lock +++ b/composer.lock | |||
@@ -4,7 +4,7 @@ | |||
4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | 4 | "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
5 | "This file is @generated automatically" | 5 | "This file is @generated automatically" |
6 | ], | 6 | ], |
7 | "hash": "d457fa385420eb29a177ac38eac977c3", | 7 | "hash": "350d05d95be50b6d93e8a046f784e00c", |
8 | "packages": [ | 8 | "packages": [ |
9 | { | 9 | { |
10 | "name": "doctrine/annotations", | 10 | "name": "doctrine/annotations", |
@@ -1355,16 +1355,16 @@ | |||
1355 | }, | 1355 | }, |
1356 | { | 1356 | { |
1357 | "name": "j0k3r/php-readability", | 1357 | "name": "j0k3r/php-readability", |
1358 | "version": "v1.0.7", | 1358 | "version": "v1.0.8", |
1359 | "source": { | 1359 | "source": { |
1360 | "type": "git", | 1360 | "type": "git", |
1361 | "url": "https://github.com/j0k3r/php-readability.git", | 1361 | "url": "https://github.com/j0k3r/php-readability.git", |
1362 | "reference": "1830dc45d4fccfe09d2d107ab59890f07adc35c4" | 1362 | "reference": "f71c3a419623f821c245e0a003edfbf2c67f278e" |
1363 | }, | 1363 | }, |
1364 | "dist": { | 1364 | "dist": { |
1365 | "type": "zip", | 1365 | "type": "zip", |
1366 | "url": "https://api.github.com/repos/j0k3r/php-readability/zipball/1830dc45d4fccfe09d2d107ab59890f07adc35c4", | 1366 | "url": "https://api.github.com/repos/j0k3r/php-readability/zipball/f71c3a419623f821c245e0a003edfbf2c67f278e", |
1367 | "reference": "1830dc45d4fccfe09d2d107ab59890f07adc35c4", | 1367 | "reference": "f71c3a419623f821c245e0a003edfbf2c67f278e", |
1368 | "shasum": "" | 1368 | "shasum": "" |
1369 | }, | 1369 | }, |
1370 | "require": { | 1370 | "require": { |
@@ -1414,7 +1414,7 @@ | |||
1414 | "extraction", | 1414 | "extraction", |
1415 | "html" | 1415 | "html" |
1416 | ], | 1416 | ], |
1417 | "time": "2015-09-20 19:05:55" | 1417 | "time": "2015-09-23 19:09:38" |
1418 | }, | 1418 | }, |
1419 | { | 1419 | { |
1420 | "name": "jdorn/sql-formatter", | 1420 | "name": "jdorn/sql-formatter", |
@@ -2970,20 +2970,20 @@ | |||
2970 | }, | 2970 | }, |
2971 | { | 2971 | { |
2972 | "name": "symfony/symfony", | 2972 | "name": "symfony/symfony", |
2973 | "version": "v2.7.4", | 2973 | "version": "v2.7.5", |
2974 | "source": { | 2974 | "source": { |
2975 | "type": "git", | 2975 | "type": "git", |
2976 | "url": "https://github.com/symfony/symfony.git", | 2976 | "url": "https://github.com/symfony/symfony.git", |
2977 | "reference": "1fdf23fe28876844b887b0e1935c9adda43ee645" | 2977 | "reference": "619528a274647cffc1792063c3ea04c4fa8266a0" |
2978 | }, | 2978 | }, |
2979 | "dist": { | 2979 | "dist": { |
2980 | "type": "zip", | 2980 | "type": "zip", |
2981 | "url": "https://api.github.com/repos/symfony/symfony/zipball/1fdf23fe28876844b887b0e1935c9adda43ee645", | 2981 | "url": "https://api.github.com/repos/symfony/symfony/zipball/619528a274647cffc1792063c3ea04c4fa8266a0", |
2982 | "reference": "1fdf23fe28876844b887b0e1935c9adda43ee645", | 2982 | "reference": "619528a274647cffc1792063c3ea04c4fa8266a0", |
2983 | "shasum": "" | 2983 | "shasum": "" |
2984 | }, | 2984 | }, |
2985 | "require": { | 2985 | "require": { |
2986 | "doctrine/common": "~2.3", | 2986 | "doctrine/common": "~2.4", |
2987 | "php": ">=5.3.9", | 2987 | "php": ">=5.3.9", |
2988 | "psr/log": "~1.0", | 2988 | "psr/log": "~1.0", |
2989 | "twig/twig": "~1.20|~2.0" | 2989 | "twig/twig": "~1.20|~2.0" |
@@ -3036,9 +3036,9 @@ | |||
3036 | }, | 3036 | }, |
3037 | "require-dev": { | 3037 | "require-dev": { |
3038 | "doctrine/data-fixtures": "1.0.*", | 3038 | "doctrine/data-fixtures": "1.0.*", |
3039 | "doctrine/dbal": "~2.2", | 3039 | "doctrine/dbal": "~2.4", |
3040 | "doctrine/doctrine-bundle": "~1.2", | 3040 | "doctrine/doctrine-bundle": "~1.2", |
3041 | "doctrine/orm": "~2.2,>=2.2.3", | 3041 | "doctrine/orm": "~2.4,>=2.4.5", |
3042 | "egulias/email-validator": "~1.2", | 3042 | "egulias/email-validator": "~1.2", |
3043 | "ircmaxell/password-compat": "~1.0", | 3043 | "ircmaxell/password-compat": "~1.0", |
3044 | "monolog/monolog": "~1.11", | 3044 | "monolog/monolog": "~1.11", |
@@ -3088,70 +3088,7 @@ | |||
3088 | "keywords": [ | 3088 | "keywords": [ |
3089 | "framework" | 3089 | "framework" |
3090 | ], | 3090 | ], |
3091 | "time": "2015-09-08 14:26:39" | 3091 | "time": "2015-09-25 11:16:52" |
3092 | }, | ||
3093 | { | ||
3094 | "name": "tecnick.com/tcpdf", | ||
3095 | "version": "6.2.11", | ||
3096 | "source": { | ||
3097 | "type": "git", | ||
3098 | "url": "https://github.com/tecnickcom/TCPDF.git", | ||
3099 | "reference": "354433a33946ae7497c3eab291eaaf814bccbfab" | ||
3100 | }, | ||
3101 | "dist": { | ||
3102 | "type": "zip", | ||
3103 | "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/354433a33946ae7497c3eab291eaaf814bccbfab", | ||
3104 | "reference": "354433a33946ae7497c3eab291eaaf814bccbfab", | ||
3105 | "shasum": "" | ||
3106 | }, | ||
3107 | "require": { | ||
3108 | "php": ">=5.3.0" | ||
3109 | }, | ||
3110 | "type": "library", | ||
3111 | "autoload": { | ||
3112 | "classmap": [ | ||
3113 | "fonts", | ||
3114 | "config", | ||
3115 | "include", | ||
3116 | "tcpdf.php", | ||
3117 | "tcpdf_parser.php", | ||
3118 | "tcpdf_import.php", | ||
3119 | "tcpdf_barcodes_1d.php", | ||
3120 | "tcpdf_barcodes_2d.php", | ||
3121 | "include/tcpdf_colors.php", | ||
3122 | "include/tcpdf_filters.php", | ||
3123 | "include/tcpdf_font_data.php", | ||
3124 | "include/tcpdf_fonts.php", | ||
3125 | "include/tcpdf_images.php", | ||
3126 | "include/tcpdf_static.php", | ||
3127 | "include/barcodes/datamatrix.php", | ||
3128 | "include/barcodes/pdf417.php", | ||
3129 | "include/barcodes/qrcode.php" | ||
3130 | ] | ||
3131 | }, | ||
3132 | "notification-url": "https://packagist.org/downloads/", | ||
3133 | "license": [ | ||
3134 | "LGPLv3" | ||
3135 | ], | ||
3136 | "authors": [ | ||
3137 | { | ||
3138 | "name": "Nicola Asuni", | ||
3139 | "email": "info@tecnick.com", | ||
3140 | "homepage": "http://nicolaasuni.tecnick.com" | ||
3141 | } | ||
3142 | ], | ||
3143 | "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", | ||
3144 | "homepage": "http://www.tcpdf.org/", | ||
3145 | "keywords": [ | ||
3146 | "PDFD32000-2008", | ||
3147 | "TCPDF", | ||
3148 | "barcodes", | ||
3149 | "datamatrix", | ||
3150 | "pdf", | ||
3151 | "pdf417", | ||
3152 | "qrcode" | ||
3153 | ], | ||
3154 | "time": "2015-08-02 12:30:27" | ||
3155 | }, | 3092 | }, |
3156 | { | 3093 | { |
3157 | "name": "tecnickcom/tcpdf", | 3094 | "name": "tecnickcom/tcpdf", |
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php index dd316194..7e64c5e1 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php | |||
@@ -17,6 +17,8 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
17 | { | 17 | { |
18 | $entry1 = new Entry($this->getReference('admin-user')); | 18 | $entry1 = new Entry($this->getReference('admin-user')); |
19 | $entry1->setUrl('http://0.0.0.0'); | 19 | $entry1->setUrl('http://0.0.0.0'); |
20 | $entry1->setReadingTime(11); | ||
21 | $entry1->setDomainName('domain.io'); | ||
20 | $entry1->setTitle('test title entry1'); | 22 | $entry1->setTitle('test title entry1'); |
21 | $entry1->setContent('This is my content /o/'); | 23 | $entry1->setContent('This is my content /o/'); |
22 | $entry1->setLanguage('en'); | 24 | $entry1->setLanguage('en'); |
@@ -27,6 +29,8 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
27 | 29 | ||
28 | $entry2 = new Entry($this->getReference('admin-user')); | 30 | $entry2 = new Entry($this->getReference('admin-user')); |
29 | $entry2->setUrl('http://0.0.0.0'); | 31 | $entry2->setUrl('http://0.0.0.0'); |
32 | $entry2->setReadingTime(1); | ||
33 | $entry2->setDomainName('domain.io'); | ||
30 | $entry2->setTitle('test title entry2'); | 34 | $entry2->setTitle('test title entry2'); |
31 | $entry2->setContent('This is my content /o/'); | 35 | $entry2->setContent('This is my content /o/'); |
32 | $entry2->setLanguage('fr'); | 36 | $entry2->setLanguage('fr'); |
@@ -37,6 +41,8 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
37 | 41 | ||
38 | $entry3 = new Entry($this->getReference('bob-user')); | 42 | $entry3 = new Entry($this->getReference('bob-user')); |
39 | $entry3->setUrl('http://0.0.0.0'); | 43 | $entry3->setUrl('http://0.0.0.0'); |
44 | $entry3->setReadingTime(1); | ||
45 | $entry3->setDomainName('domain.io'); | ||
40 | $entry3->setTitle('test title entry3'); | 46 | $entry3->setTitle('test title entry3'); |
41 | $entry3->setContent('This is my content /o/'); | 47 | $entry3->setContent('This is my content /o/'); |
42 | $entry3->setLanguage('en'); | 48 | $entry3->setLanguage('en'); |
@@ -55,6 +61,8 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
55 | 61 | ||
56 | $entry4 = new Entry($this->getReference('admin-user')); | 62 | $entry4 = new Entry($this->getReference('admin-user')); |
57 | $entry4->setUrl('http://0.0.0.0'); | 63 | $entry4->setUrl('http://0.0.0.0'); |
64 | $entry4->setReadingTime(12); | ||
65 | $entry4->setDomainName('domain.io'); | ||
58 | $entry4->setTitle('test title entry4'); | 66 | $entry4->setTitle('test title entry4'); |
59 | $entry4->setContent('This is my content /o/'); | 67 | $entry4->setContent('This is my content /o/'); |
60 | $entry4->setLanguage('en'); | 68 | $entry4->setLanguage('en'); |
@@ -73,10 +81,13 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
73 | 81 | ||
74 | $entry5 = new Entry($this->getReference('admin-user')); | 82 | $entry5 = new Entry($this->getReference('admin-user')); |
75 | $entry5->setUrl('http://0.0.0.0'); | 83 | $entry5->setUrl('http://0.0.0.0'); |
84 | $entry5->setReadingTime(12); | ||
85 | $entry5->setDomainName('domain.io'); | ||
76 | $entry5->setTitle('test title entry5'); | 86 | $entry5->setTitle('test title entry5'); |
77 | $entry5->setContent('This is my content /o/'); | 87 | $entry5->setContent('This is my content /o/'); |
78 | $entry5->setStarred(true); | 88 | $entry5->setStarred(true); |
79 | $entry5->setLanguage('fr'); | 89 | $entry5->setLanguage('fr'); |
90 | $entry5->setPreviewPicture('http://0.0.0.0/image.jpg'); | ||
80 | 91 | ||
81 | $manager->persist($entry5); | 92 | $manager->persist($entry5); |
82 | 93 | ||
@@ -84,6 +95,8 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface | |||
84 | 95 | ||
85 | $entry6 = new Entry($this->getReference('admin-user')); | 96 | $entry6 = new Entry($this->getReference('admin-user')); |
86 | $entry6->setUrl('http://0.0.0.0'); | 97 | $entry6->setUrl('http://0.0.0.0'); |
98 | $entry6->setReadingTime(12); | ||
99 | $entry6->setDomainName('domain.io'); | ||
87 | $entry6->setTitle('test title entry6'); | 100 | $entry6->setTitle('test title entry6'); |
88 | $entry6->setContent('This is my content /o/'); | 101 | $entry6->setContent('This is my content /o/'); |
89 | $entry6->setArchived(true); | 102 | $entry6->setArchived(true); |
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 7108889e..9e81ba12 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -7,7 +7,6 @@ use Doctrine\ORM\Mapping as ORM; | |||
7 | use Symfony\Component\Validator\Constraints as Assert; | 7 | use Symfony\Component\Validator\Constraints as Assert; |
8 | use Hateoas\Configuration\Annotation as Hateoas; | 8 | use Hateoas\Configuration\Annotation as Hateoas; |
9 | use JMS\Serializer\Annotation\XmlRoot; | 9 | use JMS\Serializer\Annotation\XmlRoot; |
10 | use Wallabag\CoreBundle\Tools\Utils; | ||
11 | 10 | ||
12 | /** | 11 | /** |
13 | * Entry. | 12 | * Entry. |
@@ -279,8 +278,6 @@ class Entry | |||
279 | public function setContent($content) | 278 | public function setContent($content) |
280 | { | 279 | { |
281 | $this->content = $content; | 280 | $this->content = $content; |
282 | $this->readingTime = Utils::getReadingTime($content); | ||
283 | $this->domainName = parse_url($this->url, PHP_URL_HOST); | ||
284 | 281 | ||
285 | return $this; | 282 | return $this; |
286 | } | 283 | } |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 3de8828f..7fb41393 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Helper; | |||
4 | 4 | ||
5 | use Graby\Graby; | 5 | use Graby\Graby; |
6 | use Wallabag\CoreBundle\Entity\Entry; | 6 | use Wallabag\CoreBundle\Entity\Entry; |
7 | use Wallabag\CoreBundle\Tools\Utils; | ||
7 | 8 | ||
8 | /** | 9 | /** |
9 | * This kind of proxy class take care of getting the content from an url | 10 | * This kind of proxy class take care of getting the content from an url |
@@ -51,6 +52,8 @@ class ContentProxy | |||
51 | $entry->setContent($html); | 52 | $entry->setContent($html); |
52 | $entry->setLanguage($content['language']); | 53 | $entry->setLanguage($content['language']); |
53 | $entry->setMimetype($content['content_type']); | 54 | $entry->setMimetype($content['content_type']); |
55 | $entry->setReadingTime(Utils::getReadingTime($html)); | ||
56 | $entry->setDomainName(parse_url($entry->getUrl(), PHP_URL_HOST)); | ||
54 | 57 | ||
55 | if (isset($content['open_graph']['og_image'])) { | 58 | if (isset($content['open_graph']['og_image'])) { |
56 | $entry->setPreviewPicture($content['open_graph']['og_image']); | 59 | $entry->setPreviewPicture($content['open_graph']['og_image']); |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 87b9befe..2286317c 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -161,4 +161,22 @@ class EntryRepository extends EntityRepository | |||
161 | 161 | ||
162 | return $languages; | 162 | return $languages; |
163 | } | 163 | } |
164 | |||
165 | /** | ||
166 | * Used only in test case to get the right entry associated to the right user | ||
167 | * | ||
168 | * @param string $username | ||
169 | * | ||
170 | * @return Entry | ||
171 | */ | ||
172 | public function findOneByUsernameAndNotArchived($username) | ||
173 | { | ||
174 | return $this->createQueryBuilder('e') | ||
175 | ->leftJoin('e.user', 'u') | ||
176 | ->where('u.username = :username')->setParameter('username', $username) | ||
177 | ->andWhere('e.isArchived = false') | ||
178 | ->setMaxResults(1) | ||
179 | ->getQuery() | ||
180 | ->getSingleResult(); | ||
181 | } | ||
164 | } | 182 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php index cbd84a97..e9c85a17 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php | |||
@@ -7,6 +7,8 @@ use Doctrine\ORM\AbstractQuery; | |||
7 | 7 | ||
8 | class EntryControllerTest extends WallabagCoreTestCase | 8 | class EntryControllerTest extends WallabagCoreTestCase |
9 | { | 9 | { |
10 | public $url = 'http://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'; | ||
11 | |||
10 | public function testLogin() | 12 | public function testLogin() |
11 | { | 13 | { |
12 | $client = $this->getClient(); | 14 | $client = $this->getClient(); |
@@ -60,7 +62,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
60 | $form = $crawler->filter('button[type=submit]')->form(); | 62 | $form = $crawler->filter('button[type=submit]')->form(); |
61 | 63 | ||
62 | $data = array( | 64 | $data = array( |
63 | 'entry[url]' => 'http://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', | 65 | 'entry[url]' => $this->url, |
64 | ); | 66 | ); |
65 | 67 | ||
66 | $client->submit($form, $data); | 68 | $client->submit($form, $data); |
@@ -101,7 +103,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
101 | $content = $client->getContainer() | 103 | $content = $client->getContainer() |
102 | ->get('doctrine.orm.entity_manager') | 104 | ->get('doctrine.orm.entity_manager') |
103 | ->getRepository('WallabagCoreBundle:Entry') | 105 | ->getRepository('WallabagCoreBundle:Entry') |
104 | ->findOneByIsArchived(false); | 106 | ->findOneByUrl($this->url); |
105 | 107 | ||
106 | $client->request('GET', '/view/'.$content->getId()); | 108 | $client->request('GET', '/view/'.$content->getId()); |
107 | 109 | ||
@@ -117,7 +119,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
117 | $content = $client->getContainer() | 119 | $content = $client->getContainer() |
118 | ->get('doctrine.orm.entity_manager') | 120 | ->get('doctrine.orm.entity_manager') |
119 | ->getRepository('WallabagCoreBundle:Entry') | 121 | ->getRepository('WallabagCoreBundle:Entry') |
120 | ->findOneByIsArchived(false); | 122 | ->findOneByUrl($this->url); |
121 | 123 | ||
122 | $crawler = $client->request('GET', '/edit/'.$content->getId()); | 124 | $crawler = $client->request('GET', '/edit/'.$content->getId()); |
123 | 125 | ||
@@ -135,7 +137,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
135 | $content = $client->getContainer() | 137 | $content = $client->getContainer() |
136 | ->get('doctrine.orm.entity_manager') | 138 | ->get('doctrine.orm.entity_manager') |
137 | ->getRepository('WallabagCoreBundle:Entry') | 139 | ->getRepository('WallabagCoreBundle:Entry') |
138 | ->findOneByIsArchived(false); | 140 | ->findOneByUrl($this->url); |
139 | 141 | ||
140 | $crawler = $client->request('GET', '/edit/'.$content->getId()); | 142 | $crawler = $client->request('GET', '/edit/'.$content->getId()); |
141 | 143 | ||
@@ -165,7 +167,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
165 | $content = $client->getContainer() | 167 | $content = $client->getContainer() |
166 | ->get('doctrine.orm.entity_manager') | 168 | ->get('doctrine.orm.entity_manager') |
167 | ->getRepository('WallabagCoreBundle:Entry') | 169 | ->getRepository('WallabagCoreBundle:Entry') |
168 | ->findOneByIsArchived(false); | 170 | ->findOneByUrl($this->url); |
169 | 171 | ||
170 | $client->request('GET', '/archive/'.$content->getId()); | 172 | $client->request('GET', '/archive/'.$content->getId()); |
171 | 173 | ||
@@ -174,7 +176,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
174 | $res = $client->getContainer() | 176 | $res = $client->getContainer() |
175 | ->get('doctrine.orm.entity_manager') | 177 | ->get('doctrine.orm.entity_manager') |
176 | ->getRepository('WallabagCoreBundle:Entry') | 178 | ->getRepository('WallabagCoreBundle:Entry') |
177 | ->findOneById($content->getId()); | 179 | ->find($content->getId()); |
178 | 180 | ||
179 | $this->assertEquals($res->isArchived(), true); | 181 | $this->assertEquals($res->isArchived(), true); |
180 | } | 182 | } |
@@ -187,7 +189,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
187 | $content = $client->getContainer() | 189 | $content = $client->getContainer() |
188 | ->get('doctrine.orm.entity_manager') | 190 | ->get('doctrine.orm.entity_manager') |
189 | ->getRepository('WallabagCoreBundle:Entry') | 191 | ->getRepository('WallabagCoreBundle:Entry') |
190 | ->findOneByIsStarred(false); | 192 | ->findOneByUrl($this->url); |
191 | 193 | ||
192 | $client->request('GET', '/star/'.$content->getId()); | 194 | $client->request('GET', '/star/'.$content->getId()); |
193 | 195 | ||
@@ -209,7 +211,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
209 | $content = $client->getContainer() | 211 | $content = $client->getContainer() |
210 | ->get('doctrine.orm.entity_manager') | 212 | ->get('doctrine.orm.entity_manager') |
211 | ->getRepository('WallabagCoreBundle:Entry') | 213 | ->getRepository('WallabagCoreBundle:Entry') |
212 | ->findOneByIsStarred(false); | 214 | ->findOneByUrl($this->url); |
213 | 215 | ||
214 | $client->request('GET', '/delete/'.$content->getId()); | 216 | $client->request('GET', '/delete/'.$content->getId()); |
215 | 217 | ||
@@ -222,21 +224,15 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
222 | 224 | ||
223 | public function testViewOtherUserEntry() | 225 | public function testViewOtherUserEntry() |
224 | { | 226 | { |
225 | $this->logInAs('bob'); | 227 | $this->logInAs('admin'); |
226 | $client = $this->getClient(); | 228 | $client = $this->getClient(); |
227 | 229 | ||
228 | $content = $client->getContainer() | 230 | $content = $client->getContainer() |
229 | ->get('doctrine.orm.entity_manager') | 231 | ->get('doctrine.orm.entity_manager') |
230 | ->getRepository('WallabagCoreBundle:Entry') | 232 | ->getRepository('WallabagCoreBundle:Entry') |
231 | ->createQueryBuilder('e') | 233 | ->findOneByUsernameAndNotArchived('bob'); |
232 | ->select('e.id') | ||
233 | ->leftJoin('e.user', 'u') | ||
234 | ->where('u.username != :username')->setParameter('username', 'bob') | ||
235 | ->setMaxResults(1) | ||
236 | ->getQuery() | ||
237 | ->getSingleResult(AbstractQuery::HYDRATE_ARRAY); | ||
238 | 234 | ||
239 | $client->request('GET', '/view/'.$content['id']); | 235 | $client->request('GET', '/view/'.$content->getId()); |
240 | 236 | ||
241 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); | 237 | $this->assertEquals(403, $client->getResponse()->getStatusCode()); |
242 | } | 238 | } |
@@ -334,11 +330,11 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
334 | $crawler = $client->request('GET', '/unread/list'); | 330 | $crawler = $client->request('GET', '/unread/list'); |
335 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 331 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
336 | $data = array( | 332 | $data = array( |
337 | 'entry_filter[domainName]' => 'monde', | 333 | 'entry_filter[domainName]' => 'domain', |
338 | ); | 334 | ); |
339 | 335 | ||
340 | $crawler = $client->submit($form, $data); | 336 | $crawler = $client->submit($form, $data); |
341 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 337 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
342 | 338 | ||
343 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 339 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
344 | $data = array( | 340 | $data = array( |
@@ -360,14 +356,14 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
360 | $form['entry_filter[isStarred]']->untick(); | 356 | $form['entry_filter[isStarred]']->untick(); |
361 | 357 | ||
362 | $crawler = $client->submit($form); | 358 | $crawler = $client->submit($form); |
363 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 359 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
364 | 360 | ||
365 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 361 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
366 | $form['entry_filter[isArchived]']->untick(); | 362 | $form['entry_filter[isArchived]']->untick(); |
367 | $form['entry_filter[isStarred]']->tick(); | 363 | $form['entry_filter[isStarred]']->tick(); |
368 | 364 | ||
369 | $crawler = $client->submit($form); | 365 | $crawler = $client->submit($form); |
370 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 366 | $this->assertCount(1, $crawler->filter('div[class=entry]')); |
371 | } | 367 | } |
372 | 368 | ||
373 | public function testPreviewPictureFilter() | 369 | public function testPreviewPictureFilter() |
@@ -391,11 +387,11 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
391 | $crawler = $client->request('GET', '/unread/list'); | 387 | $crawler = $client->request('GET', '/unread/list'); |
392 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 388 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
393 | $data = array( | 389 | $data = array( |
394 | 'entry_filter[language]' => 'de', | 390 | 'entry_filter[language]' => 'fr', |
395 | ); | 391 | ); |
396 | 392 | ||
397 | $crawler = $client->submit($form, $data); | 393 | $crawler = $client->submit($form, $data); |
398 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 394 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
399 | 395 | ||
400 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 396 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
401 | $data = array( | 397 | $data = array( |
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php index d25b2db5..dc93dd6b 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php | |||
@@ -24,7 +24,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
24 | $entry = $client->getContainer() | 24 | $entry = $client->getContainer() |
25 | ->get('doctrine.orm.entity_manager') | 25 | ->get('doctrine.orm.entity_manager') |
26 | ->getRepository('WallabagCoreBundle:Entry') | 26 | ->getRepository('WallabagCoreBundle:Entry') |
27 | ->findOneBy(array()); | 27 | ->findOneByUsernameAndNotArchived('admin'); |
28 | 28 | ||
29 | $crawler = $client->request('GET', '/view/'.$entry->getId()); | 29 | $crawler = $client->request('GET', '/view/'.$entry->getId()); |
30 | 30 | ||
@@ -46,7 +46,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
46 | $newEntry = $client->getContainer() | 46 | $newEntry = $client->getContainer() |
47 | ->get('doctrine.orm.entity_manager') | 47 | ->get('doctrine.orm.entity_manager') |
48 | ->getRepository('WallabagCoreBundle:Entry') | 48 | ->getRepository('WallabagCoreBundle:Entry') |
49 | ->findOneById($entry->getId()); | 49 | ->find($entry->getId()); |
50 | 50 | ||
51 | $this->assertEquals(1, count($newEntry->getTags())); | 51 | $this->assertEquals(1, count($newEntry->getTags())); |
52 | 52 | ||
@@ -61,7 +61,7 @@ class TagControllerTest extends WallabagCoreTestCase | |||
61 | $newEntry = $client->getContainer() | 61 | $newEntry = $client->getContainer() |
62 | ->get('doctrine.orm.entity_manager') | 62 | ->get('doctrine.orm.entity_manager') |
63 | ->getRepository('WallabagCoreBundle:Entry') | 63 | ->getRepository('WallabagCoreBundle:Entry') |
64 | ->findOneById($entry->getId()); | 64 | ->find($entry->getId()); |
65 | 65 | ||
66 | $this->assertEquals(2, count($newEntry->getTags())); | 66 | $this->assertEquals(2, count($newEntry->getTags())); |
67 | } | 67 | } |
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php index 30065d6b..0d338389 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php | |||
@@ -35,6 +35,8 @@ class ContentProxyTest extends KernelTestCase | |||
35 | $this->assertEmpty($entry->getPreviewPicture()); | 35 | $this->assertEmpty($entry->getPreviewPicture()); |
36 | $this->assertEmpty($entry->getMimetype()); | 36 | $this->assertEmpty($entry->getMimetype()); |
37 | $this->assertEmpty($entry->getLanguage()); | 37 | $this->assertEmpty($entry->getLanguage()); |
38 | $this->assertEquals(0.0, $entry->getReadingTime()); | ||
39 | $this->assertEquals('0.0.0.0', $entry->getDomainName()); | ||
38 | } | 40 | } |
39 | 41 | ||
40 | public function testWithEmptyContentButOG() | 42 | public function testWithEmptyContentButOG() |
@@ -59,14 +61,16 @@ class ContentProxyTest extends KernelTestCase | |||
59 | )); | 61 | )); |
60 | 62 | ||
61 | $proxy = new ContentProxy($graby); | 63 | $proxy = new ContentProxy($graby); |
62 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); | 64 | $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); |
63 | 65 | ||
64 | $this->assertEquals('http://0.0.0.0', $entry->getUrl()); | 66 | $this->assertEquals('http://domain.io', $entry->getUrl()); |
65 | $this->assertEquals('my title', $entry->getTitle()); | 67 | $this->assertEquals('my title', $entry->getTitle()); |
66 | $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); | 68 | $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); |
67 | $this->assertEmpty($entry->getPreviewPicture()); | 69 | $this->assertEmpty($entry->getPreviewPicture()); |
68 | $this->assertEmpty($entry->getLanguage()); | 70 | $this->assertEmpty($entry->getLanguage()); |
69 | $this->assertEmpty($entry->getMimetype()); | 71 | $this->assertEmpty($entry->getMimetype()); |
72 | $this->assertEquals(0.0, $entry->getReadingTime()); | ||
73 | $this->assertEquals('domain.io', $entry->getDomainName()); | ||
70 | } | 74 | } |
71 | 75 | ||
72 | public function testWithContent() | 76 | public function testWithContent() |
@@ -79,7 +83,7 @@ class ContentProxyTest extends KernelTestCase | |||
79 | $graby->expects($this->any()) | 83 | $graby->expects($this->any()) |
80 | ->method('fetchContent') | 84 | ->method('fetchContent') |
81 | ->willReturn(array( | 85 | ->willReturn(array( |
82 | 'html' => 'this is my content', | 86 | 'html' => str_repeat('this is my content', 325), |
83 | 'title' => 'this is my title', | 87 | 'title' => 'this is my title', |
84 | 'url' => 'http://1.1.1.1', | 88 | 'url' => 'http://1.1.1.1', |
85 | 'content_type' => 'text/html', | 89 | 'content_type' => 'text/html', |
@@ -96,9 +100,11 @@ class ContentProxyTest extends KernelTestCase | |||
96 | 100 | ||
97 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); | 101 | $this->assertEquals('http://1.1.1.1', $entry->getUrl()); |
98 | $this->assertEquals('this is my title', $entry->getTitle()); | 102 | $this->assertEquals('this is my title', $entry->getTitle()); |
99 | $this->assertEquals('this is my content', $entry->getContent()); | 103 | $this->assertContains('this is my content', $entry->getContent()); |
100 | $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); | 104 | $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); |
101 | $this->assertEquals('text/html', $entry->getMimetype()); | 105 | $this->assertEquals('text/html', $entry->getMimetype()); |
102 | $this->assertEquals('fr', $entry->getLanguage()); | 106 | $this->assertEquals('fr', $entry->getLanguage()); |
107 | $this->assertEquals(4.0, $entry->getReadingTime()); | ||
108 | $this->assertEquals('1.1.1.1', $entry->getDomainName()); | ||
103 | } | 109 | } |
104 | } | 110 | } |