1--TEST--
2pcntl_setpriority() - Check for errors
3--EXTENSIONS--
4pcntl
5posix
6--SKIPIF--
7<?php
8
9require_once("pcntl_skipif_user_env_rules.inc");
10
11if (!function_exists('pcntl_setpriority')) {
12    die('skip pcntl_setpriority doesn\'t exist');
13}
14
15if (PHP_OS !== "Darwin") {
16    die("skip This test only runs on Darwin");
17}
18
19?>
20--FILE--
21<?php
22
23try {
24    pcntl_setpriority(0, null, (PRIO_PGRP + PRIO_USER + PRIO_PROCESS + 10));
25} catch (ValueError $exception) {
26    echo $exception->getMessage() . "\n";
27}
28
29try {
30    pcntl_setpriority(0, -1, PRIO_DARWIN_THREAD);
31} catch (ValueError $exception) {
32    echo $exception->getMessage() . "\n";
33}
34
35try {
36    pcntl_setpriority(0, -123);
37} catch (ValueError $exception) {
38    echo $exception->getMessage() . "\n";
39}
40
41pcntl_setpriority(-1000, 1);
42
43?>
44--EXPECTF--
45pcntl_setpriority(): Argument #3 ($mode) must be one of PRIO_PGRP, PRIO_USER, PRIO_PROCESS or PRIO_DARWIN_THREAD
46pcntl_setpriority(): Argument #2 ($process_id) must be 0 (zero) if PRIO_DARWIN_THREAD is provided as second parameter
47pcntl_setpriority(): Argument #2 ($process_id) is not a valid process, process group, or user ID
48
49Warning: 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
50