getmxrr.phpt 786 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. getmxrr() test
  3. --SKIPIF--
  4. <?php
  5. if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
  6. if (getenv("SKIP_ONLINE_TESTS")) die("skip test requiring internet connection");
  7. if (substr(PHP_OS, 0, 3) == 'WIN') {
  8. die('skip: no Windows support');
  9. }
  10. if (getenv('SKIP_MSAN')) die('skip msan missing interceptor for dn_expand()');
  11. ?>
  12. --FILE--
  13. <?php
  14. $domains = array(
  15. 'mx1.tests.php.net.',
  16. 'mx2.tests.php.net.',
  17. 'qa.php.net.',
  18. );
  19. foreach ($domains as $domain) {
  20. $result = getmxrr($domain, $hosts, $weights);
  21. echo "Result: " . ($result ? "true" : "false")
  22. . ", hosts: " . count( $hosts )
  23. . ", weights: " . count( $weights ) . "\n";
  24. }
  25. ?>
  26. --EXPECT--
  27. Result: true, hosts: 1, weights: 1
  28. Result: true, hosts: 2, weights: 2
  29. Result: false, hosts: 0, weights: 0