You are here

function CountriesBaseSetupTest::assertCountryListed in Countries 7.2

Same name and namespace in other branches
  1. 8 tests/countries.test \CountriesBaseSetupTest::assertCountryListed()
1 call to CountriesBaseSetupTest::assertCountryListed()
CountriesCRUDUIUnitTest::testCountriesAddition in tests/countries.test
This test that the country property lookup is working.

File

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

Class

CountriesBaseSetupTest
Test the node_load_multiple() function.

Code

function assertCountryListed($country, $sort = 'name') {
  $country = (object) $country;

  // This will generate all defaults.
  $country = country_create((array) $country);
  $country->iso2 = strtoupper($country->iso2);
  $country->iso3 = strtoupper($country->iso3);
  $this
    ->assertListingLink($country, 'title', 1);
  foreach (array(
    'iso2',
    'official_name',
    'numcode',
    'enabled',
    'iso3',
  ) as $property) {
    $additional = $sort == $property ? 'class="active" ' : '';
    $value = country_property($country, $property, '');
    $this
      ->assertRaw("<td {$additional}id=\"{$country->iso2}-{$property}\">{$value}</td>", "Testing {$property} for {$country->name} ({$country->iso2}): {$value}");
  }
  $this
    ->assertListingLink($country, 'edit', 1);
  if (country_is_locked($country)) {
    $this
      ->assertListingLink($country, 'delete', 0);
  }
  else {
    $this
      ->assertListingLink($country, 'delete', 1);
  }
}