Skip to content

Commit c6c4112

Browse files
committed
Add test for ArrayContainer
1 parent ba69653 commit c6c4112

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yokai\Batch\Tests\Test;
6+
7+
use PHPUnit\Framework\TestCase;
8+
use Psr\Container\NotFoundExceptionInterface;
9+
use Yokai\Batch\Test\ArrayContainer;
10+
11+
class ArrayContainerTest extends TestCase
12+
{
13+
public function testGet(): void
14+
{
15+
$container = new ArrayContainer(['foo' => 'FOO', 'bar' => 'BAR']);
16+
17+
self::assertSame('FOO', $container->get('foo'));
18+
self::assertSame('BAR', $container->get('bar'));
19+
}
20+
21+
public function testGetNotFound(): void
22+
{
23+
$container = new ArrayContainer(['foo' => 'FOO', 'bar' => 'BAR']);
24+
25+
self::expectException(NotFoundExceptionInterface::class);
26+
$container->get('baz');
27+
}
28+
29+
public function testHas(): void
30+
{
31+
$container = new ArrayContainer(['foo' => 'FOO', 'bar' => 'BAR']);
32+
33+
self::assertSame(true, $container->has('foo'));
34+
self::assertSame(true, $container->has('bar'));
35+
self::assertSame(false, $container->has('baz'));
36+
}
37+
}

0 commit comments

Comments
 (0)