/**
  * @test
  */
 public function setFilter_TestFilters_ShouldFilterTags()
 {
     $salt = rand();
     $categoryName_1 = 'ABC_TEST_1' . $salt;
     $categoryName_2 = 'ABC_TEST_2' . $salt;
     $this->categoryManagerPage->addCategory($categoryName_1);
     $message = $this->categoryManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Category successfully saved') >= 0, 'Category save should return success');
     $state = $this->categoryManagerPage->getState($categoryName_1);
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->categoryManagerPage->addCategory($categoryName_2);
     $message = $this->categoryManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Category successfully saved') >= 0, 'Category save should return success');
     $state = $this->categoryManagerPage->getState($categoryName_2);
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->categoryManagerPage->changeCategoryState($categoryName_2, 'unpublished');
     $test = $this->categoryManagerPage->setFilter('filter_published', 'Unpublished');
     $this->assertFalse($this->categoryManagerPage->getRowNumber($categoryName_1), 'Category should not show');
     $this->categoryManagerPage->searchFor($categoryName_2);
     $this->assertEquals(1, $this->categoryManagerPage->getRowNumber($categoryName_2), 'Category should be in row 1');
     $test = $this->categoryManagerPage->setFilter('filter_published', 'Published');
     $this->assertFalse($this->categoryManagerPage->getRowNumber($categoryName_2), 'Category should not show');
     $this->categoryManagerPage->searchFor($categoryName_1);
     $this->assertEquals(1, $this->categoryManagerPage->getRowNumber($categoryName_1), 'Category should be in row 1');
     $this->categoryManagerPage->setFilter('Select Status', 'Select Status');
     $this->categoryManagerPage->trashAndDelete('ABC_TEST');
 }
 /**
  * @test
  */
 public function changeCategoryState_ChangeEnabledUsingToolbar_EnabledChanged()
 {
     $salt = rand();
     $this->categoryManagerPage = $this->getPageObject('CategoryManagerPage');
     $this->categoryManagerPage->addCategory('ABC_Test', $salt);
     $state = $this->categoryManagerPage->getState('ABC_Test');
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->categoryManagerPage->changeCategoryState('ABC_Test', 'unpublished');
     $state = $this->categoryManagerPage->getState('ABC_Test');
     $this->assertEquals('unpublished', $state, 'State should be unpublished');
     $this->categoryManagerPage->trashAndDelete('ABC_Test');
 }
 /**
  * change the tate of the category
  *
  * @return void
  *
  * @test
  */
 public function changeCategoryState_ChangeEnabledUsingToolbar_EnabledChanged()
 {
     $salt = rand();
     $categoryName = 'Test Category ' . $salt;
     $this->categoryManagerPage = $this->getPageObject('CategoryManagerPage');
     $this->categoryManagerPage->addCategory($categoryName);
     $state = $this->categoryManagerPage->getState($categoryName);
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->categoryManagerPage->changeCategoryState($categoryName, 'unpublished');
     $state = $this->categoryManagerPage->getState($categoryName);
     $this->assertEquals('unpublished', $state, 'State should be unpublished');
     $this->categoryManagerPage->trashAndDelete($categoryName);
     $this->assertFalse($this->categoryManagerPage->getRowNumber($categoryName), 'Test category should not be present');
 }
 /**
  * change the state from published to archived of a category and verify on the front end
  *
  * @return void
  *
  * @test
  */
 public function frontEndCategoryStateChange_ChangeCategoryToArchive_StateChanged()
 {
     $cfg = new SeleniumConfig();
     $categoryUrl = 'index.php/using-joomla/extensions/components/content-component/article-categories';
     $this->driver->get($cfg->host . $cfg->path . $categoryUrl);
     $this->siteCategoryPage = $this->getPageObject('SiteContentCategoriesPage');
     $arrayTitles = $this->siteCategoryPage->getCategoryTitles();
     $this->assertTrue(in_array('Park Site', $arrayTitles), 'Category Must be present');
     $this->assertTrue(in_array('Joomla!', $arrayTitles), 'Category Must be present');
     $this->assertTrue(in_array('Fruit Shop Site', $arrayTitles), 'Category Must be present');
     /*Change Category State to Archive*/
     $cpPage = $this->doAdminLogin();
     $this->categoryManagerPage = $cpPage->clickMenu('Category Manager', 'CategoryManagerPage');
     $this->categoryManagerPage = $this->getPageObject('CategoryManagerPage');
     $this->categoryManagerPage->changeCategoryState('Park Site', 'archived');
     $this->driver->get($cfg->host . $cfg->path . $categoryUrl);
     $this->siteCategoryPage = $this->getPageObject('SiteContentCategoriesPage');
     $arrayTitles = $this->siteCategoryPage->getCategoryTitles();
     $this->assertFalse(in_array('Park Site', $arrayTitles), 'Category Must not be present');
     $this->assertTrue(in_array('Joomla!', $arrayTitles), 'Category Must be present');
     $this->assertTrue(in_array('Fruit Shop Site', $arrayTitles), 'Category Must be present');
     $this->doSiteLogin();
     $this->driver->get($cfg->host . $cfg->path . $categoryUrl);
     $this->siteCategoryPage = $this->getPageObject('SiteContentCategoriesPage');
     $arrayTitles = $this->siteCategoryPage->getCategoryTitles();
     $this->assertFalse(in_array('Park Site', $arrayTitles), 'Category Must not be present');
     $this->assertTrue(in_array('Joomla!', $arrayTitles), 'Category Must be present');
     $this->assertTrue(in_array('Fruit Shop Site', $arrayTitles), 'Category Must be present');
     $this->doSiteLogout();
     /*change the category State Back to Published*/
     $cpPage = $this->doAdminLogin();
     $this->categoryManagerPage = $cpPage->clickMenu('Category Manager', 'CategoryManagerPage');
     $this->categoryManagerPage = $this->getPageObject('CategoryManagerPage');
     $this->categoryManagerPage->setFilter('Select Status', 'Archived');
     $this->categoryManagerPage->changeCategoryState('Park Site', 'published');
     $this->driver->get($cfg->host . $cfg->path . $categoryUrl);
     $this->siteCategoryPage = $this->getPageObject('SiteContentCategoriesPage');
     $arrayTitles = $this->siteCategoryPage->getCategoryTitles();
     $this->assertTrue(in_array('Park Site', $arrayTitles), 'Category Must be present');
     $this->assertTrue(in_array('Joomla!', $arrayTitles), 'Category Must be present');
     $this->assertTrue(in_array('Fruit Shop Site', $arrayTitles), 'Category Must be present');
 }