/**
  * @test
  */
 public function setFilter_TestFilters_ShouldFilterWeblinks()
 {
     $weblinkName_1 = 'Test Filter 1';
     $weblinkName_2 = 'Test Filter 2';
     $url = 'www.example.com';
     $this->weblinkManagerPage->addWeblink($weblinkName_1, $url, false);
     $message = $this->weblinkManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Weblink successfully saved') >= 0, 'Weblink save should return success');
     $state = $this->weblinkManagerPage->getState($weblinkName_1);
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->weblinkManagerPage->addWeblink($weblinkName_2, $url, false);
     $message = $this->weblinkManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Weblink successfully saved') >= 0, 'Weblink save should return success');
     $state = $this->weblinkManagerPage->getState($weblinkName_2);
     $this->assertEquals('published', $state, 'Initial state should be published');
     $this->weblinkManagerPage->changeWeblinkState($weblinkName_2, 'unpublished');
     $test = $this->weblinkManagerPage->setFilter('filter_state', 'Unpublished');
     $this->assertFalse($this->weblinkManagerPage->getRowNumber($weblinkName_1), 'Weblink should not show');
     $this->assertEquals(1, $this->weblinkManagerPage->getRowNumber($weblinkName_2), 'Weblink should be in row 1');
     $test = $this->weblinkManagerPage->setFilter('filter_state', 'Published');
     $this->assertFalse($this->weblinkManagerPage->getRowNumber($weblinkName_2), 'Weblink should not show');
     $this->assertEquals(10, $this->weblinkManagerPage->getRowNumber($weblinkName_1), 'Weblink should be in row 10');
     $this->weblinkManagerPage->setFilter('Select Status', 'Select Status');
     $this->weblinkManagerPage->trashAndDelete($weblinkName_1);
     $this->weblinkManagerPage->trashAndDelete($weblinkName_2);
 }
 /**
  * add weblink with given values
  *
  * @return void
  *
  * 
  */
 public function addWeblink_WithGivenFields_WeblinkAdded()
 {
     $salt = rand();
     $weblinkName = 'Weblink' . $salt;
     $url = 'www.example.com';
     $alt = 'Alternative Text' . $salt;
     $float = 'Right';
     $caption = 'Sample Caption' . $salt;
     $this->weblinkManagerPage->searchFor($weblinkName);
     $this->assertFalse($this->weblinkManagerPage->getRowNumber($weblinkName), 'Test weblink should not be present');
     $this->weblinkManagerPage->searchFor();
     $this->weblinkManagerPage->addWeblink($weblinkName, $url, array('Alt text' => $alt, 'Caption' => $caption, 'Image Float' => $float));
     $message = $this->weblinkManagerPage->getAlertMessage();
     $this->assertTrue(strpos($message, 'Weblink successfully saved') >= 0, 'Weblink save should return success');
     $this->weblinkManagerPage->searchFor($weblinkName);
     $this->assertEquals(1, $this->weblinkManagerPage->getRowNumber($weblinkName), 'Test weblink should be in row 10');
     $this->weblinkManagerPage->searchFor();
     $values = $this->weblinkManagerPage->getFieldValues('WeblinkEditPage', $weblinkName, array('Title', 'Alt text', 'Caption', 'Image Float'));
     $this->assertEquals(array($weblinkName, $alt, $caption, $float), $values, 'Actual title, alt text, caption and image float should match expected');
     $this->weblinkManagerPage->trashAndDelete($weblinkName);
     $this->assertFalse($this->weblinkManagerPage->getRowNumber($weblinkName), 'Test weblink should not be present');
 }