2024-07-21 01:47:21 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
|
|
|
* @license MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2024-06-08 23:58:45 +00:00
|
|
|
|
|
|
|
namespace Test\Unit\Mapper;
|
|
|
|
|
|
|
|
use BitBadger\PDODocument\Mapper\ArrayMapper;
|
2024-06-21 13:46:41 +00:00
|
|
|
use PHPUnit\Framework\Attributes\TestDox;
|
2024-06-08 23:58:45 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unit tests for the ArrayMapper class
|
|
|
|
*/
|
2024-06-21 13:46:41 +00:00
|
|
|
#[TestDox('Array Mapper (Unit tests)')]
|
2024-06-08 23:58:45 +00:00
|
|
|
class ArrayMapperTest extends TestCase
|
|
|
|
{
|
2024-09-27 02:15:00 +00:00
|
|
|
#[TestDox('map() succeeds')]
|
2024-06-08 23:58:45 +00:00
|
|
|
public function testMapSucceeds(): void
|
|
|
|
{
|
|
|
|
$result = ['one' => 2, 'three' => 4, 'eight' => 'five'];
|
2024-10-01 03:39:23 +00:00
|
|
|
$mapped = new ArrayMapper()->map($result);
|
2024-06-08 23:58:45 +00:00
|
|
|
$this->assertSame($result, $mapped, 'The array mapper should return the parameter given to it');
|
|
|
|
}
|
|
|
|
}
|