You are here

protected function BmTestBase::assertSelectOptions in Backup and Migrate 7.3

Confirm that a selector has the expected items.

2 calls to BmTestBase::assertSelectOptions()
BmTestBasics::testQuickBackup in tests/BmTestBasics.test
Verify the main page has the expected form, then run a basic backup.
BmTestProfiles::testAddDefaultProfile in tests/BmTestProfiles.test
Confirm adding a new backup process works.

File

tests/BmTestBase.test, line 63
Shared functionality to make the rest of the tests simpler.

Class

BmTestBase
Base class for testing a module's custom tags.

Code

protected function assertSelectOptions($select_id, array $options, $message = '') {
  $elements = $this
    ->xpath('//select[@id=:id]//option', array(
    ':id' => $select_id,
  ));
  $results = $this
    ->assertEqual(count($elements), count($options), t('The same number of items were found as were requested'));
  $this
    ->verbose($elements);
  foreach ($options as $option) {
    $elements = $this
      ->xpath('//select[@id=:id]//option[@value=:option]', array(
      ':id' => $select_id,
      ':option' => $option,
    ));
    $this
      ->verbose($elements);
    $results *= $this
      ->assertTrue(isset($elements[0]), $message ? $message : t('Option @option for field @id is present.', array(
      '@option' => $option,
      '@id' => $select_id,
    )), t('Browser'));
  }
  return $results;
}