-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize behaviour of DNS function on Windows
This is a follow-up on commit 4a438b4 Add some tests to hopefully not forget it next time
- Loading branch information
Showing
3 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
ext/standard/tests/network/dns_check_record_error_conditions.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
dns_check_record() error conditions | ||
--FILE-- | ||
<?php | ||
try { | ||
dns_check_record(''); | ||
} catch (\ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
try { | ||
// A random DNS Mode | ||
dns_check_record('php.net', 15263480); | ||
} catch (\ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
?> | ||
--EXPECT-- | ||
dns_check_record(): Argument #1 ($hostname) cannot be empty | ||
dns_check_record(): Argument #2 ($type) must be a valid DNS record type |
31 changes: 31 additions & 0 deletions
31
ext/standard/tests/network/dns_get_record_error_conditions.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--TEST-- | ||
dns_get_record() error conditions | ||
--FILE-- | ||
<?php | ||
try { | ||
// A random DNS Mode | ||
dns_get_record('php.net', 15263480); | ||
} catch (\ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
try { | ||
// DNS Mode 0 | ||
$auth = []; | ||
$additional = []; | ||
dns_get_record('php.net', 0, $auth, $additional, true); | ||
} catch (\ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
try { | ||
// A random DNS Mode | ||
$auth = []; | ||
$additional = []; | ||
dns_get_record('php.net', 15263480, $auth, $additional, true); | ||
} catch (\ValueError $exception) { | ||
echo $exception->getMessage() . "\n"; | ||
} | ||
?> | ||
--EXPECT-- | ||
dns_get_record(): Argument #2 ($type) must be a DNS_* constant | ||
dns_get_record(): Argument #2 ($type) must be between 1 and 65535 when argument #5 ($raw) is true | ||
dns_get_record(): Argument #2 ($type) must be between 1 and 65535 when argument #5 ($raw) is true |