update integration tests

- more flexibility and explicitly with the expected dataset
- use radio button to select unittest.db
- add tests:
    - previous/next article with arrow key left/right
    - no alerts are displayed by default
    - alert is displayed on first feed page if feed has parsing error
    - keyboard shortcuts are disabled with modifier keys shift, alt and control (except IE)
    - display logic on subscription page
This commit is contained in:
Mathias Kresin 2015-01-15 02:01:54 +01:00
parent 21ac0a5fd9
commit 972fa86357
10 changed files with 861 additions and 128 deletions

View File

@ -1,4 +1,4 @@
<phpunit>
<phpunit bootstrap="tests/integration/minifluxTestCase.php" >
<php>
<const name="DB_FILENAME" value="unittest.sqlite" />
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL" value="http://localhost/miniflux/" />

View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dataset>
<table name="feeds">
<column>id</column>
<column>site_url</column>
<column>feed_url</column>
<column>title</column>
<column>last_modified</column>
<column>etag</column>
<column>last_checked</column>
<column>enabled</column>
<column>download_content</column>
<column>parsing_error</column>
<column>rtl</column>
<row>
<value>1</value>
<value>http://miniflux.net/</value>
<value>http://miniflux.net/feed.xml</value>
<value>Recent Miniflux Releases</value>
<null />
<null />
<null />
<value>1</value>
<value>0</value>
<value>1</value>
<value>0</value>
</row>
</table>
<table name="items">
<column>id</column>
<column>url</column>
<column>title</column>
<column>author</column>
<column>content</column>
<column>updated</column>
<column>status</column>
<column>feed_id</column>
<column>bookmark</column>
<column>enclosure</column>
<column>enclosure_type</column>
<column>language</column>
<row>
<value>22ca3b4f</value>
<value>http://miniflux.net/news.html#2013-03-21</value>
<value>Miniflux 1.0.2 is released</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.0.2.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.html#v1.0.2&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##92</value>
<value>unread</value>
<value>1</value>
<value>0</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>30d227f3</value>
<value>http://miniflux.net/news.html#2013-07-22</value>
<value>Miniflux 1.0.10 is released!</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.0.10.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.html#v1.0.10&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##97</value>
<value>unread</value>
<value>1</value>
<value>1</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>4b2dbd17</value>
<value>http://miniflux.net/news.html#2013-03-26</value>
<value>Miniflux 1.0.3 is released</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.0.3.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.html#v1.0.3&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##93</value>
<value>read</value>
<value>1</value>
<value>0</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>51b4239b</value>
<value>http://miniflux.net/news.html#2013-04-12</value>
<value>Miniflux 1.0.6 is released</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.0.6.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.html#v1.0.6&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##94</value>
<value>read</value>
<value>1</value>
<value>1</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>7c6afaa5</value>
<value>http://miniflux.net/news.html#2014-01-02</value>
<value>Miniflux 1.1.1 is released</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.1.1.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.html#v1.1.1&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Major improvements:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;New theme: Copper (By the contributor Nicolas Dewaele)&lt;/li&gt;
&lt;li&gt;Display a message next to a feed when there is a parsing error&lt;/li&gt;
&lt;li&gt;Change default value of autoflush to 15 days if not set to avoid large database&lt;/li&gt;
&lt;li&gt;Add autoflush value &amp;quot;immediately&amp;quot;&lt;/li&gt;
&lt;li&gt;Add an option to choose where to be redirected when there is nothing to read&lt;/li&gt;
&lt;li&gt;Bug fixes&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##99</value>
<value>unread</value>
<value>1</value>
<value>0</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>7cb2809d</value>
<value>http://miniflux.net/news.html#2013-09-02</value>
<value>Miniflux 1.0.11 is released</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.0.11.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.html#v1.0.11&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##98</value>
<value>unread</value>
<value>1</value>
<value>1</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>9b20eb66</value>
<value>http://miniflux.net/news.html#2013-04-30</value>
<value>Miniflux 1.0.7 is released</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.0.7.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.html#v1.0.7&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##95</value>
<value>read</value>
<value>1</value>
<value>0</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>9fa78b54</value>
<value>http://miniflux.net/news.html#2013-06-02</value>
<value>Miniflux 1.0.8 is released</value>
<value></value>
<value>&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://miniflux.net/miniflux-1.0.8.zip&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;Download archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://miniflux.net/changes.htm#v1.0.8&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot; &gt;ChangeLog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</value>
<value>##TIMESTAMP##96</value>
<value>read</value>
<value>1</value>
<value>1</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
</table>
</dataset>

View File

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8" ?>
<dataset>
<table name="feeds">
<column>id</column>
<column>site_url</column>
<column>feed_url</column>
<column>title</column>
<column>last_modified</column>
<column>etag</column>
<column>last_checked</column>
<column>enabled</column>
<column>download_content</column>
<column>parsing_error</column>
<column>rtl</column>
<row>
<value>1</value>
<value>http://www.01net.com/actus/</value>
<value>http://www.netzsensor.de/noone.rss</value>
<value>01net. Actualités</value>
<null />
<null />
<null />
<value>1</value>
<value>0</value>
<value>0</value>
<value>0</value>
</row>
<row>
<value>2</value>
<value>http://devopsreactions.tumblr.com/</value>
<value>http://devopsreactions.tumblr.com/rss</value>
<value>DevOps Reactions</value>
<null />
<null />
<value>##TIMESTAMP##00</value>
<value>0</value>
<value>0</value>
<value>0</value>
<value>0</value>
</row>
<row>
<value>3</value>
<value>http://forums.fedoraforum.org/</value>
<value>http://forums.fedoraforum.org/external.php?type=RSS2</value>
<value>FedoraForum.org</value>
<null />
<null />
<value>##TIMESTAMP##00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<value>0</value>
</row>
<row>
<value>4</value>
<value>https://news.ycombinator.com/</value>
<value>https://news.ycombinator.com/rss</value>
<value>Hacker News</value>
<null />
<null />
<value>##TIMESTAMP##00</value>
<value>1</value>
<value>0</value>
<value>1</value>
<value>0</value>
</row>
<row>
<value>5</value>
<value>http://xakep.ru/</value>
<value>http://www.xakep.ru/articles/rss/</value>
<value>XAKEP.RU</value>
<null />
<null />
<value>##TIMESTAMP##00</value>
<value>1</value>
<value>0</value>
<value>0</value>
<value>0</value>
</row>
</table>
<table name="items">
<column>id</column>
<column>url</column>
<column>title</column>
<column>author</column>
<column>content</column>
<column>updated</column>
<column>status</column>
<column>feed_id</column>
<column>bookmark</column>
<column>enclosure</column>
<column>enclosure_type</column>
<column>language</column>
<row>
<value>0fccceb1</value>
<value>http://www.expatsoftware.com/Articles/bootstrapping-abroad.html?try=3</value>
<value>Bootstrapping overseas as an American</value>
<value></value>
<value>&lt;a href=&quot;https://news.ycombinator.com/item?id=8898238&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot;&gt;Comments&lt;/a&gt;</value>
<value>##TIMESTAMP##00</value>
<value>read</value>
<value>4</value>
<value>0</value>
<value></value>
<value></value>
<value></value>
</row>
<row>
<value>6b8e4aa3</value>
<value>http://forums.fedoraforum.org/showthread.php?t=302442&amp;goto=newpost</value>
<value>Question about http hack from another thread</value>
<value>lightman47</value>
<value>Ref: &lt;a href=&quot;http://www.forums.fedoraforum.org/showthread.php?t=302439&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot;&gt;http://www.forums.fedoraforum.org/sh...d.php?t=302439&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
I didn&amp;#039;t want to hijack this thread, but the bigger question remains - How could this happen? In my mind I wouldn&amp;#039;t think that user Apache (or ftpsecure) could even get to the &amp;#039;etc&amp;#039; directory - much less abscond a file.&lt;br/&gt;&lt;br/&gt;
I&amp;#039;m curious because I run a site of my own, although I also run denyhosts with bad attempts throttled to 3 and lock out all sevrvices.&lt;br/&gt;&lt;br/&gt;
Thx</value>
<value>##TIMESTAMP##00</value>
<value>unread</value>
<value>3</value>
<value>0</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
<row>
<value>72d36b63</value>
<value>http://ocsigen.org/js_of_ocaml/</value>
<value>Js_of_ocaml A compiler of OCaml bytecode to Javascript</value>
<value></value>
<value>&lt;a href=&quot;https://news.ycombinator.com/item?id=8898680&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot;&gt;Comments&lt;/a&gt;</value>
<value>##TIMESTAMP##00</value>
<value>unread</value>
<value>4</value>
<value>0</value>
<value></value>
<value></value>
<value></value>
</row>
<row>
<value>8374a575</value>
<value>http://devopsreactions.tumblr.com/post/108246850813</value>
<value>Who will pick up this bug in the legacy code?</value>
<value>sharhalakis</value>
<value>&lt;p&gt;&lt;img src=&quot;?action=proxy&amp;amp;url=https%3A%2F%2Fi.imgur.com%2FqSU3xKV.gif&quot;/&gt;&lt;/p&gt;
&lt;p&gt;by uaiHebert&lt;/p&gt;</value>
<value>##TIMESTAMP##00</value>
<value>read</value>
<value>2</value>
<value>0</value>
<value></value>
<value></value>
<value></value>
</row>
<row>
<value>b8b894ad</value>
<value>https://xakep.ru/2015/01/16/hackers-list/</value>
<value>Hackers List: найми правильного хакера!</value>
<value>Denis Mirkov</value>
<value>&lt;a href=&quot;https://xakep.ru/2015/01/16/hackers-list/&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;?action=proxy&amp;amp;url=https%3A%2F%2Fxakep.ru%2Fwp-content%2Fuploads%2F2015%2F01%2F00228-120x76.jpg%3F614ffd&quot; title=&quot;Hackers List: найми правильного хакера!&quot;/&gt;&lt;/a&gt;&lt;p&gt;Нужно провести разведывательную операцию? Шпионаж? Прослушка? Никаких проблем — в онлайне сотни хакеров, готовых помочь за вознаграждение. Нужно только выбрать среди них.&lt;/p&gt;
&lt;p&gt;«Найми подходящего хакера!», — под таким девизом открылся новый сайт Hackers List, настоящий каталог со списком разнообразных услуг, &lt;a href=&quot;http://dealbook.nytimes.com/2015/01/15/need-some-espionage-done-hackers-are-for-hire-online/&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot;&gt;пишет&lt;/a&gt; NY Times. Сайт открылся в начале ноября.&lt;/p&gt;
&lt;p&gt;Спрос на хакерские услуги немаленький. Например, некий житель Швеции предлагает $2000 тому, кто сможет взломать сайт его арендодателя. Жительница Калифорнии предлагает $500 за взлом странички Facebook её парня, а также его почтового ящика Gmail — несчастная девушка хочет убедиться, что парень ей не изменяет. Какой-то австралиец готов выложить $2000, чтобы получить список клиентов из базы конкурента.&lt;/p&gt;
&lt;p&gt;В наше время взлом, слежка и прослушка перестали быть монополией спецслужб. Соответствующие инструменты и обучающие курсы свободно доступны в онлайне. Специалисты по информационной безопасности работают не только на государственные структуры, но не гнушаются и более мелкими заказами от частных лиц. И если взломы крупных корпораций вроде Sony Pictures, JPMorgan Chase и Home Depot привлекают всеобщее внимание, то подпольная индустрия частного взлома тихо живёт и процветает.&lt;/p&gt;
&lt;p&gt;Взлом почтовых ящиков, удаление фотографий из социальной сети, доступ к базе данных компании, изменение оценки на школьном сервере. Менее чем за три месяца работы на сайте Hackers List накопилось более 500 «грязных» заказов, по которым идёт торговля со снижением цены (голландский аукцион). Есть и «невинные» заказы, когда клиент просит восстановить забытый пароль от собственного почтового ящика (впрочем, кто докажет, что это именно его ящик?).&lt;/p&gt;
&lt;p&gt;Всего на сайте сейчас около 40 зарегистрированных хакеров и 844 зарегистрированных клиента.&lt;/p&gt;
&lt;p&gt;Все участники сохраняют анонимность, а неизвестный оператор сайта получает процент с каждого заказа. Есть опция «гарантированной оплаты», когда платёж происходит только после выполнения работы. Оператор сайта снимает с себя всякую ответственность: каждый пользователь должен подписать 10-страничное соглашение об использовании сервиса, в котором обязуется соблюдать закон. Сайт зарегистрирован в Новой Зеландии, у него даже есть твиттер-аккаунт (@hackerslist).&lt;/p&gt;
&lt;p&gt;Пример этого сайта, а также исключительная активность в соответствующих ветках форума журнала «Хакер» показывает, что рынок «низкоуровневых» взломов процветает, а главное — существует огромный неудовлетворённый спрос на хакерские услуги. Независимые эксперты подтверждают, что взлом почтовых ящиков и аккаунтов в социальных сетях происходит на ежедневной основе. Появились даже специализированные ресурсы вроде &lt;a href=&quot;http://hackerforhirereview.com/&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot;&gt;hackerforhirereview.com&lt;/a&gt; с обзором таких сервисов, где им выставляют оценки.&lt;/p&gt;
&lt;p&gt;Прочитать полностью на сайте: &lt;a href=&quot;https://xakep.ru/2015/01/16/hackers-list/&quot; rel=&quot;noreferrer&quot; target=&quot;_blank&quot;&gt;Hackers List: найми правильного хакера!&lt;/a&gt;&lt;/p&gt;</value>
<value>##TIMESTAMP##00</value>
<value>unread</value>
<value>5</value>
<value>0</value>
<value></value>
<value></value>
<value>en-US</value>
</row>
</table>
</dataset>

View File

@ -1,7 +1,5 @@
<?php
require_once 'minifluxTestCase.php';
class keyboardShortcutTest extends minifluxTestCase
{
const DEFAULT_COUNTER_PAGE = 8;
@ -21,6 +19,16 @@ class keyboardShortcutTest extends minifluxTestCase
return "($this->expectedCounterPage) $this->basePageHeading";
}
public function testNoAlertShown()
{
$alertBox = $this->getAlertBox();
$this->assertEmpty($alertBox, 'Unexpected alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testNextItemShortcutA()
{
$articles = $this->getArticles();
@ -36,7 +44,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testNextItemShortcutB()
@ -54,7 +62,25 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testNextItemShortcutC()
{
$articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[0]);
$this->keys($this->getShortcutNextItemC());
$firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]);
$secondIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[1]);
$this->assertTrue($firstIsNotCurrentArticle, 'The first Article is still the current Article');
$this->assertTrue($secondIsCurrentArticle, 'The second Article is not the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testPreviousItemA()
@ -67,12 +93,12 @@ class keyboardShortcutTest extends minifluxTestCase
$firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]);
$secondIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[1]);
$this->assertTrue($firstIsCurrentArticle, 'The first Article is not the current Article');
$this->assertTrue($firstIsCurrentArticle, 'The first article is not the current article');
$this->assertTrue($secondIsNotCurrentArticle, 'The second Article is still the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testPreviousItemB()
@ -85,12 +111,30 @@ class keyboardShortcutTest extends minifluxTestCase
$firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]);
$secondIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[1]);
$this->assertTrue($firstIsCurrentArticle, 'The first Article is not the current Article');
$this->assertTrue($firstIsCurrentArticle, 'The first article is not the current article');
$this->assertTrue($secondIsNotCurrentArticle, 'The second Article is still the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testPreviousItemC()
{
$articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[1]);
$this->keys($this->getShortcutPreviousItemC());
$firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]);
$secondIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[1]);
$this->assertTrue($firstIsCurrentArticle, 'The first article is not the current article');
$this->assertTrue($secondIsNotCurrentArticle, 'The second Article is still the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testNextStopsAtLastArticle()
@ -109,7 +153,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testPreviousStopsAtFirstArticle()
@ -124,11 +168,74 @@ class keyboardShortcutTest extends minifluxTestCase
$firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]);
$this->assertTrue($lastIsNotCurrentArticle, 'The last Article is still the current Article');
$this->assertTrue($firstIsCurrentArticle, 'The first Article is not the current Article');
$this->assertTrue($firstIsCurrentArticle, 'The first article is not the current article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testSHIFTModifierIsDisabled()
{
if ($this->getBrowser() === "iexplore") {
$this->markTestSkipped('Modifier key test is not supported with Internet Explorer [Selenium issue #4973].');
}
$articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[0]);
$this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::SHIFT.$this->getShortcutNextItemC());
$this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::SHIFT);
$firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]);
$this->assertFalse($firstIsNotCurrentArticle, 'The first article is not the current article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testALTModifierIsDisabled()
{
if ($this->getBrowser() === "iexplore") {
$this->markTestSkipped('Modifier key test is not supported with Internet Explorer [Selenium issue #4973].');
}
$articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[0]);
$this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::ALT.$this->getShortcutNextItemB());
$this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::ALT);
$firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]);
$this->assertFalse($firstIsNotCurrentArticle, 'The first article is not the current article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testCTRLModifierIsDisabled()
{
if ($this->getBrowser() === "iexplore") {
$this->markTestSkipped('Modifier key test is not supported with Internet Explorer [Selenium issue #4973].');
}
$articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[0]);
$this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::CONTROL.$this->getShortcutNextItemB());
$this->keys(PHPUnit_Extensions_Selenium2TestCase_Keys::CONTROL);
$firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]);
$this->assertFalse($firstIsNotCurrentArticle, 'The first article is not the current article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testShortcutsOnInputFiledAreDisabled()
@ -136,11 +243,13 @@ class keyboardShortcutTest extends minifluxTestCase
$url = $this->getURLPagePreferences();
$this->url($url);
$this->byId('form-username')->value($this->getShortcutGoToUnread());
$this->byId('form-username')->click();
$this->keys($this->getShortcutGoToUnread());
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $url;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
}
@ -152,7 +261,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterPage = '6';
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPageBookmarks();
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
}
@ -164,7 +273,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterPage = '6';
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPageHistory();
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
}
@ -176,7 +285,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterPage = '6';
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPageUnread();
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
}
@ -187,7 +296,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds';
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
}
@ -198,7 +307,7 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPagePreferences();
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
$this->ignorePageTitle = TRUE;
}

View File

@ -1,5 +1,7 @@
<?php
use PHPUnit_Extensions_Selenium2TestCase_Keys as Keys;
abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
{
protected $basePageHeading = NULL;
@ -25,7 +27,8 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
parent::setUp();
// trigger database fixtures onSetUp routines
$this->getDatabaseTester('fixture_feed1', TRUE)->onSetUp();
$dataset = $this->getDataSet('fixture_feed1', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
// Set the base URL for the tests.
$this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL);
@ -40,7 +43,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$elements = $this->elements($this->using('css selector')->value('body#login-page'));
if (count($elements) === 1) {
$this->url('?action=select-db&database='.DB_FILENAME);
$this->byCssSelector("input[value='".DB_FILENAME."']")->click();
$this->byId('form-username')->click();
$this->keys('admin');
@ -90,17 +93,14 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
PHPUnit_Extensions_Database_TestCase::assertDataSetsEqual($expectedDataSetFiltered, $actualDataSetFiltered, 'Unexpected changes in database');
}
protected function getDataSet($dataSetFile, $appendFeed2 = TRUE)
protected function getDataSet()
{
$compositeDs = new PHPUnit_Extensions_Database_DataSet_CompositeDataSet();
$dataSetFiles = func_get_args();
$ds1 = new PHPUnit_Extensions_Database_DataSet_XmlDataSet(dirname(__FILE__).DIRECTORY_SEPARATOR.'datasets'.DIRECTORY_SEPARATOR.$dataSetFile.'.xml');
$compositeDs->addDataSet($ds1);
if ($appendFeed2) {
// feed2 should be normaly untouched
$ds2 = new PHPUnit_Extensions_Database_DataSet_XmlDataSet(dirname(__FILE__).DIRECTORY_SEPARATOR.'datasets'.DIRECTORY_SEPARATOR.'fixture_feed2.xml');
$compositeDs->addDataSet($ds2);
foreach ($dataSetFiles as $dataSetFile) {
$ds = new PHPUnit_Extensions_Database_DataSet_XmlDataSet(dirname(__FILE__).DIRECTORY_SEPARATOR.'datasets'.DIRECTORY_SEPARATOR.$dataSetFile.'.xml');
$compositeDs->addDataSet($ds);
}
return $compositeDs;
@ -140,16 +140,15 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return static::$databaseConnection;
}
protected function getDatabaseTester($dataSetFile, $appendFeed2)
protected function getDatabaseTester($dataset)
{
if (is_null(static::$databaseTester)) {
$tester = new PHPUnit_Extensions_Database_DefaultTester($this->getConnection());
// article/feed import on database->onSetUp();
$tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
$dataset = $this->getDataSet($dataSetFile, $appendFeed2);
$rdataset = new PHPUnit_Extensions_Database_DataSet_ReplacementDataSet($dataset);
$rdataset->addSubStrReplacement('##TIMESTAMP##', substr((string)(time()-100), 0, -2));
// article/feed import on database->onSetUp();
$tester = new PHPUnit_Extensions_Database_DefaultTester($this->getConnection());
$tester->setSetUpOperation(PHPUnit_Extensions_Database_Operation_Factory::CLEAN_INSERT());
$tester->setDataSet($rdataset);
static::$databaseTester = $tester;
@ -177,18 +176,35 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return $value;
}
// public to be accessible within an closure
public function isElementVisible($element)
{
$displaySize = $element->size();
return ($element->displayed() && $displaySize['height']>0 && $displaySize['width']>0);
}
// public to be accessible within an closure
public function isElementInvisible($element)
{
$displaySize = $element->size();
return ($element->displayed() === FALSE || $displaySize['height']=0 || $displaySize['width']=0);
}
private function waitForElementVisibility($element, $visible)
{
// return false in case of timeout
try {
$value = $this->waitUntil(function() use($element, $visible) {
// Workaround for PHP < 5.4
$CI = $this;
$value = $this->waitUntil(function() use($CI, $element, $visible) {
// a "No such Element" or "Stale Element Reference" exception is
// valid if an object should disappear
try {
$displaySize = $element->size();
if ((($visible === TRUE) && ($element->displayed() && $displaySize['height']>0 && $displaySize['width']>0))
|| (($visible === FALSE) && ($element->displayed() === FALSE || $displaySize['height']=0 || $displaySize['width']=0))) {
if (($visible && $CI->isElementVisible($element))
|| (! $visible && $CI->isElementInvisible($element))) {
return TRUE;
}
}
@ -329,6 +345,11 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=config';
}
public function getURLPageSubscriptions()
{
return PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds';
}
public function getShortcutNextItemA()
{
return 'n';
@ -339,6 +360,11 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return 'j';
}
public function getShortcutNextItemC()
{
return PHPUnit_Extensions_Selenium2TestCase_Keys::RIGHT;
}
public function getShortcutPreviousItemA()
{
return 'p';
@ -349,6 +375,11 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return 'k';
}
public function getShortcutPreviousItemC()
{
return PHPUnit_Extensions_Selenium2TestCase_Keys::LEFT;
}
public function getShortcutToogleReadStatus()
{
return 'm';
@ -404,6 +435,43 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return $articles;
}
public function getFeedFailed()
{
$cssSelector = 'article[data-feed-id="4"]';
$feed = $this->element($this->using('css selector')->value($cssSelector));
return $feed;
}
public function getFeedDisabled()
{
$cssSelector = 'article[data-feed-id="2"]';
$feed = $this->element($this->using('css selector')->value($cssSelector));
return $feed;
}
public function getFeedErrorMessages()
{
$cssSelector = 'article .feed-parsing-error';
if (func_num_args() === 0) {
$feed = $this;
}
else {
$feed = func_get_arg(0);
}
$feeds = $feed->elements($this->using('css selector')->value($cssSelector));
// Workaround for PHP < 5.4
$CI = $this;
return array_filter($feeds, function($feed) use($CI) {
return $CI->isElementVisible($feed);
});
}
public function getArticleUnreadNotBookmarked()
{
$cssSelector = 'article[data-item-id="7c6afaa5"]';
@ -490,6 +558,14 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return $link;
}
public function getAlertBox()
{
$cssSelector = 'p.alert';
$alertBox = $this->elements($this->using('css selector')->value($cssSelector));
return $alertBox;
}
public function waitForArticleIsCurrentArticle($article)
{
$isCurrent = $this->waitForElementAttributeHasValue($article, 'id', 'current-item');

View File

@ -1,7 +1,5 @@
<?php
require_once 'minifluxTestCase.php';
class pageBookmarksTest extends minifluxTestCase
{
const DEFAULT_COUNTER_PAGE = 6;
@ -21,6 +19,16 @@ class pageBookmarksTest extends minifluxTestCase
return "$this->basePageHeading ($this->expectedCounterPage)";
}
public function testNoAlertShown()
{
$alertBox = $this->getAlertBox();
$this->assertEmpty($alertBox, 'Unexpected alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testItemsFromAllFeeds()
{
$articles = $this->getArticlesNotFromFeedOne();
@ -28,7 +36,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testOnlyBookmarkedArticles()
@ -38,7 +46,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testMarkReadBookmarkedArticleLink()
@ -52,8 +60,8 @@ class pageBookmarksTest extends minifluxTestCase
$this->assertTrue($visible, 'read icon is not visible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkReadBookmarkedArticleKeyboard()
@ -67,8 +75,8 @@ class pageBookmarksTest extends minifluxTestCase
$this->assertTrue($visible, 'read icon is not visible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadBookmarkedArticleLink()
@ -82,8 +90,8 @@ class pageBookmarksTest extends minifluxTestCase
$this->assertTrue($invisible, 'read icon is not invisible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadBookmarkedArticleKeyboard()
@ -97,8 +105,8 @@ class pageBookmarksTest extends minifluxTestCase
$this->assertTrue($invisible, 'read icon is not invisible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testUnbookmarkReadArticleLink()
@ -113,7 +121,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle', 'fixture_feed2');
}
@ -129,7 +137,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle', 'fixture_feed2');
}
public function testUnbookmarkUnreadArticleLink()
@ -144,7 +152,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle', 'fixture_feed2');
}
public function testUnbookmarkUnreadArticleKeyboard()
@ -159,7 +167,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle', 'fixture_feed2');
}
public function testRemoveReadBookmarkedArticleLink()
@ -174,7 +182,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle', 'fixture_feed2');
}
public function testRemoveUnreadBookmarkedArticleLink()
@ -189,7 +197,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testUnreadCounterFromNothingToValue()
@ -198,7 +206,9 @@ class pageBookmarksTest extends minifluxTestCase
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
$dataset = $this->getDataSet('fixture_OnlyReadArticles');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
@ -214,7 +224,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 1;
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle');
}
public function testUnreadCounterFromValueToNothing()
@ -223,7 +233,9 @@ class pageBookmarksTest extends minifluxTestCase
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp();
$dataset = $this->getDataSet('fixture_OneUnreadArticle');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
@ -238,7 +250,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = '';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles');
}
public function testRedirectWithZeroArticles()
@ -257,7 +269,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = NULL;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_NoBookmarkedArticles', FALSE);
$this->expectedDataSet = $this->getDataSet('expected_NoBookmarkedArticles');
$this->ignorePageTitle = TRUE;
}

View File

@ -1,7 +1,5 @@
<?php
require_once 'minifluxTestCase.php';
class pageFirstFeedTest extends minifluxTestCase
{
const DEFAULT_COUNTER_PAGE = 8;
@ -21,6 +19,37 @@ class pageFirstFeedTest extends minifluxTestCase
return "($this->expectedCounterPage) $this->basePageHeading";
}
public function testNoAlertShown()
{
$alertBox = $this->getAlertBox();
$this->assertEmpty($alertBox, 'Unexpected alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testAlertOnParsingError()
{
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$dataset = $this->getDataSet('fixture_feed1_parsing_error', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
$alertBox = $this->getAlertBox();
$this->assertCount(1, $alertBox, 'No alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $dataset;
}
public function testOnlyItemsFromFirstFeed()
{
$articles = $this->getArticlesNotFromFeedOne();
@ -28,7 +57,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testMarkReadNotBookmarkedArticleLink()
@ -43,7 +72,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkReadNotBookmarkedArticleKeyboard()
@ -58,7 +87,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkReadBookmarkedArticleLink()
@ -73,7 +102,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkReadBookmarkedArticleKeyboard()
@ -88,7 +117,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadNotBookmarkedArticleLink()
@ -103,7 +132,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadNotBookmarkedArticleKeyboard()
@ -118,7 +147,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadBookmarkedArticleLink()
@ -133,7 +162,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadBookmarkedArticleKeyboard()
@ -148,7 +177,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testBookmarkReadArticleLink()
@ -163,7 +192,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle', 'fixture_feed2');
}
public function testBookmarkReadArticleKeyboard()
@ -178,7 +207,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle', 'fixture_feed2');
}
public function testBookmarkUnreadArticleLink()
@ -193,7 +222,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle', 'fixture_feed2');
}
public function testBookmarkUnreadArticleKeyboard()
@ -208,7 +237,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle', 'fixture_feed2');
}
public function testUnbookmarkReadArticleLink()
@ -223,7 +252,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle', 'fixture_feed2');
}
public function testUnbookmarkReadArticleKeyboard()
@ -238,7 +267,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle', 'fixture_feed2');
}
public function testUnbookmarkUnreadArticleLink()
@ -253,7 +282,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle', 'fixture_feed2');
}
public function testUnbookmarkUnreadArticleKeyboard()
@ -268,7 +297,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle', 'fixture_feed2');
}
public function testRemoveReadNotBookmarkedArticleLink()
@ -283,7 +312,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadNotBookmarkedArticle', 'fixture_feed2');
}
public function testRemoveReadBookmarkedArticleLink()
@ -298,7 +327,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle', 'fixture_feed2');
}
public function testRemoveUnreadNotBookmarkedArticleLink()
@ -313,7 +342,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadNotBookmarkedArticle', 'fixture_feed2');
}
public function testRemoveUnreadBookmarkedArticleLink()
@ -328,7 +357,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkFeedReadHeaderLink()
@ -341,7 +370,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 2;
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead');
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead', 'fixture_feed2');
}
public function testMarkFeedReadBottomLink()
@ -354,7 +383,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 2;
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead');
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead', 'fixture_feed2');
}
public function testUnreadCounterFromNothingToValue()
@ -363,7 +392,9 @@ class pageFirstFeedTest extends minifluxTestCase
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
$dataset = $this->getDataSet('fixture_OnlyReadArticles');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
@ -379,7 +410,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 1;
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle');
}
public function testUnreadCounterFromValueToNothing()
@ -388,7 +419,9 @@ class pageFirstFeedTest extends minifluxTestCase
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp();
$dataset = $this->getDataSet('fixture_OneUnreadArticle');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
@ -403,7 +436,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = '';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles');
}
public function testRedirectWithZeroArticles()
@ -423,7 +456,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterPage = NULL;
$this->expectedCounterUnread = 2;
$this->expectedDataSet = $this->getDataSet('expected_FirstFeedAllRemoved');
$this->expectedDataSet = $this->getDataSet('expected_FirstFeedAllRemoved', 'fixture_feed2');
$this->ignorePageTitle = TRUE;
}

View File

@ -1,7 +1,5 @@
<?php
require_once 'minifluxTestCase.php';
class pageHistoryTest extends minifluxTestCase
{
const DEFAULT_COUNTER_PAGE = 6;
@ -21,6 +19,16 @@ class pageHistoryTest extends minifluxTestCase
return "$this->basePageHeading ($this->expectedCounterPage)";
}
public function testNoAlertShown()
{
$alertBox = $this->getAlertBox();
$this->assertEmpty($alertBox, 'Unexpected alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testItemsFromAllFeeds()
{
$articles = $this->getArticlesNotFromFeedOne();
@ -28,7 +36,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testOnlyReadArticles()
@ -38,7 +46,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testMarkUnreadNotBookmarkedArticleLink()
@ -53,7 +61,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadNotBookmarkedArticleKeyboard()
@ -68,7 +76,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadBookmarkedArticleLink()
@ -83,7 +91,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkUnreadBookmarkedArticleKeyboard()
@ -98,7 +106,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testBookmarkReadArticleLink()
@ -113,7 +121,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle', 'fixture_feed2');
}
public function testBookmarkReadArticleKeyboard()
@ -128,7 +136,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle', 'fixture_feed2');
}
public function testUnbookmarkReadArticleLink()
@ -143,7 +151,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle', 'fixture_feed2');
}
public function testUnbookmarkReadArticleKeyboard()
@ -158,7 +166,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle', 'fixture_feed2');
}
public function testRemoveReadNotBookmarkedArticleLink()
@ -173,7 +181,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadNotBookmarkedArticle', 'fixture_feed2');
}
public function testRemoveReadBookmarkedArticleLink()
@ -188,7 +196,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveReadBookmarkedArticle', 'fixture_feed2');
}
public function testFlushAllKeepsBookmarkedAndUnread()
@ -201,7 +209,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = 3;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_NoReadNotBookmarkedArticles', FALSE);
$this->expectedDataSet = $this->getDataSet('expected_NoReadNotBookmarkedArticles');
$this->ignorePageTitle = TRUE;
}
@ -212,7 +220,9 @@ class pageHistoryTest extends minifluxTestCase
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
$dataset = $this->getDataSet('fixture_OnlyReadArticles');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
@ -228,7 +238,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE + static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedCounterUnread = 1;
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle');
}
public function testRedirectWithZeroArticles()
@ -248,7 +258,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterPage = NULL;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + static::DEFAULT_COUNTER_PAGE;
$this->expectedDataSet = $this->getDataSet('expected_NoReadArticles', FALSE);
$this->expectedDataSet = $this->getDataSet('expected_NoReadArticles');
$this->ignorePageTitle = TRUE;
}

View File

@ -0,0 +1,130 @@
<?php
class pageSubscriptionTest extends minifluxTestCase
{
const DEFAULT_COUNTER_PAGE = null;
const DEFAULT_COUNTER_UNREAD = 3;
protected function setUp()
{
// trigger database fixtures onSetUp routines
$dataset = $this->getDataSet('fixture_feed_error_disabled_normal');
$this->getDatabaseTester($dataset)->onSetUp();
// Set the base URL for the tests.
$this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL);
}
public function setUpPage()
{
$url = $this->getURLPageSubscriptions();
$this->doLoginIfRequired($url);
$this->basePageHeading = $this->getBasePageHeading();
$this->expectedPageUrl = $url;
}
public function getExpectedPageTitle()
{
return "$this->basePageHeading";
}
public function testNoAlertShown()
{
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$dataset = $this->getDataSet('fixture_feed1', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
$alertBox = $this->getAlertBox();
$this->assertEmpty($alertBox, 'Unexpected alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 6;
$this->expectedDataSet = $dataset;
}
public function testNoPerFeedErrorMessages()
{
// load different fixture and reload the page
$backupDataTester = static::$databaseTester;
static::$databaseTester = NULL;
$dataset = $this->getDataSet('fixture_feed1', 'fixture_feed2');
$this->getDatabaseTester($dataset)->onSetUp();
static::$databaseTester = $backupDataTester;
$this->refresh();
$messages = $this->getFeedErrorMessages();
$this->assertCount(0, $messages, 'Feeds have unexpected error messages visible.');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 6;
$this->expectedDataSet = $dataset;
}
public function testAlertOnParsingError()
{
$alertBox = $this->getAlertBox();
$this->assertCount(1, $alertBox, 'No alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testFailedFeedIsFirstFeed()
{
$feeds = $this->getArticles();
$this->assertEquals($this->getFeedFailed(), $feeds[0], 'The first feed is not the failed feed');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testFailedFeedIsHighlighted()
{
$feeds = $this->getArticles();
$this->assertNotEquals($feeds[0]->css('background-color'), $feeds[1]->css('background-color'), 'The failed feed is not highlighted');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testFailedHasErrorMessageVisible()
{
$feed = $this->getFeedFailed();
$this->assertCount(1, $this->getFeedErrorMessages($feed), 'The failed feed has no error message');
$this->assertCount(1, $this->getFeedErrorMessages(), 'Another than the failed feed has an error message');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testDisabledIsLastFeed()
{
$feeds = $this->getArticles();
$this->assertEquals($this->getFeedDisabled(), $feeds[count($feeds)-1], 'The disabled feed is not the last feed');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
}
?>

View File

@ -1,7 +1,5 @@
<?php
require_once 'minifluxTestCase.php';
class pageUnreadTest extends minifluxTestCase
{
const DEFAULT_COUNTER_PAGE = 6;
@ -21,6 +19,16 @@ class pageUnreadTest extends minifluxTestCase
return "Miniflux ($this->expectedCounterPage)";
}
public function testNoAlertShown()
{
$alertBox = $this->getAlertBox();
$this->assertEmpty($alertBox, 'Unexpected alert box found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testItemsFromAllFeeds()
{
$articles = $this->getArticlesNotFromFeedOne();
@ -28,7 +36,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testOnlyUnreadArticles()
@ -38,7 +46,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->expectedDataSet = static::$databaseTester->getDataSet();
}
public function testMarkReadNotBookmarkedArticleLink()
@ -53,7 +61,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkReadNotBookmarkedArticleKeyboard()
@ -68,7 +76,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle', 'fixture_feed2');
}
public function testMarkReadBookmarkedArticleLink()
@ -83,7 +91,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkReadBookmarkedArticleKeyboard()
@ -98,7 +106,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_MarkReadBookmarkedArticle', 'fixture_feed2');
}
public function testBookmarkUnreadArticleLink()
@ -113,7 +121,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle', 'fixture_feed2');
}
public function testBookmarkUnreadArticleKeyboard()
@ -128,7 +136,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle', 'fixture_feed2');
}
public function testUnbookmarkUnreadArticleLink()
@ -143,7 +151,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle', 'fixture_feed2');
}
public function testUnbookmarkUnreadArticleKeyboard()
@ -158,7 +166,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle', 'fixture_feed2');
}
public function testRemoveUnreadNotBookmarkedArticleLink()
@ -173,7 +181,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadNotBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadNotBookmarkedArticle', 'fixture_feed2');
}
public function testRemoveUnreadBookmarkedArticleLink()
@ -188,7 +196,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle', 'fixture_feed2');
}
public function testMarkAllReadHeaderLink()
@ -202,7 +210,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = NULL;
$this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles');
$this->ignorePageTitle = TRUE;
}
@ -218,7 +226,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = NULL;
$this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles');
$this->ignorePageTitle = TRUE;
}
@ -241,7 +249,7 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterPage = NULL;
$this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles', FALSE);
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles');
$this->ignorePageTitle = TRUE;
}