Skip to content

QA - pcntl_setpriority() - adjust error/code coverage #8994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions ext/pcntl/tests/pcntl_setpriority_error.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
pcntl_setpriority() - Wrong process identifier
pcntl_setpriority() - check for errors
--EXTENSIONS--
pcntl
--SKIPIF--
Expand All @@ -12,12 +12,22 @@ if (!function_exists('pcntl_setpriority')) {
--FILE--
<?php

$result = true;
try {
pcntl_setpriority(0, null, 42);
$result = pcntl_setpriority(0, null, (PRIO_PGRP - PRIO_USER - PRIO_PROCESS));
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
var_dump($result);

pcntl_setpriority(0, -123);

pcntl_setpriority(0, 1);
?>
--EXPECT--
--EXPECTF--
pcntl_setpriority(): Argument #3 ($mode) must be one of PRIO_PGRP, PRIO_USER, or PRIO_PROCESS
bool(true)

Warning: pcntl_setpriority(): Error 3: No process was located using the given parameters in %s

Warning: pcntl_setpriority(): Error 1: A process was located, but neither its effective nor real user ID matched the effective user ID of the caller in %s