modifs.mineures sans commentaires
This commit is contained in:
parent
b8a3d7ae77
commit
bbbe101918
@ -241,7 +241,7 @@ class cl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* obtenir la liste des clés finalement obtenues après l'appel à
|
* obtenir la liste des clés qui seraient finalement obtenues après l'appel à
|
||||||
* {@link self::select()} avec le mapping spécifié
|
* {@link self::select()} avec le mapping spécifié
|
||||||
*/
|
*/
|
||||||
static final function selected_keys(?array $mappings): array {
|
static final function selected_keys(?array $mappings): array {
|
||||||
@ -284,7 +284,7 @@ class cl {
|
|||||||
* $includes qui ne sont pas mentionnées dans $excludes.
|
* $includes qui ne sont pas mentionnées dans $excludes.
|
||||||
*
|
*
|
||||||
* - si $includes===null && $excludes===null, retourner le tableau inchangé
|
* - si $includes===null && $excludes===null, retourner le tableau inchangé
|
||||||
* - si $includes vaut null, prendre toutes les clés
|
* - si $includes vaut null, c'est comme si toutes les clés étaient incluses
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static final function xselect($array, ?array $includes, ?array $excludes=null): ?array {
|
static final function xselect($array, ?array $includes, ?array $excludes=null): ?array {
|
||||||
|
@ -12,10 +12,10 @@ class clTest extends TestCase {
|
|||||||
}
|
}
|
||||||
function test_same_keys() {
|
function test_same_keys() {
|
||||||
$array = ["a" => 42, "b" => "tesxt"]; $arrayKeys = array_keys($array);
|
$array = ["a" => 42, "b" => "tesxt"]; $arrayKeys = array_keys($array);
|
||||||
$xarray = ["parasite0", "a" => 42, "parasite1", "b" => "tesxt"]; $xarrayKeys = array_keys($array);
|
$missingArray = ["c" => true]; $missingArrayKeys = array_keys($missingArray);
|
||||||
$ref = ["a" => "int", "b" => "text"]; $refKeys = array_keys($ref);
|
$ref = ["a" => "int", "b" => "text"]; $refKeys = array_keys($ref);
|
||||||
$missingArray = ["c" => true]; $missingKeys = array_keys($missingArray);
|
$missingRef = ["c" => "bool"]; $missingRefKeys = array_keys($missingRef);
|
||||||
$missingRef = ["c" => "bool"]; $missingKeys = array_keys($missingRef);
|
$xarray = ["parasite0", "a" => 42, "parasite1", "b" => "tesxt"];
|
||||||
|
|
||||||
$this->checkKeys(null, null, true, [], [], []);
|
$this->checkKeys(null, null, true, [], [], []);
|
||||||
$this->checkKeys(null, [], true, [], [], []);
|
$this->checkKeys(null, [], true, [], [], []);
|
||||||
@ -29,8 +29,8 @@ class clTest extends TestCase {
|
|||||||
$this->checkKeys($array, [], true, [], $arrayKeys, []);
|
$this->checkKeys($array, [], true, [], $arrayKeys, []);
|
||||||
|
|
||||||
$this->checkKeys($array, $ref, true, $arrayKeys, [], []);
|
$this->checkKeys($array, $ref, true, $arrayKeys, [], []);
|
||||||
$this->checkKeys(cl::merge($array, $missingArray), $ref, true, $arrayKeys, $missingKeys, []);
|
$this->checkKeys(cl::merge($array, $missingArray), $ref, true, $arrayKeys, $missingArrayKeys, []);
|
||||||
$this->checkKeys($array, cl::merge($ref, $missingRef), false, $arrayKeys, [], $missingKeys);
|
$this->checkKeys($array, cl::merge($ref, $missingRef), false, $arrayKeys, [], $missingRefKeys);
|
||||||
|
|
||||||
$this->checkKeys($xarray, $ref, false, $arrayKeys, [0, 1], []);
|
$this->checkKeys($xarray, $ref, false, $arrayKeys, [0, 1], []);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user