array_keys
brefphp/bref
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return all the keys or a subset of the keys of an array
array_keys
(array
$array
): array
$expectedHeader
=
array_map
(function (
string $value
,
string $key
):
string
{
return
$key
.
'='
.
urlencode
(
$value
);
},
$expected
,
array_keys
(
$expected
));
$this
->
assertEquals
(
implode
(
'; '
,
$expectedHeader
),
$this
->
event
->
getHeaders
()[
'cookie'
][
0
] ??
''
);
}
tests/Event/Http/HttpRequestEventTest.php
$expectedCommonVariables
=
array_merge
(
$expectedCommonVariables
,
$overriddenKeys
);
self
::
assertArraySubset
(
$expectedCommonVariables
,
$response
[
'$_SERVER'
]);
$keysToRemove
=
array_keys
(
array_diff_key
(
$expectedCommonVariables
,
$overriddenKeys
));
foreach (
$keysToRemove
as
$keyToRemove
) {
unset(
$response
[
'$_SERVER'
][
$keyToRemove
]);
}
tests/Handler/FpmHandlerTest.php
'errorType'
,
'errorMessage'
,
'stackTrace'
,
],
array_keys
(
$invocationResult
));
$this
->
assertEquals
(
$errorClass
,
$invocationResult
[
'errorType'
]);
$this
->
assertEquals
(
$errorMessage
,
$invocationResult
[
'errorMessage'
]);
$this
->
assertIsArray
(
$invocationResult
[
'stackTrace'
]);
tests/Runtime/LambdaRuntimeTest.php
'errorType'
,
'errorMessage'
,
'stack'
,
],
array_keys
(
$invocationResult
));
$this
->
assertEquals
(
$errorClass
,
$invocationResult
[
'errorType'
]);
$this
->
assertEquals
(
$errorMessage
,
$invocationResult
[
'errorMessage'
]);
$this
->
assertIsArray
(
$invocationResult
[
'stack'
]);
tests/Runtime/LambdaRuntimeTest.php
'errorType'
,
'errorMessage'
,
'stack'
,
],
array_keys
(
$error
));
$this
->
assertEquals
(
$previousErrors
[
$index
][
'errorClass'
],
$error
[
'errorType'
]);
$this
->
assertEquals
(
$previousErrors
[
$index
][
'errorMessage'
],
$error
[
'errorMessage'
]);
$this
->
assertIsArray
(
$error
[
'stack'
]);
tests/Runtime/LambdaRuntimeTest.php
'errorType'
,
'errorMessage'
,
'stackTrace'
,
],
array_keys
(
$invocationResult
));
$this
->
assertEquals
(
$errorClass
,
$invocationResult
[
'errorType'
]);
$this
->
assertEquals
(
$errorMessage
,
$invocationResult
[
'errorMessage'
]);
$this
->
assertIsArray
(
$invocationResult
[
'stackTrace'
]);
tests/Sam/PhpRuntimeTest.php
'errorType'
,
'errorMessage'
,
'stack'
,
],
array_keys
(
$invocationResult
));
$this
->
assertEquals
(
$errorClass
,
$invocationResult
[
'errorType'
]);
$this
->
assertEquals
(
$errorMessage
,
$invocationResult
[
'errorMessage'
]);
$this
->
assertIsArray
(
$invocationResult
[
'stack'
]);
tests/Sam/PhpRuntimeTest.php