aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/DoctrineMigrations/Version20161118134328.php47
-rw-r--r--docs/de/user/filters.rst5
-rw-r--r--docs/en/user/filters.rst5
-rw-r--r--docs/fr/user/filters.rst5
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php29
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php16
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig7
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig8
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php57
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php4
23 files changed, 196 insertions, 0 deletions
diff --git a/app/DoctrineMigrations/Version20161118134328.php b/app/DoctrineMigrations/Version20161118134328.php
new file mode 100644
index 00000000..390e89ce
--- /dev/null
+++ b/app/DoctrineMigrations/Version20161118134328.php
@@ -0,0 +1,47 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8use Symfony\Component\DependencyInjection\ContainerInterface;
9
10/**
11 * Add http_status in `entry_table`
12 */
13class Version20161118134328 extends AbstractMigration implements ContainerAwareInterface
14{
15 /**
16 * @var ContainerInterface
17 */
18 private $container;
19
20 public function setContainer(ContainerInterface $container = null)
21 {
22 $this->container = $container;
23 }
24
25 private function getTable($tableName)
26 {
27 return $this->container->getParameter('database_table_prefix') . $tableName;
28 }
29
30 /**
31 * @param Schema $schema
32 */
33 public function up(Schema $schema)
34 {
35 $this->addSql('ALTER TABLE '.$this->getTable('entry').' ADD http_status VARCHAR(3) DEFAULT NULL');
36 }
37
38 /**
39 * @param Schema $schema
40 */
41 public function down(Schema $schema)
42 {
43 $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'This down migration can\'t be executed on SQLite databases, because SQLite don\'t support DROP COLUMN.');
44
45 $this->addSql('ALTER TABLE '.$this->getTable('entry').' DROP http_status');
46 }
47}
diff --git a/docs/de/user/filters.rst b/docs/de/user/filters.rst
index c9cda6b6..94b82b24 100644
--- a/docs/de/user/filters.rst
+++ b/docs/de/user/filters.rst
@@ -30,6 +30,11 @@ Sprache
30wallabag (via graby) kann die Artikelsprache erkennen. Es ist einfach für dich, Artikel 30wallabag (via graby) kann die Artikelsprache erkennen. Es ist einfach für dich, Artikel
31in einer bestimmten Sprache zu filtern. 31in einer bestimmten Sprache zu filtern.
32 32
33HTTP status
34-----------
35
36You can retrieve the articles by filtering by their HTTP status code: 200, 404, 500, etc.
37
33Lesezeit 38Lesezeit
34-------- 39--------
35 40
diff --git a/docs/en/user/filters.rst b/docs/en/user/filters.rst
index ad06819b..de0da016 100644
--- a/docs/en/user/filters.rst
+++ b/docs/en/user/filters.rst
@@ -30,6 +30,11 @@ Language
30wallabag (via graby) can detect article language. It's easy to you to retrieve articles 30wallabag (via graby) can detect article language. It's easy to you to retrieve articles
31written in a specific language. 31written in a specific language.
32 32
33HTTP status
34-----------
35
36You can retrieve the articles by filtering by their HTTP status code: 200, 404, 500, etc.
37
33Reading time 38Reading time
34------------ 39------------
35 40
diff --git a/docs/fr/user/filters.rst b/docs/fr/user/filters.rst
index 6592f140..b20d0d86 100644
--- a/docs/fr/user/filters.rst
+++ b/docs/fr/user/filters.rst
@@ -30,6 +30,11 @@ Langage
30wallabag (via graby) peut détecter la langue dans laquelle l'article est écrit. 30wallabag (via graby) peut détecter la langue dans laquelle l'article est écrit.
31C'est ainsi facile pour vous de retrouver des articles écrits dans une langue spécifique. 31C'est ainsi facile pour vous de retrouver des articles écrits dans une langue spécifique.
32 32
33Statut HTTP
34-----------
35
36Vous pouvez retrouver des articles en filtrant par leur code HTTP : 200, 404, 500, etc.
37
33Temps de lecture 38Temps de lecture
34---------------- 39----------------
35 40
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index f59c445f..3cf9ac1a 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -181,6 +181,15 @@ class Entry
181 private $isPublic; 181 private $isPublic;
182 182
183 /** 183 /**
184 * @var string
185 *
186 * @ORM\Column(name="http_status", type="text", nullable=true)
187 *
188 * @Groups({"entries_for_user", "export_all"})
189 */
190 private $httpStatus;
191
192 /**
184 * @Exclude 193 * @Exclude
185 * 194 *
186 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries") 195 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
@@ -669,4 +678,24 @@ class Entry
669 { 678 {
670 $this->uuid = null; 679 $this->uuid = null;
671 } 680 }
681
682 /**
683 * @return int
684 */
685 public function getHttpStatus()
686 {
687 return $this->httpStatus;
688 }
689
690 /**
691 * @param int $httpStatus
692 *
693 * @return Entry
694 */
695 public function setHttpStatus($httpStatus)
696 {
697 $this->httpStatus = $httpStatus;
698
699 return $this;
700 }
672} 701}
diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
index 3c597b5d..8e2883f7 100644
--- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
@@ -11,6 +11,7 @@ use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\CheckboxFilterType;
11use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType; 11use Lexik\Bundle\FormFilterBundle\Filter\Form\Type\ChoiceFilterType;
12use Symfony\Component\Form\AbstractType; 12use Symfony\Component\Form\AbstractType;
13use Symfony\Component\Form\FormBuilderInterface; 13use Symfony\Component\Form\FormBuilderInterface;
14use Symfony\Component\HttpFoundation\Response;
14use Symfony\Component\OptionsResolver\OptionsResolver; 15use Symfony\Component\OptionsResolver\OptionsResolver;
15use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; 16use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
16 17
@@ -90,6 +91,21 @@ class EntryFilterType extends AbstractType
90 }, 91 },
91 'label' => 'entry.filters.domain_label', 92 'label' => 'entry.filters.domain_label',
92 ]) 93 ])
94 ->add('httpStatus', TextFilterType::class, [
95 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
96 $value = $values['value'];
97 if (false === array_key_exists($value, Response::$statusTexts)) {
98 return;
99 }
100
101 $paramName = sprintf('%s', str_replace('.', '_', $field));
102 $expression = $filterQuery->getExpr()->eq($field, ':'.$paramName);
103 $parameters = array($paramName => $value);
104
105 return $filterQuery->createCondition($expression, $parameters);
106 },
107 'label' => 'entry.filters.http_status_label',
108 ])
93 ->add('isArchived', CheckboxFilterType::class, [ 109 ->add('isArchived', CheckboxFilterType::class, [
94 'label' => 'entry.filters.archived_label', 110 'label' => 'entry.filters.archived_label',
95 ]) 111 ])
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index 1986ab33..178910ab 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -66,6 +66,7 @@ class ContentProxy
66 $entry->setUrl($content['url'] ?: $url); 66 $entry->setUrl($content['url'] ?: $url);
67 $entry->setTitle($title); 67 $entry->setTitle($title);
68 $entry->setContent($html); 68 $entry->setContent($html);
69 $entry->setHttpStatus(isset($content['status']) ? $content['status'] : '');
69 70
70 $entry->setLanguage($content['language']); 71 $entry->setLanguage($content['language']);
71 $entry->setMimetype($content['content_type']); 72 $entry->setMimetype($content['content_type']);
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index c24c5965..c41a2b1a 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Har et vist billede' 178 preview_picture_label: 'Har et vist billede'
179 preview_picture_help: 'Forhåndsvis billede' 179 preview_picture_help: 'Forhåndsvis billede'
180 language_label: 'Sprog' 180 language_label: 'Sprog'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Læsetid i minutter' 183 label: 'Læsetid i minutter'
183 from: 'fra' 184 from: 'fra'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 561d276e..c0d815ad 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Vorschaubild vorhanden' 178 preview_picture_label: 'Vorschaubild vorhanden'
179 preview_picture_help: 'Vorschaubild' 179 preview_picture_help: 'Vorschaubild'
180 language_label: 'Sprache' 180 language_label: 'Sprache'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Lesezeit in Minuten' 183 label: 'Lesezeit in Minuten'
183 from: 'von' 184 from: 'von'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index ec49368c..cceff5c7 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Has a preview picture' 178 preview_picture_label: 'Has a preview picture'
179 preview_picture_help: 'Preview picture' 179 preview_picture_help: 'Preview picture'
180 language_label: 'Language' 180 language_label: 'Language'
181 http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Reading time in minutes' 183 label: 'Reading time in minutes'
183 from: 'from' 184 from: 'from'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 15d0c3cf..358c1999 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Hay una foto' 178 preview_picture_label: 'Hay una foto'
179 preview_picture_help: 'Foto de preview' 179 preview_picture_help: 'Foto de preview'
180 language_label: 'Idioma' 180 language_label: 'Idioma'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Duración de lectura en minutos' 183 label: 'Duración de lectura en minutos'
183 from: 'de' 184 from: 'de'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index e7fa4f86..0546815e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'دارای عکس پیش‌نمایش' 178 preview_picture_label: 'دارای عکس پیش‌نمایش'
179 preview_picture_help: 'پیش‌نمایش عکس' 179 preview_picture_help: 'پیش‌نمایش عکس'
180 language_label: 'زبان' 180 language_label: 'زبان'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'زمان خواندن به دقیقه' 183 label: 'زمان خواندن به دقیقه'
183 from: 'از' 184 from: 'از'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index f85a797d..ec90f9af 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: "A une photo" 178 preview_picture_label: "A une photo"
179 preview_picture_help: "Photo" 179 preview_picture_help: "Photo"
180 language_label: "Langue" 180 language_label: "Langue"
181 http_status_label: 'Statut HTTP'
181 reading_time: 182 reading_time:
182 label: "Durée de lecture en minutes" 183 label: "Durée de lecture en minutes"
183 from: "de" 184 from: "de"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 8a8469d2..2c9924aa 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: "Ha un'immagine di anteprima" 178 preview_picture_label: "Ha un'immagine di anteprima"
179 preview_picture_help: 'Immagine di anteprima' 179 preview_picture_help: 'Immagine di anteprima'
180 language_label: 'Lingua' 180 language_label: 'Lingua'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Tempo di lettura in minuti' 183 label: 'Tempo di lettura in minuti'
183 from: 'da' 184 from: 'da'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index d37dc724..4af8b8fc 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'A una fotò' 178 preview_picture_label: 'A una fotò'
179 preview_picture_help: 'Fotò' 179 preview_picture_help: 'Fotò'
180 language_label: 'Lenga' 180 language_label: 'Lenga'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Durada de lectura en minutas' 183 label: 'Durada de lectura en minutas'
183 from: 'de' 184 from: 'de'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index da95e470..53c60ad2 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Posiada podgląd obrazu' 178 preview_picture_label: 'Posiada podgląd obrazu'
179 preview_picture_help: 'Podgląd obrazu' 179 preview_picture_help: 'Podgląd obrazu'
180 language_label: 'Język' 180 language_label: 'Język'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Czas czytania w minutach' 183 label: 'Czas czytania w minutach'
183 from: 'od' 184 from: 'od'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index 5d2607af..4b02cf36 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Possui uma imagem de preview' 178 preview_picture_label: 'Possui uma imagem de preview'
179 preview_picture_help: 'Imagem de preview' 179 preview_picture_help: 'Imagem de preview'
180 language_label: 'Idioma' 180 language_label: 'Idioma'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Tempo de leitura em minutos' 183 label: 'Tempo de leitura em minutos'
183 from: 'de' 184 from: 'de'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 6b51d9ce..a8f5aad3 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Are o imagine de previzualizare' 178 preview_picture_label: 'Are o imagine de previzualizare'
179 preview_picture_help: 'Previzualizare imagine' 179 preview_picture_help: 'Previzualizare imagine'
180 language_label: 'Limbă' 180 language_label: 'Limbă'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Timp de citire în minute' 183 label: 'Timp de citire în minute'
183 from: 'de la' 184 from: 'de la'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 9c392433..7cc0a54e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -178,6 +178,7 @@ entry:
178 preview_picture_label: 'Resim önizlemesi varsa' 178 preview_picture_label: 'Resim önizlemesi varsa'
179 preview_picture_help: 'Resim önizlemesi' 179 preview_picture_help: 'Resim önizlemesi'
180 language_label: 'Dil' 180 language_label: 'Dil'
181 # http_status_label: 'HTTP status'
181 reading_time: 182 reading_time:
182 label: 'Dakika cinsinden okuma süresi' 183 label: 'Dakika cinsinden okuma süresi'
183 from: 'başlangıç' 184 from: 'başlangıç'
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig
index 5d657c7e..86c1c5ec 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entries.html.twig
@@ -112,6 +112,13 @@
112 </div> 112 </div>
113 </div> 113 </div>
114 114
115 <div id="filter-http-status" class="filter-group">
116 {{ form_label(form.httpStatus) }}
117 <div class="input-field ">
118 {{ form_widget(form.httpStatus) }}
119 </div>
120 </div>
121
115 <div id="filter-reading-time" class="filter-group"> 122 <div id="filter-reading-time" class="filter-group">
116 <div class=""> 123 <div class="">
117 {{ form_label(form.readingTime) }} 124 {{ form_label(form.readingTime) }}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
index 1225e680..a0205ffb 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
@@ -163,6 +163,14 @@
163 </div> 163 </div>
164 164
165 <div class="col s12"> 165 <div class="col s12">
166 {{ form_label(form.httpStatus) }}
167 </div>
168
169 <div class="input-field col s12">
170 {{ form_widget(form.httpStatus) }}
171 </div>
172
173 <div class="col s12">
166 {{ form_label(form.readingTime) }} 174 {{ form_label(form.readingTime) }}
167 </div> 175 </div>
168 <div class="input-field col s6"> 176 <div class="input-field col s6">
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index bf4e0543..09cf01b8 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -961,4 +961,61 @@ class EntryControllerTest extends WallabagCoreTestCase
961 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 961 $this->assertEquals(302, $client->getResponse()->getStatusCode());
962 $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location')); 962 $this->assertContains('/view/'.$content->getId(), $client->getResponse()->headers->get('location'));
963 } 963 }
964
965 public function testFilterOnHttpStatus()
966 {
967 $this->logInAs('admin');
968 $client = $this->getClient();
969
970 $crawler = $client->request('GET', '/new');
971 $form = $crawler->filter('form[name=entry]')->form();
972
973 $data = [
974 'entry[url]' => 'http://www.lemonde.fr/incorrect-url/',
975 ];
976
977 $client->submit($form, $data);
978
979 $crawler = $client->request('GET', '/all/list');
980 $form = $crawler->filter('button[id=submit-filter]')->form();
981
982 $data = [
983 'entry_filter[httpStatus]' => 404,
984 ];
985
986 $crawler = $client->submit($form, $data);
987
988 $this->assertCount(1, $crawler->filter('div[class=entry]'));
989
990 $crawler = $client->request('GET', '/new');
991 $form = $crawler->filter('form[name=entry]')->form();
992
993 $data = [
994 'entry[url]' => 'http://www.nextinpact.com/news/101235-wallabag-alternative-libre-a-pocket-creuse-petit-a-petit-son-nid.htm',
995 ];
996
997 $client->submit($form, $data);
998
999 $crawler = $client->request('GET', '/all/list');
1000 $form = $crawler->filter('button[id=submit-filter]')->form();
1001
1002 $data = [
1003 'entry_filter[httpStatus]' => 200,
1004 ];
1005
1006 $crawler = $client->submit($form, $data);
1007
1008 $this->assertCount(1, $crawler->filter('div[class=entry]'));
1009
1010 $crawler = $client->request('GET', '/all/list');
1011 $form = $crawler->filter('button[id=submit-filter]')->form();
1012
1013 $data = [
1014 'entry_filter[httpStatus]' => 1024,
1015 ];
1016
1017 $crawler = $client->submit($form, $data);
1018
1019 $this->assertCount(7, $crawler->filter('div[class=entry]'));
1020 }
964} 1021}
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 5d772602..33b3ff2a 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -97,6 +97,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
97 'url' => '', 97 'url' => '',
98 'content_type' => '', 98 'content_type' => '',
99 'language' => '', 99 'language' => '',
100 'status' => '',
100 'open_graph' => [ 101 'open_graph' => [
101 'og_title' => 'my title', 102 'og_title' => 'my title',
102 'og_description' => 'desc', 103 'og_description' => 'desc',
@@ -111,6 +112,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
111 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent()); 112 $this->assertEquals('<p>Unable to retrieve readable content.</p><p><i>But we found a short description: </i></p>desc', $entry->getContent());
112 $this->assertEmpty($entry->getPreviewPicture()); 113 $this->assertEmpty($entry->getPreviewPicture());
113 $this->assertEmpty($entry->getLanguage()); 114 $this->assertEmpty($entry->getLanguage());
115 $this->assertEmpty($entry->getHttpStatus());
114 $this->assertEmpty($entry->getMimetype()); 116 $this->assertEmpty($entry->getMimetype());
115 $this->assertEquals(0.0, $entry->getReadingTime()); 117 $this->assertEquals(0.0, $entry->getReadingTime());
116 $this->assertEquals('domain.io', $entry->getDomainName()); 118 $this->assertEquals('domain.io', $entry->getDomainName());
@@ -135,6 +137,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
135 'url' => 'http://1.1.1.1', 137 'url' => 'http://1.1.1.1',
136 'content_type' => 'text/html', 138 'content_type' => 'text/html',
137 'language' => 'fr', 139 'language' => 'fr',
140 'status' => '200',
138 'open_graph' => [ 141 'open_graph' => [
139 'og_title' => 'my OG title', 142 'og_title' => 'my OG title',
140 'og_description' => 'OG desc', 143 'og_description' => 'OG desc',
@@ -151,6 +154,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
151 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture()); 154 $this->assertEquals('http://3.3.3.3/cover.jpg', $entry->getPreviewPicture());
152 $this->assertEquals('text/html', $entry->getMimetype()); 155 $this->assertEquals('text/html', $entry->getMimetype());
153 $this->assertEquals('fr', $entry->getLanguage()); 156 $this->assertEquals('fr', $entry->getLanguage());
157 $this->assertEquals('200', $entry->getHttpStatus());
154 $this->assertEquals(4.0, $entry->getReadingTime()); 158 $this->assertEquals(4.0, $entry->getReadingTime());
155 $this->assertEquals('1.1.1.1', $entry->getDomainName()); 159 $this->assertEquals('1.1.1.1', $entry->getDomainName());
156 } 160 }