class CountriesApiTest in Country codes API 5
Hierarchy
- class \DrupalTestCase extends \WebTestCase
- class \CountriesApiTest
Expanded class hierarchy of CountriesApiTest
File
- tests/
countries_api.test, line 11
View source
class CountriesApiTest extends DrupalTestCase {
function get_info() {
return array(
'name' => t('Countries API tests'),
'desc' => t('Tests countries api functions'),
'group' => t('countries_api tests'),
);
}
/**
* Function to test countries_api_get_formats() results
**/
function test_countries_api_get_formats() {
$formats = countries_api_get_formats();
$this
->assertNotNull($formats, 'Checking countries API format results. %s');
}
/**
* Function to validate format (and presence of) countries from countries_api_get_list()
**/
function test_countries_api_get_list() {
$countries = countries_api_get_list();
$this
->assertTrue(is_array($countries), 'Checking countries api list. %s');
}
/**
* Function to validate length of countries list is greater than 0
**/
function test_count_countries_api_get_list() {
$countries = countries_api_get_list();
$this
->assertNotEqual(count($countries), 0, 'Checking size of countries api. %s');
}
/**
* Function to test _countries_api_iso_get_country returns a value
**/
function test_results_countries_api_iso_get_country() {
$value = VALID_ISO2;
$format = VALID_FORMAT;
$country = _countries_api_iso_get_country($value, $format);
$this
->assertTrue($country, 'Testing countries_api_iso_get_country return format. %s');
}
/**
* Function to test invalid format passed to _countries_api_iso_get_country
**/
function test_invalidformat__countries_api_iso_get_country() {
$value = VALID_ISO2;
$format = INVALID_FORMAT;
$country = _countries_api_iso_get_country($value, $format);
$this
->assertFalse($country, 'Testing countries_api_iso_get_country format validation. %s');
}
/**
* Function to test countries_api_iso3_get_iso2() results
**/
function test_countries_api_iso3_get_iso2() {
$code = VALID_ISO3;
$iso2 = countries_api_iso3_get_iso2($code);
$this
->assertNotEqual($iso2, false, 'Test countries_api_iso3_get_iso2 results. %s');
}
/**
* Function to test countries_api_iso2_get_iso3() results
**/
function test_countries_api_iso2_get_iso3() {
$code = VALID_ISO2;
$iso3 = countries_api_iso2_get_iso3($code);
$this
->assertNotEqual($iso3, false, 'Test countries_api_iso2_get_iso3 results. %s');
}
/**
* Function to test results of countries_api_iso3_get_name()
**/
function test_countries_api_iso3_get_name() {
$code = VALID_ISO3;
$country_name = countries_api_iso3_get_name($code);
$this
->assertNotNull($country_name, 'Test countries_api_iso3_get_name results. %s');
}
/**
* Function to test results of countries_api_iso3_get_name()
**/
function test_nullcountries_api_iso3_get_name() {
$code = INVALID_ISO3;
$country_name = countries_api_iso3_get_name($code);
$this
->assertNull($country_name, 'Tests countries_api_iso3_get_name with an incorrect code. %s');
}
/**
* Function to test results of countries_api_iso2_get_name()
**/
function test_countries_api_iso2_get_name() {
$code = VALID_ISO2;
$country_name = countries_api_iso2_get_name($code);
$this
->assertNotNull($country_name, 'Test countries_api_iso2_get_name results. %s');
}
/**
* Function to test results of countries_api_iso2_get_name()
**/
function test_nullcountries_api_iso2_get_name() {
$code = INVALID_ISO3;
$country_name = countries_api_iso2_get_name($code);
$this
->assertNull($country_name, 'Tests countries_api_iso2_get_name with an incorrect code. %s');
}
/**
* Function to test countries_api_get_name() results
**/
function test_countries_api_get_name() {
$name = VALID_ISO2;
$country_name = countries_api_get_name($name);
$this
->assertNotNull($country_name, 'Test test_countries_api_get_name results. %s');
}
/**
* Function to test countries_api_get_name() results with invalid name
**/
function test_invalid_countries_api_get_name() {
$name = INVALID_ISO2;
$country_name = countries_api_get_name($name);
$this
->assertNull($country_name, 'Test test_countries_api_get_name results. %s');
}
/**
* Function to test countries_api_get_array() results
**/
function test_countries_api_get_array() {
$countries = countries_api_get_array();
$this
->assertNotEqual($countries, false, 'Test results of countries_api_get_array.');
}
/**
* Function to test countries_api_get_options_array results
**/
function test_countries_api_get_options_array() {
$countries = countries_api_get_options_array();
$this
->assertNotNull($countries, 'Test countries_api_get_options_array.');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CountriesApiTest:: |
function | |||
CountriesApiTest:: |
function | Function to test countries_api_get_array() results | ||
CountriesApiTest:: |
function | Function to test countries_api_get_formats() results | ||
CountriesApiTest:: |
function | Function to validate format (and presence of) countries from countries_api_get_list() | ||
CountriesApiTest:: |
function | Function to test countries_api_get_name() results | ||
CountriesApiTest:: |
function | Function to test countries_api_get_options_array results | ||
CountriesApiTest:: |
function | Function to test countries_api_iso2_get_iso3() results | ||
CountriesApiTest:: |
function | Function to test results of countries_api_iso2_get_name() | ||
CountriesApiTest:: |
function | Function to test countries_api_iso3_get_iso2() results | ||
CountriesApiTest:: |
function | Function to test results of countries_api_iso3_get_name() | ||
CountriesApiTest:: |
function | Function to validate length of countries list is greater than 0 | ||
CountriesApiTest:: |
function | Function to test invalid format passed to _countries_api_iso_get_country | ||
CountriesApiTest:: |
function | Function to test countries_api_get_name() results with invalid name | ||
CountriesApiTest:: |
function | Function to test results of countries_api_iso2_get_name() | ||
CountriesApiTest:: |
function | Function to test results of countries_api_iso3_get_name() | ||
CountriesApiTest:: |
function | Function to test _countries_api_iso_get_country returns a value | ||
DrupalTestCase:: |
property | |||
DrupalTestCase:: |
property | |||
DrupalTestCase:: |
property | |||
DrupalTestCase:: |
property | |||
DrupalTestCase:: |
property | |||
DrupalTestCase:: |
function | Will trigger a pass if both parameters refer to different objects. Fail otherwise. | ||
DrupalTestCase:: |
function | Will trigger a pass if the two parameters have the same value only. Otherwise a fail. | ||
DrupalTestCase:: |
function | Confirms that an error has occurred and optionally that the error text matches exactly. | ||
DrupalTestCase:: |
function | Confirms that an error has occurred and that the error text matches a Perl regular expression. | ||
DrupalTestCase:: |
function | Will trigger a pass if the two parameters have the same value and same type. Otherwise a fail. | ||
DrupalTestCase:: |
function | Type and class test. Will pass if class matches the type name or is a subclass or if not an object, but the type is correct. | ||
DrupalTestCase:: |
function | Confirms that no errors have occurred so far in the test method. | ||
DrupalTestCase:: |
function | Type and class mismatch test. Will pass if class name or underling type does not match the one specified. | ||
DrupalTestCase:: |
function | Will trigger a pass if the two parameters have a different value. Otherwise a fail. | ||
DrupalTestCase:: |
function | Will trigger a pass if the two parameters have the different value or different type. | ||
DrupalTestCase:: |
function | Will be true if the value is set. | ||
DrupalTestCase:: |
function | Will trigger a pass if the Perl regex pattern is not present in subject. Fail if found. | ||
DrupalTestCase:: |
function | Will trigger a pass if the raw text is NOT found on the loaded page Fail otherwise. | ||
DrupalTestCase:: |
function | Will be true if the value is null. | ||
DrupalTestCase:: |
function | Will trigger a pass if both parameters refer to the same object. Fail otherwise. | ||
DrupalTestCase:: |
function | Will trigger a pass if the Perl regex pattern is found in the subject. Fail otherwise. | ||
DrupalTestCase:: |
function | Will trigger a pass if the raw text is found on the loaded page Fail otherwise. | ||
DrupalTestCase:: |
function | Follows a link by name. Will click the first link found with this link text by default, or a later one if an index is given. Match is case insensitive with normalised space. Does make assertations if the click was sucessful or not and it does… | ||
DrupalTestCase:: |
function | @abstract Checks to see if we need to send a http-auth header to authenticate when browsing a site. | ||
DrupalTestCase:: |
function | Create a role / perm combination specified by permissions | ||
DrupalTestCase:: |
function | Creates a user / role / permissions combination specified by permissions | ||
DrupalTestCase:: |
function | @abstract Brokder for the get function adds the authentication headers if necessary @author Earnest Berry III <earnest.berry@gmail.com> | ||
DrupalTestCase:: |
function | @TODO: needs documentation | ||
DrupalTestCase:: |
function | Logs in a user with the internal browser | ||
DrupalTestCase:: |
function | Disables a drupal module | ||
DrupalTestCase:: |
function | Enables a drupal module | ||
DrupalTestCase:: |
function | Do a post request on a drupal page. It will be done as usual post request with SimpleBrowser | ||
DrupalTestCase:: |
function | @abstract Broker for the post function adds the authentication headers if necessary @author Earnest Berry III <earnest.berry@gmail.com> | ||
DrupalTestCase:: |
function | |||
DrupalTestCase:: |
function | Set a druapl variable and keep track of the changes for tearDown() | ||
DrupalTestCase:: |
function | Generates a random string, to be used as name or whatever | ||
DrupalTestCase:: |
function | Just some info for the reporter | ||
DrupalTestCase:: |
function | tearDown implementation, setting back switched modules etc | 1 |