Tests: Fix PHP strict standards warnings

This commit is contained in:
Mathias Kresin 2015-01-04 22:25:28 +01:00
parent 71275eac2c
commit bb51368f3a
6 changed files with 243 additions and 245 deletions

View File

@ -6,12 +6,12 @@ class keyboardShortcutTest extends minifluxTestCase
{ {
const DEFAULT_COUNTER_PAGE = 8; const DEFAULT_COUNTER_PAGE = 8;
const DEFAULT_COUNTER_UNREAD = 6; const DEFAULT_COUNTER_UNREAD = 6;
public function setUpPage() public function setUpPage()
{ {
$url = $this->getURLPageFirstFeed(); $url = $this->getURLPageFirstFeed();
parent::setUpPage($url); $this->doLoginIfRequired($url);
$this->basePageHeading = $this->getBasePageHeading(); $this->basePageHeading = $this->getBasePageHeading();
$this->expectedPageUrl = $url; $this->expectedPageUrl = $url;
} }
@ -24,127 +24,127 @@ class keyboardShortcutTest extends minifluxTestCase
public function testNextItemShortcutA() public function testNextItemShortcutA()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[0]); $this->setArticleAsCurrentArticle($articles[0]);
$this->keys($this->getShortcutNextItemA()); $this->keys($this->getShortcutNextItemA());
$firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]); $firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]);
$secondIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[1]); $secondIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[1]);
$this->assertTrue($firstIsNotCurrentArticle, 'The first Article is still the current Article'); $this->assertTrue($firstIsNotCurrentArticle, 'The first Article is still the current Article');
$this->assertTrue($secondIsCurrentArticle, 'The second Article is not the current Article'); $this->assertTrue($secondIsCurrentArticle, 'The second Article is not the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testNextItemShortcutB() public function testNextItemShortcutB()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[0]); $this->setArticleAsCurrentArticle($articles[0]);
$this->keys($this->getShortcutNextItemB()); $this->keys($this->getShortcutNextItemB());
$firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]); $firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]);
$secondIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[1]); $secondIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[1]);
$this->assertTrue($firstIsNotCurrentArticle, 'The first Article is still the current Article'); $this->assertTrue($firstIsNotCurrentArticle, 'The first Article is still the current Article');
$this->assertTrue($secondIsCurrentArticle, 'The second Article is not the current Article'); $this->assertTrue($secondIsCurrentArticle, 'The second Article is not the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1');; $this->expectedDataSet = $this->getDataSet('fixture_feed1');;
} }
public function testPreviousItemA() public function testPreviousItemA()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[1]); $this->setArticleAsCurrentArticle($articles[1]);
$this->keys($this->getShortcutPreviousItemA()); $this->keys($this->getShortcutPreviousItemA());
$firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]); $firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]);
$secondIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[1]); $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->assertTrue($secondIsNotCurrentArticle, 'The second Article is still the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testPreviousItemB() public function testPreviousItemB()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$this->setArticleAsCurrentArticle($articles[1]); $this->setArticleAsCurrentArticle($articles[1]);
$this->keys($this->getShortcutPreviousItemB()); $this->keys($this->getShortcutPreviousItemB());
$firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]); $firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]);
$secondIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[1]); $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->assertTrue($secondIsNotCurrentArticle, 'The second Article is still the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testNextStopsAtLastArticle() public function testNextStopsAtLastArticle()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$lastIndex = count($articles) - 1; $lastIndex = count($articles) - 1;
$this->setArticleAsCurrentArticle($articles[$lastIndex]); $this->setArticleAsCurrentArticle($articles[$lastIndex]);
$this->keys($this->getShortcutNextItemA()); $this->keys($this->getShortcutNextItemA());
$firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]); $firstIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[0]);
$lastIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[$lastIndex]); $lastIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[$lastIndex]);
$this->assertTrue($firstIsNotCurrentArticle, 'The first Article is still the current Article'); $this->assertTrue($firstIsNotCurrentArticle, 'The first Article is still the current Article');
$this->assertTrue($lastIsCurrentArticle, 'The last Article is not the current Article'); $this->assertTrue($lastIsCurrentArticle, 'The last Article is not the current Article');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testPreviousStopsAtFirstArticle() public function testPreviousStopsAtFirstArticle()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$lastIndex = count($articles) - 1; $lastIndex = count($articles) - 1;
$this->setArticleAsCurrentArticle($articles[0]); $this->setArticleAsCurrentArticle($articles[0]);
$this->keys($this->getShortcutPreviousItemA()); $this->keys($this->getShortcutPreviousItemA());
$lastIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[$lastIndex]); $lastIsNotCurrentArticle = $this->waitForArticleIsNotCurrentArticle($articles[$lastIndex]);
$firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]); $firstIsCurrentArticle = $this->waitForArticleIsCurrentArticle($articles[0]);
$this->assertTrue($lastIsNotCurrentArticle, 'The last Article is still the current Article'); $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->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testShortcutsOnInputFiledAreDisabled() public function testShortcutsOnInputFiledAreDisabled()
{ {
$url = $this->getURLPagePreferences(); $url = $this->getURLPagePreferences();
$this->url($url); $this->url($url);
$this->byId('form-username')->value($this->getShortcutGoToUnread()); $this->byId('form-username')->value($this->getShortcutGoToUnread());
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $url; $this->expectedPageUrl = $url;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
public function testGoToBookmarks() public function testGoToBookmarks()
{ {
$this->sendKeysAndWaitForPageLoaded('gb'); $this->sendKeysAndWaitForPageLoaded('gb');
@ -153,34 +153,34 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPageBookmarks(); $this->expectedPageUrl = $this->getURLPageBookmarks();
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
public function testGoToHistory() public function testGoToHistory()
{ {
$this->sendKeysAndWaitForPageLoaded('gh'); $this->sendKeysAndWaitForPageLoaded('gh');
$this->expectedCounterPage = '6'; $this->expectedCounterPage = '6';
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPageHistory(); $this->expectedPageUrl = $this->getURLPageHistory();
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
public function testGoToUnread() public function testGoToUnread()
{ {
$this->sendKeysAndWaitForPageLoaded($this->getShortcutGoToUnread()); $this->sendKeysAndWaitForPageLoaded($this->getShortcutGoToUnread());
$this->expectedCounterPage = '6'; $this->expectedCounterPage = '6';
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPageUnread(); $this->expectedPageUrl = $this->getURLPageUnread();
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
public function testGoToSubscriptions() public function testGoToSubscriptions()
{ {
$this->sendKeysAndWaitForPageLoaded('gs'); $this->sendKeysAndWaitForPageLoaded('gs');
@ -188,18 +188,18 @@ class keyboardShortcutTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds'; $this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds';
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
public function testGoToPreferences() public function testGoToPreferences()
{ {
$this->sendKeysAndWaitForPageLoaded('gp'); $this->sendKeysAndWaitForPageLoaded('gp');
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedPageUrl = $this->getURLPagePreferences(); $this->expectedPageUrl = $this->getURLPagePreferences();
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
} }

View File

@ -7,34 +7,32 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
protected $expectedDataSet = NULL; protected $expectedDataSet = NULL;
protected $expectedCounterPage = NULL; protected $expectedCounterPage = NULL;
protected $expectedCounterUnread = ''; protected $expectedCounterUnread = '';
protected $ignorePageTitle = FALSE; protected $ignorePageTitle = FALSE;
protected static $databaseConnection = NULL; protected static $databaseConnection = NULL;
protected static $databaseTester = NULL; protected static $databaseTester = NULL;
private $waitTimeout = 5000; private $waitTimeout = 5000;
public static function browsers() public static function browsers()
{ {
return json_decode(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BROWSERS, true); return json_decode(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BROWSERS, true);
} }
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
// trigger database fixtures onSetUp routines // trigger database fixtures onSetUp routines
$this->getDatabaseTester('fixture_feed1', TRUE)->onSetUp(); $this->getDatabaseTester('fixture_feed1', TRUE)->onSetUp();
// Set the base URL for the tests. // Set the base URL for the tests.
$this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL); $this->setBrowserUrl(PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL);
} }
public function setUpPage($url) public function doLoginIfRequired($url)
{ {
parent::setUpPage();
// (re)load the requested page // (re)load the requested page
$this->url($url); $this->url($url);
@ -43,13 +41,13 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
if (count($elements) === 1) { if (count($elements) === 1) {
$this->url('?action=select-db&database='.DB_FILENAME); $this->url('?action=select-db&database='.DB_FILENAME);
$this->byId('form-username')->click(); $this->byId('form-username')->click();
$this->keys('admin'); $this->keys('admin');
$this->byId('form-password')->click(); $this->byId('form-password')->click();
$this->keys('admin'); $this->keys('admin');
$this->byTag('form')->submit(); $this->byTag('form')->submit();
$this->url($url); $this->url($url);
} }
} }
@ -59,13 +57,13 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
static::$databaseConnection = NULL; static::$databaseConnection = NULL;
static::$databaseTester = NULL; static::$databaseTester = NULL;
} }
protected function assertPostConditions() protected function assertPostConditions()
{ {
// counter exists on every page // counter exists on every page
$this->assertEquals($this->expectedCounterPage, $this->getCounterPage(), 'page-counter differ from expectation'); $this->assertEquals($this->expectedCounterPage, $this->getCounterPage(), 'page-counter differ from expectation');
$this->assertEquals($this->expectedCounterUnread, $this->getCounterUnread(), 'unread counter differ from expectation'); $this->assertEquals($this->expectedCounterUnread, $this->getCounterUnread(), 'unread counter differ from expectation');
// url has not been changed (its likely that everything was done via javascript then) // url has not been changed (its likely that everything was done via javascript then)
$this->assertEquals($this->expectedPageUrl, $this->url(), 'URL has been changed.'); $this->assertEquals($this->expectedPageUrl, $this->url(), 'URL has been changed.');
@ -76,16 +74,16 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$pagetitle = preg_replace('/\x{200E}/u', '', $this->title()); $pagetitle = preg_replace('/\x{200E}/u', '', $this->title());
$this->assertEquals($this->getExpectedPageTitle(), $pagetitle, 'page title differ from expectation'); $this->assertEquals($this->getExpectedPageTitle(), $pagetitle, 'page title differ from expectation');
} }
// assert that the current database matches the expected database // assert that the current database matches the expected database
$expectedDataSetFiltered = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($this->expectedDataSet); $expectedDataSetFiltered = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($this->expectedDataSet);
$expectedDataSetFiltered->addIncludeTables(array('items')); $expectedDataSetFiltered->addIncludeTables(array('items'));
$expectedDataSetFiltered->setExcludeColumnsForTable('items', array('updated')); $expectedDataSetFiltered->setExcludeColumnsForTable('items', array('updated'));
// TODO: changes row order, why? // TODO: changes row order, why?
//$actualDataSet = $this->getConnection()->createDataSet(); //$actualDataSet = $this->getConnection()->createDataSet();
$actualDataSet = new PHPUnit_Extensions_Database_DataSet_QueryDataSet($this->getConnection()); $actualDataSet = new PHPUnit_Extensions_Database_DataSet_QueryDataSet($this->getConnection());
$actualDataSet->addTable('items', 'SELECT * FROM items'); $actualDataSet->addTable('items', 'SELECT * FROM items');
$actualDataSetFiltered = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($actualDataSet); $actualDataSetFiltered = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($actualDataSet);
$actualDataSetFiltered->setExcludeColumnsForTable('items', array('updated')); $actualDataSetFiltered->setExcludeColumnsForTable('items', array('updated'));
@ -98,22 +96,22 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$ds1 = new PHPUnit_Extensions_Database_DataSet_XmlDataSet(dirname(__FILE__).DIRECTORY_SEPARATOR.'datasets'.DIRECTORY_SEPARATOR.$dataSetFile.'.xml'); $ds1 = new PHPUnit_Extensions_Database_DataSet_XmlDataSet(dirname(__FILE__).DIRECTORY_SEPARATOR.'datasets'.DIRECTORY_SEPARATOR.$dataSetFile.'.xml');
$compositeDs->addDataSet($ds1); $compositeDs->addDataSet($ds1);
if ($appendFeed2) { if ($appendFeed2) {
// feed2 should be normaly untouched // feed2 should be normaly untouched
$ds2 = new PHPUnit_Extensions_Database_DataSet_XmlDataSet(dirname(__FILE__).DIRECTORY_SEPARATOR.'datasets'.DIRECTORY_SEPARATOR.'fixture_feed2.xml'); $ds2 = new PHPUnit_Extensions_Database_DataSet_XmlDataSet(dirname(__FILE__).DIRECTORY_SEPARATOR.'datasets'.DIRECTORY_SEPARATOR.'fixture_feed2.xml');
$compositeDs->addDataSet($ds2); $compositeDs->addDataSet($ds2);
} }
return $compositeDs; return $compositeDs;
} }
protected function getConnection() protected function getConnection()
{ {
if (is_null(static::$databaseConnection)) { if (is_null(static::$databaseConnection)) {
// let Miniflux setup the database // let Miniflux setup the database
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common.php'; require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'common.php';
if (!ENABLE_MULTIPLE_DB) { if (!ENABLE_MULTIPLE_DB) {
throw new Exception('Enable multiple databases support to run the tests!'); throw new Exception('Enable multiple databases support to run the tests!');
} }
@ -128,17 +126,17 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
// make the database world writeable, maybe the current // make the database world writeable, maybe the current
// user != webserver user // user != webserver user
chmod(\Model\Database\get_path(), 0666); chmod(\Model\Database\get_path(), 0666);
// get pdo object // get pdo object
$pdo = $picoDb->getConnection(); $pdo = $picoDb->getConnection();
// disable fsync! its awefull slow without transactions and I found // disable fsync! its awefull slow without transactions and I found
// no way to use setDataSet function with transactions // no way to use setDataSet function with transactions
$pdo->exec("pragma synchronous = off;"); $pdo->exec("pragma synchronous = off;");
static::$databaseConnection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'sqlite'); static::$databaseConnection = new PHPUnit_Extensions_Database_DB_DefaultDatabaseConnection($pdo, 'sqlite');
} }
return static::$databaseConnection; return static::$databaseConnection;
} }
@ -153,29 +151,29 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$rdataset = new PHPUnit_Extensions_Database_DataSet_ReplacementDataSet($dataset); $rdataset = new PHPUnit_Extensions_Database_DataSet_ReplacementDataSet($dataset);
$rdataset->addSubStrReplacement('##TIMESTAMP##', substr((string)(time()-100), 0, -2)); $rdataset->addSubStrReplacement('##TIMESTAMP##', substr((string)(time()-100), 0, -2));
$tester->setDataSet($rdataset); $tester->setDataSet($rdataset);
static::$databaseTester = $tester; static::$databaseTester = $tester;
} }
return static::$databaseTester; return static::$databaseTester;
} }
private function getCounterUnread() private function getCounterUnread()
{ {
$value = $this->element($this->using('id')->value('nav-counter'))->text(); $value = $this->element($this->using('id')->value('nav-counter'))->text();
return $value; return $value;
} }
private function getCounterPage() private function getCounterPage()
{ {
$value = NULL; $value = NULL;
$elements = $this->elements($this->using('id')->value('page-counter')); $elements = $this->elements($this->using('id')->value('page-counter'));
if (count($elements) === 1) { if (count($elements) === 1) {
$value = $elements[0]->text(); $value = $elements[0]->text();
} }
return $value; return $value;
} }
@ -224,10 +222,10 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
try { try {
// Workaround for PHP < 5.4 // Workaround for PHP < 5.4
$CI = $this; $CI = $this;
$value = $this->waitUntil(function() use($cssSelector, $elementCount, $CI) { $value = $this->waitUntil(function() use($cssSelector, $elementCount, $CI) {
$elements = $CI->elements($CI->using('css selector')->value($cssSelector)); $elements = $CI->elements($CI->using('css selector')->value($cssSelector));
if (count($elements) === $elementCount) { if (count($elements) === $elementCount) {
return TRUE; return TRUE;
} }
@ -243,14 +241,14 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
return $value; return $value;
} }
private function waitForElementAttributeHasValue($element, $attribute, $attributeValue, $invertMatch = FALSE) private function waitForElementAttributeHasValue($element, $attribute, $attributeValue, $invertMatch = FALSE)
{ {
// return false in case of timeout // return false in case of timeout
try { try {
$value = $this->waitUntil(function() use($element, $attribute, $attributeValue, $invertMatch) { $value = $this->waitUntil(function() use($element, $attribute, $attributeValue, $invertMatch) {
$attributeHasValue = ($element->attribute($attribute) === $attributeValue); $attributeHasValue = ($element->attribute($attribute) === $attributeValue);
if (($attributeHasValue && !$invertMatch) || (!$attributeHasValue && $invertMatch)) { if (($attributeHasValue && !$invertMatch) || (!$attributeHasValue && $invertMatch)) {
return TRUE; return TRUE;
} }
@ -263,10 +261,10 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
throw $e; throw $e;
} }
} }
return $value; return $value;
} }
private function waitForIconMarkRead($article, $visible) private function waitForIconMarkRead($article, $visible)
{ {
$icon = $article->elements($article->using('css selector')->value('span.read-icon')); $icon = $article->elements($article->using('css selector')->value('span.read-icon'));
@ -290,13 +288,13 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
* the text of its childs. Thats why we have to differ between * the text of its childs. Thats why we have to differ between
* pageheadings with counter and without counter. * pageheadings with counter and without counter.
*/ */
// text of its childs // text of its childs
$pageHeading = $this->byCssSelector('div.page-header > h2:first-child')->text(); $pageHeading = $this->byCssSelector('div.page-header > h2:first-child')->text();
// Some PageHeadings have a counter included // Some PageHeadings have a counter included
$innerHeadingElements = $this->elements($this->using('css selector')->value('div.page-header > h2:first-child *')); $innerHeadingElements = $this->elements($this->using('css selector')->value('div.page-header > h2:first-child *'));
if (count($innerHeadingElements) > 0) if (count($innerHeadingElements) > 0)
{ {
$innerHeading = $innerHeadingElements[0]->text(); $innerHeading = $innerHeadingElements[0]->text();
@ -325,7 +323,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
{ {
return PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feed-items&feed_id=1'; return PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feed-items&feed_id=1';
} }
public function getURLPagePreferences() public function getURLPagePreferences()
{ {
return PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=config'; return PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=config';
@ -340,7 +338,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
{ {
return 'j'; return 'j';
} }
public function getShortcutPreviousItemA() public function getShortcutPreviousItemA()
{ {
return 'p'; return 'p';
@ -355,17 +353,17 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
{ {
return 'm'; return 'm';
} }
public function getShortcutToogleBookmarkStatus() public function getShortcutToogleBookmarkStatus()
{ {
return 'f'; return 'f';
} }
public function getShortcutGoToUnread() public function getShortcutGoToUnread()
{ {
return 'gu'; return 'gu';
} }
public function getArticles() public function getArticles()
{ {
$cssSelector = 'article'; $cssSelector = 'article';
@ -373,39 +371,39 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$articles = $this->elements($this->using('css selector')->value($cssSelector)); $articles = $this->elements($this->using('css selector')->value($cssSelector));
return $articles; return $articles;
} }
public function getArticlesUnread() public function getArticlesUnread()
{ {
$cssSelector = 'article[data-item-status="unread"]'; $cssSelector = 'article[data-item-status="unread"]';
$articles = $this->elements($this->using('css selector')->value($cssSelector)); $articles = $this->elements($this->using('css selector')->value($cssSelector));
return $articles; return $articles;
} }
public function getArticlesRead() public function getArticlesRead()
{ {
$cssSelector = 'article[data-item-status="read"]'; $cssSelector = 'article[data-item-status="read"]';
$articles = $this->elements($this->using('css selector')->value($cssSelector)); $articles = $this->elements($this->using('css selector')->value($cssSelector));
return $articles; return $articles;
} }
public function getArticlesNotBookmarked() public function getArticlesNotBookmarked()
{ {
$cssSelector = 'article[data-item-bookmark="0"]'; $cssSelector = 'article[data-item-bookmark="0"]';
$articles = $this->elements($this->using('css selector')->value($cssSelector)); $articles = $this->elements($this->using('css selector')->value($cssSelector));
return $articles; return $articles;
} }
public function getArticlesNotFromFeedOne() public function getArticlesNotFromFeedOne()
{ {
$cssSelector = 'article:not(.feed-1)'; $cssSelector = 'article:not(.feed-1)';
$articles = $this->elements($this->using('css selector')->value($cssSelector)); $articles = $this->elements($this->using('css selector')->value($cssSelector));
return $articles; return $articles;
} }
public function getArticleUnreadNotBookmarked() public function getArticleUnreadNotBookmarked()
{ {
$cssSelector = 'article[data-item-id="7c6afaa5"]'; $cssSelector = 'article[data-item-id="7c6afaa5"]';
@ -413,11 +411,11 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$article = $this->element($this->using('css selector')->value($cssSelector)); $article = $this->element($this->using('css selector')->value($cssSelector));
return $article; return $article;
} }
public function getArticleReadNotBookmarked() public function getArticleReadNotBookmarked()
{ {
$cssSelector = 'article[data-item-id="9b20eb66"]'; $cssSelector = 'article[data-item-id="9b20eb66"]';
$article = $this->element($this->using('css selector')->value($cssSelector)); $article = $this->element($this->using('css selector')->value($cssSelector));
return $article; return $article;
} }
@ -425,7 +423,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
public function getArticleUnreadBookmarked() public function getArticleUnreadBookmarked()
{ {
$cssSelector = 'article[data-item-id="7cb2809d"]'; $cssSelector = 'article[data-item-id="7cb2809d"]';
$article = $this->element($this->using('css selector')->value($cssSelector)); $article = $this->element($this->using('css selector')->value($cssSelector));
return $article; return $article;
} }
@ -455,31 +453,31 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$link = $article->element($article->using('css selector')->value('a.delete')); $link = $article->element($article->using('css selector')->value('a.delete'));
return $link; return $link;
} }
public function getLinkFeedMarkReadHeader() public function getLinkFeedMarkReadHeader()
{ {
$link = $this->element($this->using('css selector')->value('div.page-header a[data-action="mark-feed-read"]')); $link = $this->element($this->using('css selector')->value('div.page-header a[data-action="mark-feed-read"]'));
return $link; return $link;
} }
public function getLinkFeedMarkReadBottom() public function getLinkFeedMarkReadBottom()
{ {
$link = $this->element($this->using('css selector')->value('div#bottom-menu a[data-action="mark-feed-read"]')); $link = $this->element($this->using('css selector')->value('div#bottom-menu a[data-action="mark-feed-read"]'));
return $link; return $link;
} }
public function getLinkMarkAllReadHeader() public function getLinkMarkAllReadHeader()
{ {
$link = $this->element($this->using('css selector')->value('div.page-header a[data-action="mark-all-read"]')); $link = $this->element($this->using('css selector')->value('div.page-header a[data-action="mark-all-read"]'));
return $link; return $link;
} }
public function getLinkMarkAllReadBottom() public function getLinkMarkAllReadBottom()
{ {
$link = $this->element($this->using('css selector')->value('div#bottom-menu a[data-action="mark-all-read"]')); $link = $this->element($this->using('css selector')->value('div#bottom-menu a[data-action="mark-all-read"]'));
return $link; return $link;
} }
public function getLinkFlushHistory() public function getLinkFlushHistory()
{ {
$link = $this->element($this->using('css selector')->value('div.page-header a[href="?action=confirm-flush-history"]')); $link = $this->element($this->using('css selector')->value('div.page-header a[href="?action=confirm-flush-history"]'));
@ -491,19 +489,19 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$link = $this->element($this->using('css selector')->value('a.btn-red')); $link = $this->element($this->using('css selector')->value('a.btn-red'));
return $link; return $link;
} }
public function waitForArticleIsCurrentArticle($article) public function waitForArticleIsCurrentArticle($article)
{ {
$isCurrent = $this->waitForElementAttributeHasValue($article, 'id', 'current-item'); $isCurrent = $this->waitForElementAttributeHasValue($article, 'id', 'current-item');
return $isCurrent; return $isCurrent;
} }
public function waitForArticleIsNotCurrentArticle($article) public function waitForArticleIsNotCurrentArticle($article)
{ {
$isCurrent = $this->waitForElementAttributeHasValue($article, 'id', 'current-item', TRUE); $isCurrent = $this->waitForElementAttributeHasValue($article, 'id', 'current-item', TRUE);
return $isCurrent; return $isCurrent;
} }
public function waitForIconMarkReadVisible($article) public function waitForIconMarkReadVisible($article)
{ {
$visible = $this->waitForIconMarkRead($article, TRUE); $visible = $this->waitForIconMarkRead($article, TRUE);
@ -533,27 +531,27 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
$invisible = $this->waitForElementVisibility($article, FALSE); $invisible = $this->waitForElementVisibility($article, FALSE);
return $invisible; return $invisible;
} }
public function waitForArticlesMarkRead() public function waitForArticlesMarkRead()
{ {
$cssSelector = 'article[data-item-status="unread"]'; $cssSelector = 'article[data-item-status="unread"]';
$read = $this->waitForElementCountByCssSelector($cssSelector, 0); $read = $this->waitForElementCountByCssSelector($cssSelector, 0);
return $read; return $read;
} }
public function waitForAlert() public function waitForAlert()
{ {
$cssSelector = 'p.alert'; $cssSelector = 'p.alert';
$visible = $this->waitForElementCountByCssSelector($cssSelector, 1); $visible = $this->waitForElementCountByCssSelector($cssSelector, 1);
return $visible; return $visible;
} }
public function sendKeysAndWaitForPageLoaded($keys) public function sendKeysAndWaitForPageLoaded($keys)
{ {
$this->keys($keys); $this->keys($keys);
// Workaround for PHP < 5.4 // Workaround for PHP < 5.4
$CI = $this; $CI = $this;
@ -566,9 +564,9 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
if ($readyState === 'complete') { if ($readyState === 'complete') {
return TRUE; return TRUE;
} }
}, $this->waitTimeout); }, $this->waitTimeout);
} }
public function setArticleAsCurrentArticle($article) public function setArticleAsCurrentArticle($article)
{ {
$script = 'document.getElementById("' .$article->attribute('id') .'").id = "current-item";' $script = 'document.getElementById("' .$article->attribute('id') .'").id = "current-item";'
@ -578,7 +576,7 @@ abstract class minifluxTestCase extends PHPUnit_Extensions_Selenium2TestCase
'script' => $script, 'script' => $script,
'args' => array() 'args' => array()
)); ));
$result = $this->waitForArticleIsCurrentArticle($article); $result = $this->waitForArticleIsCurrentArticle($article);
if ($result === FALSE) { if ($result === FALSE) {
throw new Exception('the article could not be set as current article.'); throw new Exception('the article could not be set as current article.');

View File

@ -6,12 +6,12 @@ class pageBookmarksTest extends minifluxTestCase
{ {
const DEFAULT_COUNTER_PAGE = 6; const DEFAULT_COUNTER_PAGE = 6;
const DEFAULT_COUNTER_UNREAD = 6; const DEFAULT_COUNTER_UNREAD = 6;
public function setUpPage() public function setUpPage()
{ {
$url = $this->getURLPageBookmarks(); $url = $this->getURLPageBookmarks();
parent::setUpPage($url); $this->doLoginIfRequired($url);
$this->basePageHeading = $this->getBasePageHeading(); $this->basePageHeading = $this->getBasePageHeading();
$this->expectedPageUrl = $url; $this->expectedPageUrl = $url;
} }
@ -25,22 +25,22 @@ class pageBookmarksTest extends minifluxTestCase
{ {
$articles = $this->getArticlesNotFromFeedOne(); $articles = $this->getArticlesNotFromFeedOne();
$this->assertNotEmpty($articles, 'no articles from other feeds found'); $this->assertNotEmpty($articles, 'no articles from other feeds found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testOnlyBookmarkedArticles() public function testOnlyBookmarkedArticles()
{ {
$articles = $this->getArticlesNotBookmarked(); $articles = $this->getArticlesNotBookmarked();
$this->assertEmpty($articles, 'found not bookmarked articles.'); $this->assertEmpty($articles, 'found not bookmarked articles.');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testMarkReadBookmarkedArticleLink() public function testMarkReadBookmarkedArticleLink()
{ {
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
@ -59,10 +59,10 @@ class pageBookmarksTest extends minifluxTestCase
public function testMarkReadBookmarkedArticleKeyboard() public function testMarkReadBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
$visible = $this->waitForIconMarkReadVisible($article); $visible = $this->waitForIconMarkReadVisible($article);
$this->assertTrue($visible, 'read icon is not visible'); $this->assertTrue($visible, 'read icon is not visible');
@ -89,7 +89,7 @@ class pageBookmarksTest extends minifluxTestCase
public function testMarkUnreadBookmarkedArticleKeyboard() public function testMarkUnreadBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleReadBookmarked(); $article = $this->getArticleReadBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
@ -114,7 +114,7 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle'); $this->expectedDataSet = $this->getDataSet('expected_UnbookmarkReadArticle');
} }
public function testUnbookmarkReadArticleKeyboard() public function testUnbookmarkReadArticleKeyboard()
@ -141,7 +141,7 @@ class pageBookmarksTest extends minifluxTestCase
$invisible = $this->waitForArticleInvisible($article); $invisible = $this->waitForArticleInvisible($article);
$this->assertTrue($invisible, 'bookmark icon is not invisible'); $this->assertTrue($invisible, 'bookmark icon is not invisible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle'); $this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
@ -191,27 +191,27 @@ class pageBookmarksTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle'); $this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
} }
public function testUnreadCounterFromNothingToValue() public function testUnreadCounterFromNothingToValue()
{ {
// load different fixture and reload the page // load different fixture and reload the page
$backupDataTester = static::$databaseTester; $backupDataTester = static::$databaseTester;
static::$databaseTester = NULL; static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp(); $this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
static::$databaseTester = $backupDataTester; static::$databaseTester = $backupDataTester;
$this->refresh(); $this->refresh();
// start the "real" test // start the "real" test
// dont't trust the name! The Article is read+bookmarked here // dont't trust the name! The Article is read+bookmarked here
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$link = $this->getLinkReadStatusToogle($article); $link = $this->getLinkReadStatusToogle($article);
$link->click(); $link->click();
$this->waitForIconMarkReadInvisible($article); $this->waitForIconMarkReadInvisible($article);
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 1; $this->expectedCounterUnread = 1;
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE); $this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
@ -221,40 +221,40 @@ class pageBookmarksTest extends minifluxTestCase
{ {
// load different fixture and reload the page // load different fixture and reload the page
$backupDataTester = static::$databaseTester; $backupDataTester = static::$databaseTester;
static::$databaseTester = NULL; static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp(); $this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp();
static::$databaseTester = $backupDataTester; static::$databaseTester = $backupDataTester;
$this->refresh(); $this->refresh();
// start the "real" test // start the "real" test
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$link = $this->getLinkReadStatusToogle($article); $link = $this->getLinkReadStatusToogle($article);
$link->click(); $link->click();
$this->waitForIconMarkReadVisible($article); $this->waitForIconMarkReadVisible($article);
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = ''; $this->expectedCounterUnread = '';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE); $this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE);
} }
public function testRedirectWithZeroArticles() public function testRedirectWithZeroArticles()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
foreach($articles as $article) { foreach($articles as $article) {
$link = $this->getLinkBookmarkStatusToogle($article); $link = $this->getLinkBookmarkStatusToogle($article);
$link->click(); $link->click();
$this->waitForArticleInvisible($article); $this->waitForArticleInvisible($article);
} }
$visible = $this->waitForAlert(); $visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear'); $this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL; $this->expectedCounterPage = NULL;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_NoBookmarkedArticles', FALSE); $this->expectedDataSet = $this->getDataSet('expected_NoBookmarkedArticles', FALSE);

View File

@ -6,13 +6,13 @@ class pageFirstFeedTest extends minifluxTestCase
{ {
const DEFAULT_COUNTER_PAGE = 8; const DEFAULT_COUNTER_PAGE = 8;
const DEFAULT_COUNTER_UNREAD = 6; const DEFAULT_COUNTER_UNREAD = 6;
public function setUpPage() public function setUpPage()
{ {
$url = $this->getURLPageFirstFeed(); $url = $this->getURLPageFirstFeed();
parent::setUpPage($url); $this->doLoginIfRequired($url);
$this->basePageHeading = $this->getBasePageHeading(); $this->basePageHeading = $this->getBasePageHeading();
$this->expectedPageUrl = $url; $this->expectedPageUrl = $url;
} }
@ -25,12 +25,12 @@ class pageFirstFeedTest extends minifluxTestCase
{ {
$articles = $this->getArticlesNotFromFeedOne(); $articles = $this->getArticlesNotFromFeedOne();
$this->assertEmpty($articles, 'found articles from other feeds on page for first feed.'); $this->assertEmpty($articles, 'found articles from other feeds on page for first feed.');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testMarkReadNotBookmarkedArticleLink() public function testMarkReadNotBookmarkedArticleLink()
{ {
$article = $this->getArticleUnreadNotBookmarked(); $article = $this->getArticleUnreadNotBookmarked();
@ -49,18 +49,18 @@ class pageFirstFeedTest extends minifluxTestCase
public function testMarkReadNotBookmarkedArticleKeyboard() public function testMarkReadNotBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleUnreadNotBookmarked(); $article = $this->getArticleUnreadNotBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
$visible = $this->waitForIconMarkReadVisible($article); $visible = $this->waitForIconMarkReadVisible($article);
$this->assertTrue($visible, 'read icon is not visible'); $this->assertTrue($visible, 'read icon is not visible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle'); $this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
} }
public function testMarkReadBookmarkedArticleLink() public function testMarkReadBookmarkedArticleLink()
{ {
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
@ -79,10 +79,10 @@ class pageFirstFeedTest extends minifluxTestCase
public function testMarkReadBookmarkedArticleKeyboard() public function testMarkReadBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
$visible = $this->waitForIconMarkReadVisible($article); $visible = $this->waitForIconMarkReadVisible($article);
$this->assertTrue($visible, 'read icon is not visible'); $this->assertTrue($visible, 'read icon is not visible');
@ -105,11 +105,11 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle'); $this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
} }
public function testMarkUnreadNotBookmarkedArticleKeyboard() public function testMarkUnreadNotBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleReadNotBookmarked(); $article = $this->getArticleReadNotBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
@ -139,7 +139,7 @@ class pageFirstFeedTest extends minifluxTestCase
public function testMarkUnreadBookmarkedArticleKeyboard() public function testMarkUnreadBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleReadBookmarked(); $article = $this->getArticleReadBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
@ -165,7 +165,7 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle'); $this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
} }
public function testBookmarkReadArticleKeyboard() public function testBookmarkReadArticleKeyboard()
{ {
$article = $this->getArticleReadNotBookmarked(); $article = $this->getArticleReadNotBookmarked();
@ -330,15 +330,15 @@ class pageFirstFeedTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle'); $this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
} }
public function testMarkFeedReadHeaderLink() public function testMarkFeedReadHeaderLink()
{ {
$link = $this->getLinkFeedMarkReadHeader(); $link = $this->getLinkFeedMarkReadHeader();
$link->click(); $link->click();
$read = $this->waitForArticlesMarkRead(); $read = $this->waitForArticlesMarkRead();
$this->assertTrue($read, 'there are still unread articles'); $this->assertTrue($read, 'there are still unread articles');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 2; $this->expectedCounterUnread = 2;
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead'); $this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead');
@ -348,35 +348,35 @@ class pageFirstFeedTest extends minifluxTestCase
{ {
$link = $this->getLinkFeedMarkReadBottom(); $link = $this->getLinkFeedMarkReadBottom();
$link->click(); $link->click();
$read = $this->waitForArticlesMarkRead(); $read = $this->waitForArticlesMarkRead();
$this->assertTrue($read, 'there are still unread articles'); $this->assertTrue($read, 'there are still unread articles');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 2; $this->expectedCounterUnread = 2;
$this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead'); $this->expectedDataSet = $this->getDataSet('expected_MarkFeedRead');
} }
public function testUnreadCounterFromNothingToValue() public function testUnreadCounterFromNothingToValue()
{ {
// load different fixture and reload the page // load different fixture and reload the page
$backupDataTester = static::$databaseTester; $backupDataTester = static::$databaseTester;
static::$databaseTester = NULL; static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp(); $this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
static::$databaseTester = $backupDataTester; static::$databaseTester = $backupDataTester;
$this->refresh(); $this->refresh();
// start the "real" test // start the "real" test
// dont't trust the name! The Article is read+bookmarked here // dont't trust the name! The Article is read+bookmarked here
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$link = $this->getLinkReadStatusToogle($article); $link = $this->getLinkReadStatusToogle($article);
$link->click(); $link->click();
$this->waitForIconMarkReadInvisible($article); $this->waitForIconMarkReadInvisible($article);
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = 1; $this->expectedCounterUnread = 1;
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE); $this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
@ -386,45 +386,45 @@ class pageFirstFeedTest extends minifluxTestCase
{ {
// load different fixture and reload the page // load different fixture and reload the page
$backupDataTester = static::$databaseTester; $backupDataTester = static::$databaseTester;
static::$databaseTester = NULL; static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp(); $this->getDatabaseTester('fixture_OneUnreadArticle', FALSE)->onSetUp();
static::$databaseTester = $backupDataTester; static::$databaseTester = $backupDataTester;
$this->refresh(); $this->refresh();
// start the "real" test // start the "real" test
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$link = $this->getLinkReadStatusToogle($article); $link = $this->getLinkReadStatusToogle($article);
$link->click(); $link->click();
$this->waitForIconMarkReadVisible($article); $this->waitForIconMarkReadVisible($article);
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = ''; $this->expectedCounterUnread = '';
$this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE); $this->expectedDataSet = $this->getDataSet('fixture_OnlyReadArticles',FALSE);
} }
public function testRedirectWithZeroArticles() public function testRedirectWithZeroArticles()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$this->assertGreaterThanOrEqual(1, count($articles), 'no articles found'); $this->assertGreaterThanOrEqual(1, count($articles), 'no articles found');
foreach($articles as $article) { foreach($articles as $article) {
$link = $this->getLinkRemove($article); $link = $this->getLinkRemove($article);
$link->click(); $link->click();
$this->waitForArticleInvisible($article); $this->waitForArticleInvisible($article);
} }
$visible = $this->waitForAlert(); $visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear'); $this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL; $this->expectedCounterPage = NULL;
$this->expectedCounterUnread = 2; $this->expectedCounterUnread = 2;
$this->expectedDataSet = $this->getDataSet('expected_FirstFeedAllRemoved'); $this->expectedDataSet = $this->getDataSet('expected_FirstFeedAllRemoved');
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
} }

View File

@ -6,13 +6,13 @@ class pageHistoryTest extends minifluxTestCase
{ {
const DEFAULT_COUNTER_PAGE = 6; const DEFAULT_COUNTER_PAGE = 6;
const DEFAULT_COUNTER_UNREAD = 6; const DEFAULT_COUNTER_UNREAD = 6;
public function setUpPage() public function setUpPage()
{ {
$url = $this->getURLPageHistory(); $url = $this->getURLPageHistory();
parent::setUpPage($url); $this->doLoginIfRequired($url);;
$this->basePageHeading = $this->getBasePageHeading(); $this->basePageHeading = $this->getBasePageHeading();
$this->expectedPageUrl = $url; $this->expectedPageUrl = $url;
} }
@ -25,22 +25,22 @@ class pageHistoryTest extends minifluxTestCase
{ {
$articles = $this->getArticlesNotFromFeedOne(); $articles = $this->getArticlesNotFromFeedOne();
$this->assertNotEmpty($articles, 'no articles from other feeds found'); $this->assertNotEmpty($articles, 'no articles from other feeds found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testOnlyReadArticles() public function testOnlyReadArticles()
{ {
$articles = $this->getArticlesUnread(); $articles = $this->getArticlesUnread();
$this->assertEmpty($articles, 'found unread articles.'); $this->assertEmpty($articles, 'found unread articles.');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testMarkUnreadNotBookmarkedArticleLink() public function testMarkUnreadNotBookmarkedArticleLink()
{ {
$article = $this->getArticleReadNotBookmarked(); $article = $this->getArticleReadNotBookmarked();
@ -55,11 +55,11 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle'); $this->expectedDataSet = $this->getDataSet('expected_MarkUnreadNotBookmarkedArticle');
} }
public function testMarkUnreadNotBookmarkedArticleKeyboard() public function testMarkUnreadNotBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleReadNotBookmarked(); $article = $this->getArticleReadNotBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
@ -89,7 +89,7 @@ class pageHistoryTest extends minifluxTestCase
public function testMarkUnreadBookmarkedArticleKeyboard() public function testMarkUnreadBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleReadBookmarked(); $article = $this->getArticleReadBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
@ -115,7 +115,7 @@ class pageHistoryTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle'); $this->expectedDataSet = $this->getDataSet('expected_BookmarkReadArticle');
} }
public function testBookmarkReadArticleKeyboard() public function testBookmarkReadArticleKeyboard()
{ {
$article = $this->getArticleReadNotBookmarked(); $article = $this->getArticleReadNotBookmarked();
@ -195,37 +195,37 @@ class pageHistoryTest extends minifluxTestCase
{ {
$link = $this->getLinkFlushHistory(); $link = $this->getLinkFlushHistory();
$link->click(); $link->click();
$destructiveLink = $this->getLinkDestructive(); $destructiveLink = $this->getLinkDestructive();
$destructiveLink->click(); $destructiveLink->click();
$this->expectedCounterPage = 3; $this->expectedCounterPage = 3;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_NoReadNotBookmarkedArticles', FALSE); $this->expectedDataSet = $this->getDataSet('expected_NoReadNotBookmarkedArticles', FALSE);
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
public function testUnreadCounterFromNothingToValue() public function testUnreadCounterFromNothingToValue()
{ {
// load different fixture and reload the page // load different fixture and reload the page
$backupDataTester = static::$databaseTester; $backupDataTester = static::$databaseTester;
static::$databaseTester = NULL; static::$databaseTester = NULL;
$this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp(); $this->getDatabaseTester('fixture_OnlyReadArticles', FALSE)->onSetUp();
static::$databaseTester = $backupDataTester; static::$databaseTester = $backupDataTester;
$this->refresh(); $this->refresh();
// start the "real" test // start the "real" test
// dont't trust the name! The Article is read+bookmarked here // dont't trust the name! The Article is read+bookmarked here
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$link = $this->getLinkReadStatusToogle($article); $link = $this->getLinkReadStatusToogle($article);
$link->click(); $link->click();
$this->waitForIconMarkReadInvisible($article); $this->waitForIconMarkReadInvisible($article);
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE + static::DEFAULT_COUNTER_UNREAD - 1; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE + static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedCounterUnread = 1; $this->expectedCounterUnread = 1;
$this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE); $this->expectedDataSet = $this->getDataSet('fixture_OneUnreadArticle',FALSE);
@ -235,21 +235,21 @@ class pageHistoryTest extends minifluxTestCase
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$this->assertGreaterThanOrEqual(1, count($articles), 'no articles found'); $this->assertGreaterThanOrEqual(1, count($articles), 'no articles found');
foreach($articles as $article) { foreach($articles as $article) {
$link = $this->getLinkReadStatusToogle($article); $link = $this->getLinkReadStatusToogle($article);
$link->click(); $link->click();
$this->waitForArticleInvisible($article); $this->waitForArticleInvisible($article);
} }
$visible = $this->waitForAlert(); $visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear'); $this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL; $this->expectedCounterPage = NULL;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + static::DEFAULT_COUNTER_PAGE; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD + static::DEFAULT_COUNTER_PAGE;
$this->expectedDataSet = $this->getDataSet('expected_NoReadArticles', FALSE); $this->expectedDataSet = $this->getDataSet('expected_NoReadArticles', FALSE);
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
} }

View File

@ -6,12 +6,12 @@ class pageUnreadTest extends minifluxTestCase
{ {
const DEFAULT_COUNTER_PAGE = 6; const DEFAULT_COUNTER_PAGE = 6;
const DEFAULT_COUNTER_UNREAD = 6; const DEFAULT_COUNTER_UNREAD = 6;
public function setUpPage() public function setUpPage()
{ {
$url = $this->getURLPageUnread(); $url = $this->getURLPageUnread();
parent::setUpPage($url); $this->doLoginIfRequired($url);
$this->expectedPageUrl = $url; $this->expectedPageUrl = $url;
} }
@ -25,17 +25,17 @@ class pageUnreadTest extends minifluxTestCase
{ {
$articles = $this->getArticlesNotFromFeedOne(); $articles = $this->getArticlesNotFromFeedOne();
$this->assertNotEmpty($articles, 'no articles from other feeds found'); $this->assertNotEmpty($articles, 'no articles from other feeds found');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
} }
public function testOnlyUnreadArticles() public function testOnlyUnreadArticles()
{ {
$articles = $this->getArticlesRead(); $articles = $this->getArticlesRead();
$this->assertEmpty($articles, 'found read articles.'); $this->assertEmpty($articles, 'found read articles.');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('fixture_feed1'); $this->expectedDataSet = $this->getDataSet('fixture_feed1');
@ -59,18 +59,18 @@ class pageUnreadTest extends minifluxTestCase
public function testMarkReadNotBookmarkedArticleKeyboard() public function testMarkReadNotBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleUnreadNotBookmarked(); $article = $this->getArticleUnreadNotBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
$visible = $this->waitForArticleInvisible($article); $visible = $this->waitForArticleInvisible($article);
$this->assertTrue($visible, 'article is is not invisible'); $this->assertTrue($visible, 'article is is not invisible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE - 1;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle'); $this->expectedDataSet = $this->getDataSet('expected_MarkReadNotBookmarkedArticle');
} }
public function testMarkReadBookmarkedArticleLink() public function testMarkReadBookmarkedArticleLink()
{ {
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
@ -89,10 +89,10 @@ class pageUnreadTest extends minifluxTestCase
public function testMarkReadBookmarkedArticleKeyboard() public function testMarkReadBookmarkedArticleKeyboard()
{ {
$article = $this->getArticleUnreadBookmarked(); $article = $this->getArticleUnreadBookmarked();
$this->setArticleAsCurrentArticle($article); $this->setArticleAsCurrentArticle($article);
$this->keys($this->getShortcutToogleReadStatus()); $this->keys($this->getShortcutToogleReadStatus());
$visible = $this->waitForArticleInvisible($article); $visible = $this->waitForArticleInvisible($article);
$this->assertTrue($visible, 'article is is not invisible'); $this->assertTrue($visible, 'article is is not invisible');
@ -125,7 +125,7 @@ class pageUnreadTest extends minifluxTestCase
$visible = $this->waitForIconBookmarkVisible($article); $visible = $this->waitForIconBookmarkVisible($article);
$this->assertTrue($visible, 'bookmark icon is not visible'); $this->assertTrue($visible, 'bookmark icon is not visible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle'); $this->expectedDataSet = $this->getDataSet('expected_BookmarkUnreadArticle');
@ -140,7 +140,7 @@ class pageUnreadTest extends minifluxTestCase
$invisible = $this->waitForIconBookmarkInvisible($article); $invisible = $this->waitForIconBookmarkInvisible($article);
$this->assertTrue($invisible, 'bookmark icon is not invisible'); $this->assertTrue($invisible, 'bookmark icon is not invisible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle'); $this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
@ -155,7 +155,7 @@ class pageUnreadTest extends minifluxTestCase
$invisible = $this->waitForIconBookmarkInvisible($article); $invisible = $this->waitForIconBookmarkInvisible($article);
$this->assertTrue($invisible, 'bookmark icon is not invisible'); $this->assertTrue($invisible, 'bookmark icon is not invisible');
$this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE; $this->expectedCounterPage = static::DEFAULT_COUNTER_PAGE;
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD;
$this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle'); $this->expectedDataSet = $this->getDataSet('expected_UnbookmarkUnreadArticle');
@ -190,20 +190,20 @@ class pageUnreadTest extends minifluxTestCase
$this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1; $this->expectedCounterUnread = static::DEFAULT_COUNTER_UNREAD - 1;
$this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle'); $this->expectedDataSet = $this->getDataSet('expected_RemoveUnreadBookmarkedArticle');
} }
public function testMarkAllReadHeaderLink() public function testMarkAllReadHeaderLink()
{ {
$link = $this->getLinkMarkAllReadHeader(); $link = $this->getLinkMarkAllReadHeader();
$link->click(); $link->click();
$read = $this->waitForArticlesMarkRead(); $read = $this->waitForArticlesMarkRead();
$this->assertTrue($read, 'there are still unread articles'); $this->assertTrue($read, 'there are still unread articles');
$this->expectedCounterPage = NULL; $this->expectedCounterPage = NULL;
$this->expectedCounterUnread = ''; $this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1'; $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', FALSE);
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
@ -211,38 +211,38 @@ class pageUnreadTest extends minifluxTestCase
{ {
$link = $this->getLinkMarkAllReadBottom(); $link = $this->getLinkMarkAllReadBottom();
$link->click(); $link->click();
$read = $this->waitForArticlesMarkRead(); $read = $this->waitForArticlesMarkRead();
$this->assertTrue($read, 'there are still unread articles'); $this->assertTrue($read, 'there are still unread articles');
$this->expectedCounterPage = NULL; $this->expectedCounterPage = NULL;
$this->expectedCounterUnread = ''; $this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1'; $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', FALSE);
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
public function testRedirectWithZeroArticles() public function testRedirectWithZeroArticles()
{ {
$articles = $this->getArticles(); $articles = $this->getArticles();
$this->assertGreaterThanOrEqual(1, count($articles), 'no articles found'); $this->assertGreaterThanOrEqual(1, count($articles), 'no articles found');
foreach($articles as $article) { foreach($articles as $article) {
$link = $this->getLinkReadStatusToogle($article); $link = $this->getLinkReadStatusToogle($article);
$link->click(); $link->click();
$this->waitForArticleInvisible($article); $this->waitForArticleInvisible($article);
} }
$visible = $this->waitForAlert(); $visible = $this->waitForAlert();
$this->assertTrue($visible, 'alert box did not appear'); $this->assertTrue($visible, 'alert box did not appear');
$this->expectedCounterPage = NULL; $this->expectedCounterPage = NULL;
$this->expectedCounterUnread = ''; $this->expectedCounterUnread = '';
$this->expectedPageUrl = PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_BASEURL.'?action=feeds&nothing_to_read=1'; $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', FALSE);
$this->ignorePageTitle = TRUE; $this->ignorePageTitle = TRUE;
} }
} }