Repository navigation
Expand file tree
/
Copy pathruncommand.php
More file actions
78 lines (61 loc) · 1.7 KB
/
Copy pathruncommand.php
File metadata and controls
78 lines (61 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Test data for WPCliRuncommandDynamicReturnTypeExtension.
*/
declare(strict_types=1);
namespace WP_CLI\Tests\Tests\PHPStan;
use WP_CLI;
use function PHPStan\Testing\assertType;
$value = WP_CLI::runcommand( 'plugin list --format=json', [ 'return' => true ] );
assertType( 'string', $value );
$value = WP_CLI::runcommand( 'plugin list --format=json', [ 'return' => false ] );
assertType( 'null', $value );
$value = WP_CLI::runcommand( 'plugin list --format=json', [ 'return' => 'all' ] );
assertType( 'object{stdout: string, stderr: string, return_code: int}', $value );
$value = WP_CLI::runcommand( 'plugin list --format=json', [ 'return' => 'stdout' ] );
assertType( 'string', $value );
$value = WP_CLI::runcommand( 'plugin list --format=json', [ 'return' => 'stderr' ] );
assertType( 'string', $value );
$value = WP_CLI::runcommand( 'plugin list --format=json', [ 'return' => 'return_code' ] );
assertType( 'int', $value );
$value = WP_CLI::runcommand(
'plugin list --format=json',
[
'return' => true,
'parse' => 'json',
]
);
assertType( 'array|null', $value );
$value = WP_CLI::runcommand(
'plugin list --format=json',
[
'return' => 'stdout',
'parse' => 'json',
]
);
assertType( 'array|null', $value );
$value = WP_CLI::runcommand(
'plugin list --format=json',
[
'return' => 'stdout',
'exit_error' => true,
]
);
assertType( 'string', $value );
$value = WP_CLI::runcommand(
'plugin list --format=json',
[
'return' => 'stdout',
'exit_error' => false,
]
);
assertType( 'string', $value );
$value = WP_CLI::runcommand( 'plugin list' );
assertType( 'null', $value );
$value = WP_CLI::runcommand(
'plugin list',
[
'exit_error' => false,
]
);
assertType( 'null', $value );