You are here

protected function SkinrUIPluginTestCase::assertOptionExists in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr_ui/src/Tests/skinr_ui.test \SkinrUIPluginTestCase::assertOptionExists()

Asserts that a select option in the current page exists.

Parameters

$name: Id of select field to assert.

$option: Option to assert.

$message: Message to display.

Return value

TRUE on pass, FALSE on fail.

3 calls to SkinrUIPluginTestCase::assertOptionExists()
SkinrUIPluginTestCase::testBlock in tests/skinr_ui.test
Tests block plugin.
SkinrUIPluginTestCase::testComment in tests/skinr_ui.test
Tests comment plugin.
SkinrUIPluginTestCase::testNode in tests/skinr_ui.test
Tests node plugin.

File

tests/skinr_ui.test, line 554
Tests for the Skinr UI module.

Class

SkinrUIPluginTestCase
Tests UI functionality for Block plugin.

Code

protected function assertOptionExists($name, $option, $message = '') {
  $elements = $this
    ->xpath('//select[@name=:name]//option[@value=:option]', array(
    ':name' => $name,
    ':option' => $option,
  ));
  return $this
    ->assertTrue(isset($elements[0]), $message ? $message : t('Option @option for field @name exists.', array(
    '@option' => $option,
    '@name' => $name,
  )), t('Browser'));
}