endtoend-test-psl/tests/Psl/Dict/FromKeysTest.php

23 lines
532 B
PHP
Raw Normal View History

2021-02-16 00:23:01 +01:00
<?php
declare(strict_types=1);
namespace Psl\Tests\Dict;
use PHPUnit\Framework\TestCase;
use Psl\Dict;
use Psl\Iter;
final class FromKeysTest extends TestCase
{
public function testFromKeys(): void
{
$actual = Dict\from_keys(['hello', 'world'], static fn (string $_key) => false);
static::assertSame('hello', Iter\first_key($actual));
static::assertSame('world', Iter\last_key($actual));
static::assertFalse(Iter\first($actual));
static::assertFalse(Iter\last($actual));
}
}