-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDoGetTest.php
More file actions
31 lines (24 loc) · 890 Bytes
/
DoGetTest.php
File metadata and controls
31 lines (24 loc) · 890 Bytes
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
<?php
declare(strict_types=1);
namespace Steevanb\PhpCollection\Tests\Unit\AbstractCollection;
use PHPUnit\Framework\TestCase;
use Steevanb\PhpCollection\Exception\KeyNotFoundException;
/** @covers \Steevanb\PhpCollection\AbstractCollection::doGet */
final class DoGetTest extends TestCase
{
public function testGet(): void
{
$collection = new TestCollection([1, '2', null]);
static::assertSame(1, $collection->callDoGet(0));
static::assertSame('2', $collection->callDoGet(1));
static::assertNull($collection->callDoGet(2));
}
public function testKeyNotFound(): void
{
$collection = new TestCollection([1, '2', null]);
$this->expectException(KeyNotFoundException::class);
$this->expectExceptionMessage('Key "3" not found.');
$this->expectExceptionCode(0);
$collection->callDoGet(3);
}
}