]> granicus.if.org Git - php/commitdiff
Merge branch 'pull-request/1808'
authorJoe Watkins <krakjoe@php.net>
Mon, 17 Oct 2016 15:53:04 +0000 (16:53 +0100)
committerJoe Watkins <krakjoe@php.net>
Mon, 17 Oct 2016 16:02:07 +0000 (17:02 +0100)
ext/standard/tests/network/dns_get_mx.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/network/dns_get_mx.phpt b/ext/standard/tests/network/dns_get_mx.phpt
new file mode 100644 (file)
index 0000000..c5bf361
--- /dev/null
@@ -0,0 +1,29 @@
+--TEST--
+bool dns_get_mx ( string $hostname , array &$mxhosts [, array &$weight ] );
+--CREDITS--
+marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
+--SKIPIF--
+<?php
+if (getenv("SKIP_SLOW_TESTS"))
+    die("skip slow test");
+if (getenv("SKIP_ONLINE_TESTS"))
+    die("skip test requiring internet connection");
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+    die('skip: no Windows support');
+}
+?>
+--FILE--
+<?php
+$domains = array('yahoo.co.jp', 'yahoo.com', 'es.yahoo.com', 'fr.yahoo.com', 'it.yahoo.com');
+foreach ($domains as $domain) {
+    if (getmxrr($domain, $hosts, $weights)) {
+        echo "Hosts: " . count($hosts) . ", weights: " . count($weights) . "\n";
+    }
+}
+?>
+--EXPECTF--
+Hosts: %i, weights: %i
+Hosts: %i, weights: %i
+Hosts: %i, weights: %i
+Hosts: %i, weights: %i
+Hosts: %i, weights: %i