locationmap.test 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class locationmapTest extends DrupalTestCase {
  3. function get_info() {
  4. return array(
  5. 'name' => 'locationmap',
  6. 'desc' => t('locationmap unit tests.'),
  7. 'group' => 'locationmap',
  8. );
  9. }
  10. function test_locationmap_geocode_for_address() {
  11. $result = locationmap_geocode_for_address("1600 Amphitheatre Parkway, Mountain View, CA");
  12. $expected = array("37.421972", "-122.084143");
  13. $this->assertEqual($expected, $result);
  14. }
  15. function test_locationmap_geocode_for_address_not_found() {
  16. $this->assertEqual(FALSE, locationmap_geocode_for_address("abcdefgh123"));
  17. }
  18. function test_locationmap_geocode_for_address_recursive() {
  19. $result = locationmap_geocode_for_address_recursive("NonExistentAddress 123, NonExistingCity, Croatia");
  20. $expected = array("44.466244", "16.461248");
  21. $this->assertEqual($expected, $result);
  22. $result = locationmap_geocode_for_address_recursive("NonExistentAddress 123, Pula, Croatia");
  23. $expected = array("44.869652", "13.841147");
  24. $this->assertEqual($expected, $result);
  25. }
  26. }