You are here

function CountriesBaseSetupTest::assertListingLink in Countries 8

Same name and namespace in other branches
  1. 7.2 tests/countries.test \CountriesBaseSetupTest::assertListingLink()
2 calls to CountriesBaseSetupTest::assertListingLink()
CountriesBaseSetupTest::assertCountryListed in tests/countries.test
CountriesFunctionsUnitTest::testCountriesLock in tests/countries.test
This test that core countries can not be deleted while user ones are.

File

tests/countries.test, line 158
Tests for countries.module.

Class

CountriesBaseSetupTest
Test the node_load_multiple() function.

Code

function assertListingLink($country, $type, $assertTrue = TRUE, $message = NULL, $query = array()) {
  if (!isset($message)) {
    $t_args = array(
      '@country' => $country->name,
      '@iso2' => $country->iso2,
      '!type' => $type,
    );
    $message = t('Testing that the country @country (@iso2) !type link was found', $t_args);
  }
  $destination = 'admin/config/regional/countries';
  if (!empty($query)) {
    $destination .= '?' . drupal_http_build_query($query);
  }
  $options = array(
    'query' => array(
      'destination' => $destination,
    ),
  );
  switch ($type) {
    case 'title':
      $link = l($country->name, 'admin/config/regional/countries/' . $country->iso2, $options);
      break;
    case 'edit':
      $link = l(t('edit'), 'admin/config/regional/countries/' . $country->iso2, $options);
      break;
    case 'delete':
      $link = l(t('delete'), 'admin/config/regional/countries/' . $country->iso2 . '/delete', $options);
      break;
  }
  if ($assertTrue) {
    $this
      ->assertRaw($link, $message);
  }
  else {
    $this
      ->assertNoRaw($link, $message);
  }
}