1--TEST--
2pcntl_getpriority() - Wrong mode passed and also for non existing process id provided
3--EXTENSIONS--
4pcntl
5posix
6--SKIPIF--
7<?php
8
9require_once("pcntl_skipif_user_env_rules.inc");
10
11if (!function_exists('pcntl_getpriority')) {
12    die('skip pcntl_getpriority 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_getpriority(null, (PRIO_PGRP + PRIO_USER + PRIO_PROCESS + 10));
25} catch (ValueError $exception) {
26    echo $exception->getMessage() . "\n";
27}
28
29try {
30    pcntl_getpriority(-1, PRIO_DARWIN_THREAD);
31} catch (ValueError $exception) {
32    echo $exception->getMessage() . "\n";
33}
34
35try {
36    // Different behavior in MacOS than rest of operating systems
37    pcntl_getpriority(-1, PRIO_PROCESS);
38} catch (ValueError $exception) {
39    echo $exception->getMessage() . "\n";
40}
41
42?>
43--EXPECT--
44pcntl_getpriority(): Argument #2 ($mode) must be one of PRIO_PGRP, PRIO_USER, PRIO_PROCESS or PRIO_DARWIN_THREAD
45pcntl_getpriority(): Argument #1 ($process_id) must be 0 (zero) if PRIO_DARWIN_THREAD is provided as second parameter
46pcntl_getpriority(): Argument #1 ($process_id) is not a valid process, process group, or user ID
47