1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 21:22:13 +02:00
Files
archived-php-src/ext/pgsql/tests/changepassword.phpt
David Carlier 9aa3a0d702 ext/pgsql: adding pg_change_password functionality.
handy call to change an user password while taking care transparently
of the password's encryption.

close GH-14262
2024-05-20 12:57:37 +01:00

30 lines
633 B
PHP

--TEST--
Changing user password with pg_change_password
--EXTENSIONS--
pgsql
--SKIPIF--
<?php include("inc/skipif.inc"); ?>
--FILE--
<?php
include('inc/config.inc');
$conn = pg_connect($conn_str);
try {
pg_change_password($conn, "", "pass");
} catch (\ValueError $e) {
echo $e->getMessage() . PHP_EOL;
}
try {
pg_change_password($conn, "user", "");
} catch (\ValueError $e) {
echo $e->getMessage() . PHP_EOL;
}
var_dump(pg_change_password($conn, "inexistent_user", "postitpwd"));
?>
--EXPECT--
pg_change_password(): Argument #2 ($user) cannot be empty
pg_change_password(): Argument #3 ($password) cannot be empty
bool(false)