Fix tests & cs & migration

This commit is contained in:
Jeremy Benoist 2019-04-25 14:12:56 +02:00
parent 531c8d0a5c
commit f277bc042c
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
14 changed files with 126 additions and 69 deletions

View file

@ -0,0 +1,58 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Rename rss_token & rss_limit to feed_token & feed_limit.
*/
final class Version20190425115043 extends WallabagMigration
{
public function up(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX UNIQ_87E64C53A76ED395');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM ' . $this->getTable('config', true));
$this->addSql('DROP TABLE ' . $this->getTable('config', true));
$this->addSql('CREATE TABLE ' . $this->getTable('config', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL COLLATE BINARY, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL COLLATE BINARY, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL COLLATE BINARY, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, feed_token VARCHAR(255) DEFAULT NULL, feed_limit INTEGER DEFAULT NULL, CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('config', true) . ' (id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('config', true));
$this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_token feed_token VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_limit feed_limit INT DEFAULT NULL');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_token TO feed_token');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_limit TO feed_limit');
break;
}
}
public function down(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX UNIQ_87E64C53A76ED395');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM "' . $this->getTable('config', true) . '"');
$this->addSql('DROP TABLE "' . $this->getTable('config', true) . '"');
$this->addSql('CREATE TABLE "' . $this->getTable('config', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, rss_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, rss_limit INTEGER DEFAULT NULL)');
$this->addSql('INSERT INTO "' . $this->getTable('config', true) . '" (id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('config', true));
$this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "' . $this->getTable('config', true) . '" (user_id)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_token rss_token');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_limit rss_limit');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_token TO rss_token');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_limit TO rss_limit');
break;
}
}
}

View file

@ -254,7 +254,7 @@ class InstallCommand extends ContainerAwareCommand
$question->setHidden(true); $question->setHidden(true);
$user->setPlainPassword($this->io->askQuestion($question)); $user->setPlainPassword($this->io->askQuestion($question));
$user->setEmail($this->io->ask('Email', '')); $user->setEmail($this->io->ask('Email', 'wallabag@wallabag.io'));
$user->setEnabled(true); $user->setEnabled(true);
$user->addRole('ROLE_SUPER_ADMIN'); $user->addRole('ROLE_SUPER_ADMIN');

View file

@ -8,7 +8,6 @@ use Pagerfanta\Exception\OutOfRangeCurrentPageException;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
@ -20,8 +19,8 @@ class FeedController extends Controller
/** /**
* Shows unread entries for current user. * Shows unread entries for current user.
* *
* @Route("/feed/{username}/{token}/unread/{page}", name="unread_feed", defaults={"page": 1}) * @Route("/feed/{username}/{token}/unread/{page}", name="unread_feed", defaults={"page"=1, "_format"="xml"})
* @Route("/{username}/{token}/unread.xml", defaults={"page": 1}) *
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
* *
* @param User $user * @param User $user
@ -37,8 +36,8 @@ class FeedController extends Controller
/** /**
* Shows read entries for current user. * Shows read entries for current user.
* *
* @Route("/feed/{username}/{token}/archive/{page}", name="archive_feed", defaults={"page": 1}) * @Route("/feed/{username}/{token}/archive/{page}", name="archive_feed", defaults={"page"=1, "_format"="xml"})
* @Route("/{username}/{token}/archive.xml", defaults={"page": 1}) *
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
* *
* @param User $user * @param User $user
@ -54,8 +53,8 @@ class FeedController extends Controller
/** /**
* Shows starred entries for current user. * Shows starred entries for current user.
* *
* @Route("/feed/{username}/{token}/starred/{page}", name="starred_feed", defaults={"page": 1}) * @Route("/feed/{username}/{token}/starred/{page}", name="starred_feed", defaults={"page"=1, "_format"="xml"})
* @Route("/{username}/{token}/starred.xml", defaults={"page": 1}) *
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
* *
* @param User $user * @param User $user
@ -71,29 +70,29 @@ class FeedController extends Controller
/** /**
* Shows all entries for current user. * Shows all entries for current user.
* *
* @Route("/{username}/{token}/all.xml", name="all_feed", defaults={"_format"="xml"}) * @Route("/feed/{username}/{token}/all/{page}", name="all_feed", defaults={"page"=1, "_format"="xml"})
*
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function showAllFeedAction(Request $request, User $user) public function showAllFeedAction(User $user, $page)
{ {
return $this->showEntries('all', $user, $request->query->get('page', 1)); return $this->showEntries('all', $user, $page);
} }
/** /**
* Shows entries associated to a tag for current user. * Shows entries associated to a tag for current user.
* *
* @Route("/{username}/{token}/tags/{slug}.xml", name="tag_feed", defaults={"_format"="xml"}) * @Route("/feed/{username}/{token}/tags/{slug}/{page}", name="tag_feed", defaults={"page"=1, "_format"="xml"})
*
* @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter")
* @ParamConverter("tag", options={"mapping": {"slug": "slug"}}) * @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
* *
* @return \Symfony\Component\HttpFoundation\Response * @return \Symfony\Component\HttpFoundation\Response
*/ */
public function showTagsFeedAction(Request $request, User $user, Tag $tag) public function showTagsFeedAction(User $user, Tag $tag, $page)
{ {
$page = $request->query->get('page', 1);
$url = $this->generateUrl( $url = $this->generateUrl(
'tag_feed', 'tag_feed',
[ [

View file

@ -60,14 +60,14 @@ class Config
/** /**
* @var string * @var string
* *
* @ORM\Column(name="rss_token", type="string", nullable=true) * @ORM\Column(name="feed_token", type="string", nullable=true)
*/ */
private $feedToken; private $feedToken;
/** /**
* @var int * @var int
* *
* @ORM\Column(name="rss_limit", type="integer", nullable=true) * @ORM\Column(name="feed_limit", type="integer", nullable=true)
* @Assert\Range( * @Assert\Range(
* min = 1, * min = 1,
* max = 100000, * max = 100000,

View file

@ -53,7 +53,7 @@ config:
page_title: 'Настройки' page_title: 'Настройки'
tab_menu: tab_menu:
settings: 'Настройки' settings: 'Настройки'
rss: 'RSS' feed: 'RSS'
user_info: 'Информация о пользователе' user_info: 'Информация о пользователе'
password: 'Пароль' password: 'Пароль'
rules: 'Правила настройки простановки тегов' rules: 'Правила настройки простановки тегов'
@ -83,18 +83,18 @@ config:
help_reading_speed: "wallabag посчитает сколько времени занимает чтение каждой записи. Вы можете определить здесь, как быстро вы читаете. wallabag пересчитает время чтения для каждой записи." help_reading_speed: "wallabag посчитает сколько времени занимает чтение каждой записи. Вы можете определить здесь, как быстро вы читаете. wallabag пересчитает время чтения для каждой записи."
help_language: "Вы можете изменить язык интерфейса wallabag." help_language: "Вы можете изменить язык интерфейса wallabag."
help_pocket_consumer_key: "Обязательно для импорта из Pocket. Вы можете создать это в Вашем аккаунте на Pocket." help_pocket_consumer_key: "Обязательно для импорта из Pocket. Вы можете создать это в Вашем аккаунте на Pocket."
form_rss: form_feed:
description: 'RSS фид созданный с помощью wallabag позволяет читать Ваши записи через Ваш любимый RSS агрегатор. Для начала Вам потребуется создать ключ.' description: 'RSS фид созданный с помощью wallabag позволяет читать Ваши записи через Ваш любимый RSS агрегатор. Для начала Вам потребуется создать ключ.'
token_label: 'RSS ключ' token_label: 'RSS ключ'
no_token: 'Ключ не задан' no_token: 'Ключ не задан'
token_create: 'Создать ключ' token_create: 'Создать ключ'
token_reset: 'Пересоздать ключ' token_reset: 'Пересоздать ключ'
rss_links: 'ссылка на RSS' feed_links: 'ссылка на RSS'
rss_link: feed_link:
unread: 'непрочитанные' unread: 'непрочитанные'
starred: 'помеченные' starred: 'помеченные'
archive: 'архивные' archive: 'архивные'
rss_limit: 'Количество записей в фиде' feed_limit: 'Количество записей в фиде'
form_user: form_user:
# two_factor_description: "Enabling two factor authentication means you'll receive an email with a code OR need to use an OTP app (like Google Authenticator, Authy or FreeOTP) to get a one time code on every new untrusted connection. You can't choose both option." # two_factor_description: "Enabling two factor authentication means you'll receive an email with a code OR need to use an OTP app (like Google Authenticator, Authy or FreeOTP) to get a one time code on every new untrusted connection. You can't choose both option."
name_label: 'Имя' name_label: 'Имя'
@ -359,7 +359,7 @@ quickstart:
title: 'Настроить приложение' title: 'Настроить приложение'
description: 'Чтобы иметь приложение, которое вам подходит, ознакомьтесь с конфигурацией wallabag.' description: 'Чтобы иметь приложение, которое вам подходит, ознакомьтесь с конфигурацией wallabag.'
language: 'Выбрать язык и дизайн' language: 'Выбрать язык и дизайн'
rss: 'Включить RSS фид' feed: 'Включить RSS фид'
tagging_rules: 'Создать правило для автоматической установки тегов' tagging_rules: 'Создать правило для автоматической установки тегов'
admin: admin:
title: 'Администрирование' title: 'Администрирование'
@ -554,10 +554,10 @@ flashes:
password_updated: 'Пароль обновлен' password_updated: 'Пароль обновлен'
password_not_updated_demo: "В режиме демонстрации нельзя изменять пароль для этого пользователя." password_not_updated_demo: "В режиме демонстрации нельзя изменять пароль для этого пользователя."
user_updated: 'Информация обновлена' user_updated: 'Информация обновлена'
rss_updated: 'RSS информация обновлена' feed_updated: 'RSS информация обновлена'
tagging_rules_updated: 'Правила тегировния обновлены' tagging_rules_updated: 'Правила тегировния обновлены'
tagging_rules_deleted: 'Правила тегировния удалены' tagging_rules_deleted: 'Правила тегировния удалены'
rss_token_updated: 'RSS ключ обновлен' feed_token_updated: 'RSS ключ обновлен'
annotations_reset: "Аннотации сброшены" annotations_reset: "Аннотации сброшены"
tags_reset: "Теги сброшены" tags_reset: "Теги сброшены"
entries_reset: "Записи сброшены" entries_reset: "Записи сброшены"

View file

@ -54,7 +54,7 @@ config:
page_title: 'กำหนดค่า' page_title: 'กำหนดค่า'
tab_menu: tab_menu:
settings: 'ตั้งค่า' settings: 'ตั้งค่า'
rss: 'RSS' feed: 'RSS'
user_info: 'ข้อมูลผู้ใช้' user_info: 'ข้อมูลผู้ใช้'
password: 'รหัสผ่าน' password: 'รหัสผ่าน'
rules: 'การแท็กข้อบังคับ' rules: 'การแท็กข้อบังคับ'
@ -85,19 +85,19 @@ config:
help_reading_speed: "wallabag จะคำนวณเวลาการอ่านในแต่ละรายการซึ่งคุณสามารถกำหนดได้ที่นี้,ต้องขอบคุณรายการนี้,หากคุณเป็นนักอ่านที่เร็วหรือช้า wallabag จะทำการคำนวณเวลาที่อ่านใหม่ในแต่ละรายการ" help_reading_speed: "wallabag จะคำนวณเวลาการอ่านในแต่ละรายการซึ่งคุณสามารถกำหนดได้ที่นี้,ต้องขอบคุณรายการนี้,หากคุณเป็นนักอ่านที่เร็วหรือช้า wallabag จะทำการคำนวณเวลาที่อ่านใหม่ในแต่ละรายการ"
help_language: "คุณสามารถเปลี่ยภาษาของ wallabag interface ได้" help_language: "คุณสามารถเปลี่ยภาษาของ wallabag interface ได้"
help_pocket_consumer_key: "การ้องขอการเก็บการนำข้อมูลเข้า คุณสามารถสร้างบัญชีการเก็บของคุณ" help_pocket_consumer_key: "การ้องขอการเก็บการนำข้อมูลเข้า คุณสามารถสร้างบัญชีการเก็บของคุณ"
form_rss: form_feed:
description: 'RSS จะเก็บเงื่อนไขโดย wallabag ต้องยอมรับการอ่านรายการของคุณกับผู้อ่านที่ชอบ RSS คุณต้องทำเครื่องหมายก่อน' description: 'RSS จะเก็บเงื่อนไขโดย wallabag ต้องยอมรับการอ่านรายการของคุณกับผู้อ่านที่ชอบ RSS คุณต้องทำเครื่องหมายก่อน'
token_label: 'เครื่องหมาย RSS' token_label: 'เครื่องหมาย RSS'
no_token: 'ไม่มีเครื่องหมาย' no_token: 'ไม่มีเครื่องหมาย'
token_create: 'สร้างเครื่องหมาย' token_create: 'สร้างเครื่องหมาย'
token_reset: 'ทำเครื่องหมาย' token_reset: 'ทำเครื่องหมาย'
rss_links: 'ลิงค์ RSS' feed_links: 'ลิงค์ RSS'
rss_link: feed_link:
unread: 'ยังไมได้่อ่าน' unread: 'ยังไมได้่อ่าน'
starred: 'ทำการแสดง' starred: 'ทำการแสดง'
archive: 'เอกสาร' archive: 'เอกสาร'
all: 'ทั้งหมด' all: 'ทั้งหมด'
rss_limit: 'จำนวนไอเทมที่เก็บ' feed_limit: 'จำนวนไอเทมที่เก็บ'
form_user: form_user:
# two_factor_description: "Enabling two factor authentication means you'll receive an email with a code OR need to use an OTP app (like Google Authenticator, Authy or FreeOTP) to get a one time code on every new untrusted connection. You can't choose both option." # two_factor_description: "Enabling two factor authentication means you'll receive an email with a code OR need to use an OTP app (like Google Authenticator, Authy or FreeOTP) to get a one time code on every new untrusted connection. You can't choose both option."
name_label: 'ชื่อ' name_label: 'ชื่อ'
@ -369,7 +369,7 @@ quickstart:
title: 'กำหนดค่าแอพพลิเคชั่น' title: 'กำหนดค่าแอพพลิเคชั่น'
description: 'ภายใน order จะมี application suit ของคุณ, จะมองหาองค์ประกอบของ wallabag' description: 'ภายใน order จะมี application suit ของคุณ, จะมองหาองค์ประกอบของ wallabag'
language: 'เปลี่ยนภาษาและออกแบบ' language: 'เปลี่ยนภาษาและออกแบบ'
rss: 'เปิดใช้ RSS' feed: 'เปิดใช้ RSS'
tagging_rules: 'เขียนข้อบังคับการแท็กอัตโนมัติของบทความของคุณ' tagging_rules: 'เขียนข้อบังคับการแท็กอัตโนมัติของบทความของคุณ'
admin: admin:
title: 'ผู้ดูแลระบบ' title: 'ผู้ดูแลระบบ'
@ -586,10 +586,10 @@ flashes:
password_updated: 'อัปเดตรหัสผ่าน' password_updated: 'อัปเดตรหัสผ่าน'
password_not_updated_demo: "In demonstration mode, you can't change password for this user." password_not_updated_demo: "In demonstration mode, you can't change password for this user."
user_updated: 'อัปเดตข้อมูล' user_updated: 'อัปเดตข้อมูล'
rss_updated: 'อัปเดตข้อมูล RSS' feed_updated: 'อัปเดตข้อมูล RSS'
tagging_rules_updated: 'อัปเดตการแท็กข้อบังคับ' tagging_rules_updated: 'อัปเดตการแท็กข้อบังคับ'
tagging_rules_deleted: 'การลบข้อบังคับของแท็ก' tagging_rules_deleted: 'การลบข้อบังคับของแท็ก'
rss_token_updated: 'อัปเดตเครื่องหมาย RSS ' feed_token_updated: 'อัปเดตเครื่องหมาย RSS '
annotations_reset: รีเซ็ตหมายเหตุ annotations_reset: รีเซ็ตหมายเหตุ
tags_reset: รีเซ็ตแท็ก tags_reset: รีเซ็ตแท็ก
entries_reset: รีเซ็ตรายการ entries_reset: รีเซ็ตรายการ

View file

@ -21,7 +21,7 @@
<i class="material-icons">mode_edit</i> <i class="material-icons">mode_edit</i>
</a> </a>
{% endif %} {% endif %}
{% if app.user.config.rssToken %} {% if app.user.config.feedToken %}
<a rel="alternate" type="application/atom+xml" href="{{ path('tag_feed', {'username': app.user.username, 'token': app.user.config.feedToken, 'slug': tag.slug}) }}" class="right"> <a rel="alternate" type="application/atom+xml" href="{{ path('tag_feed', {'username': app.user.username, 'token': app.user.config.feedToken, 'slug': tag.slug}) }}" class="right">
<i class="material-icons md-24">rss_feed</i> <i class="material-icons md-24">rss_feed</i>
</a> </a>

View file

@ -25,7 +25,7 @@
<i class="material-icons">mode_edit</i> <i class="material-icons">mode_edit</i>
</a> </a>
{% endif %} {% endif %}
{% if app.user.config.rssToken %} {% if app.user.config.feedToken %}
<a rel="alternate" type="application/atom+xml" href="{{ path('tag_feed', {'username': app.user.username, 'token': app.user.config.feedToken, 'slug': tag.slug}) }}" class="card-tag-rss"><i class="material-icons">rss_feed</i></a> <a rel="alternate" type="application/atom+xml" href="{{ path('tag_feed', {'username': app.user.username, 'token': app.user.config.feedToken, 'slug': tag.slug}) }}" class="card-tag-rss"><i class="material-icons">rss_feed</i></a>
{% endif %} {% endif %}
</li> </li>

View file

@ -54,7 +54,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
public function removeSchemeAndWww($url) public function removeSchemeAndWww($url)
{ {
return $this->removeWww($this->removeScheme($url) return $this->removeWww($this->removeScheme($url));
} }
/** /**

View file

@ -14,7 +14,7 @@ class UserRepository extends EntityRepository
* @param string $username * @param string $username
* @param string $feedToken * @param string $feedToken
* *
* @return null|User * @return User|null
*/ */
public function findOneByUsernameAndFeedtoken($username, $feedToken) public function findOneByUsernameAndFeedtoken($username, $feedToken)
{ {

View file

@ -166,7 +166,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertSame($this->url, $content->getUrl()); $this->assertSame($this->url, $content->getUrl());
$this->assertContains('Google', $content->getTitle()); $this->assertContains('Google', $content->getTitle());
$this->assertSame('fr', $content->getLanguage()); $this->assertSame('fr', $content->getLanguage());
$this->assertSame('2016-04-07 19:01:35', $content->getPublishedAt()->format('Y-m-d H:i:s')); $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s'));
$this->assertArrayHasKey('x-frame-options', $content->getHeaders()); $this->assertArrayHasKey('x-frame-options', $content->getHeaders());
$client->getContainer()->get('craue_config')->set('store_article_headers', 0); $client->getContainer()->get('craue_config')->set('store_article_headers', 0);
} }

View file

@ -11,48 +11,48 @@ class FeedControllerTest extends WallabagCoreTestCase
$doc = new \DOMDocument(); $doc = new \DOMDocument();
$doc->loadXML($xml); $doc->loadXML($xml);
$xpath = new \DOMXpath($doc); $xpath = new \DOMXPath($doc);
$xpath->registerNamespace('a', 'http://www.w3.org/2005/Atom'); $xpath->registerNamespace('a', 'http://www.w3.org/2005/Atom');
if (null === $nb) { if (null === $nb) {
$this->assertGreaterThan(0, $xpath->query('//a:entry')->length); $this->assertGreaterThan(0, $xpath->query('//a:entry')->length);
} else { } else {
$this->assertEquals($nb, $xpath->query('//a:entry')->length); $this->assertSame($nb, $xpath->query('//a:entry')->length);
} }
$this->assertEquals(1, $xpath->query('/a:feed')->length); $this->assertSame(1, $xpath->query('/a:feed')->length);
$this->assertEquals(1, $xpath->query('/a:feed/a:title')->length); $this->assertSame(1, $xpath->query('/a:feed/a:title')->length);
$this->assertContains('favicon.ico', $xpath->query('/a:feed/a:icon')->item(0)->nodeValue); $this->assertContains('favicon.ico', $xpath->query('/a:feed/a:icon')->item(0)->nodeValue);
$this->assertContains('logo-square.png', $xpath->query('/a:feed/a:logo')->item(0)->nodeValue); $this->assertContains('logo-square.png', $xpath->query('/a:feed/a:logo')->item(0)->nodeValue);
$this->assertEquals(1, $xpath->query('/a:feed/a:updated')->length); $this->assertSame(1, $xpath->query('/a:feed/a:updated')->length);
$this->assertEquals(1, $xpath->query('/a:feed/a:generator')->length); $this->assertSame(1, $xpath->query('/a:feed/a:generator')->length);
$this->assertEquals('wallabag', $xpath->query('/a:feed/a:generator')->item(0)->nodeValue); $this->assertSame('wallabag', $xpath->query('/a:feed/a:generator')->item(0)->nodeValue);
$this->assertEquals('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue); $this->assertSame('admin', $xpath->query('/a:feed/a:author/a:name')->item(0)->nodeValue);
$this->assertEquals(1, $xpath->query('/a:feed/a:subtitle')->length); $this->assertSame(1, $xpath->query('/a:feed/a:subtitle')->length);
if (null !== $tagValue && 0 === strpos($type, 'tag')) { if (null !== $tagValue && 0 === strpos($type, 'tag')) {
$this->assertEquals('wallabag — '.$type.' '.$tagValue.' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue); $this->assertSame('wallabag — ' . $type . ' ' . $tagValue . ' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
$this->assertEquals('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue); $this->assertSame('Atom feed for entries tagged with ' . $tagValue, $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
} else { } else {
$this->assertEquals('wallabag — '.$type.' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue); $this->assertSame('wallabag — ' . $type . ' feed', $xpath->query('/a:feed/a:title')->item(0)->nodeValue);
$this->assertEquals('Atom feed for ' . $type . ' entries', $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue); $this->assertSame('Atom feed for ' . $type . ' entries', $xpath->query('/a:feed/a:subtitle')->item(0)->nodeValue);
} }
$this->assertEquals(1, $xpath->query('/a:feed/a:link[@rel="self"]')->length); $this->assertSame(1, $xpath->query('/a:feed/a:link[@rel="self"]')->length);
$this->assertContains($type, $xpath->query('/a:feed/a:link[@rel="self"]')->item(0)->getAttribute('href')); $this->assertContains($type, $xpath->query('/a:feed/a:link[@rel="self"]')->item(0)->getAttribute('href'));
$this->assertEquals(1, $xpath->query('/a:feed/a:link[@rel="last"]')->length); $this->assertSame(1, $xpath->query('/a:feed/a:link[@rel="last"]')->length);
foreach ($xpath->query('//a:entry') as $item) { foreach ($xpath->query('//a:entry') as $item) {
$this->assertEquals(1, $xpath->query('a:title', $item)->length); $this->assertSame(1, $xpath->query('a:title', $item)->length);
$this->assertEquals(1, $xpath->query('a:link[@rel="via"]', $item)->length); $this->assertSame(1, $xpath->query('a:link[@rel="via"]', $item)->length);
$this->assertEquals(1, $xpath->query('a:link[@rel="alternate"]', $item)->length); $this->assertSame(1, $xpath->query('a:link[@rel="alternate"]', $item)->length);
$this->assertEquals(1, $xpath->query('a:id', $item)->length); $this->assertSame(1, $xpath->query('a:id', $item)->length);
$this->assertEquals(1, $xpath->query('a:published', $item)->length); $this->assertSame(1, $xpath->query('a:published', $item)->length);
$this->assertEquals(1, $xpath->query('a:content', $item)->length); $this->assertSame(1, $xpath->query('a:content', $item)->length);
} }
} }
@ -190,15 +190,15 @@ class FeedControllerTest extends WallabagCoreTestCase
$client = $this->getClient(); $client = $this->getClient();
$client->request('GET', '/feed/admin/SUPERTOKEN/unread'); $client->request('GET', '/feed/admin/SUPERTOKEN/unread');
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertSame(200, $client->getResponse()->getStatusCode());
$this->validateDom($client->getResponse()->getContent(), 'unread'); $this->validateDom($client->getResponse()->getContent(), 'unread');
$client->request('GET', '/feed/admin/SUPERTOKEN/unread/2'); $client->request('GET', '/feed/admin/SUPERTOKEN/unread/2');
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertSame(200, $client->getResponse()->getStatusCode());
$this->validateDom($client->getResponse()->getContent(), 'unread'); $this->validateDom($client->getResponse()->getContent(), 'unread');
$client->request('GET', '/feed/admin/SUPERTOKEN/unread/3000'); $client->request('GET', '/feed/admin/SUPERTOKEN/unread/3000');
$this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertSame(302, $client->getResponse()->getStatusCode());
} }
public function testTags() public function testTags()
@ -216,13 +216,13 @@ class FeedControllerTest extends WallabagCoreTestCase
$em->flush(); $em->flush();
$client = $this->getClient(); $client = $this->getClient();
$client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml'); $client->request('GET', '/feed/admin/SUPERTOKEN/tags/foo');
$this->assertSame(200, $client->getResponse()->getStatusCode()); $this->assertSame(200, $client->getResponse()->getStatusCode());
$this->validateDom($client->getResponse()->getContent(), 'tag', 2, 'foo-bar'); $this->validateDom($client->getResponse()->getContent(), 'tag', 2, 'foo');
$client->request('GET', '/admin/SUPERTOKEN/tags/foo-bar.xml?page=3000'); $client->request('GET', '/feed/admin/SUPERTOKEN/tags/foo/3000');
$this->assertSame(302, $client->getResponse()->getStatusCode()); $this->assertSame(302, $client->getResponse()->getStatusCode());
} }
} }

View file

@ -13,7 +13,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
$client->followRedirects(); $client->followRedirects();
$crawler = $client->request('GET', '/config'); $crawler = $client->request('GET', '/config');
$this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]); $this->assertContains('config.form_feed.description', $crawler->filter('body')->extract(['_text'])[0]);
} }
public function testLoginWithout2Factor() public function testLoginWithout2Factor()

View file

@ -52,9 +52,9 @@ class WallabagExtensionTest extends TestCase
$extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
$this->assertEquals('lemonde.fr', $extension->removeScheme('lemonde.fr')); $this->assertSame('lemonde.fr', $extension->removeScheme('lemonde.fr'));
$this->assertEquals('gist.github.com', $extension->removeScheme('gist.github.com')); $this->assertSame('gist.github.com', $extension->removeScheme('gist.github.com'));
$this->assertEquals('gist.github.com', $extension->removeScheme('https://gist.github.com')); $this->assertSame('gist.github.com', $extension->removeScheme('https://gist.github.com'));
} }
public function testRemoveSchemeAndWww() public function testRemoveSchemeAndWww()