function CountriesBaseSetupTest::assertCountryListed in Countries 8
Same name and namespace in other branches
- 7.2 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 189 - 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" ' : '';
// Set a default to prevent fallbacks for translatable strings.
$value = country_property($country, $property, array(
'default' => '',
));
$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);
}
}