Skip to content

Commit c788948

Browse files
Copilotvoku
andauthored
test: cover findKey for min and max values
Agent-Logs-Url: https://github.com/voku/Arrayy/sessions/7dad4f02-2067-44b8-bf04-f2accbd6df9a Co-authored-by: voku <264695+voku@users.noreply.github.com>
1 parent 2e96301 commit c788948

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/ArrayyTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,6 +3281,27 @@ public function testFindKeyWithKeyParameter()
32813281
static::assertFalse($arrayy->findKey($closureNoMatch));
32823282
}
32833283

3284+
public function testFindKeyForMinAndMaxValues()
3285+
{
3286+
$arrayy = A::create([
3287+
3 => 10,
3288+
4 => -5,
3289+
8 => 99,
3290+
9 => -5,
3291+
10 => 99,
3292+
]);
3293+
3294+
$min = $arrayy->min();
3295+
$max = $arrayy->max();
3296+
3297+
static::assertSame(4, $arrayy->findKey(static function ($value) use ($min) {
3298+
return $value === $min;
3299+
}));
3300+
static::assertSame(8, $arrayy->findKey(static function ($value) use ($max) {
3301+
return $value === $max;
3302+
}));
3303+
}
3304+
32843305
/**
32853306
* @dataProvider firstProvider()
32863307
*

0 commit comments

Comments
 (0)