Initial SQLite development (#1)

Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2024-06-08 23:58:45 +00:00
parent e91acee70f
commit f784f3e52c
66 changed files with 5509 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
<?php declare(strict_types=1);
namespace Test\Unit\Mapper;
use BitBadger\PDODocument\Mapper\StringMapper;
use PHPUnit\Framework\TestCase;
class StringMapperTest extends TestCase
{
public function testMapSucceedsWhenFieldIsPresentAndString()
{
$result = ['test_field' => 'test_value'];
$mapper = new StringMapper('test_field');
$this->assertEquals('test_value', $mapper->map($result), 'String value not returned correctly');
}
public function testMapSucceedsWhenFieldIsPresentAndNotString()
{
$result = ['a_number' => 6.7];
$mapper = new StringMapper('a_number');
$this->assertEquals('6.7', $mapper->map($result), 'Number value not returned correctly');
}
public function testMapSucceedsWhenFieldIsNotPresent()
{
$mapper = new StringMapper('something_else');
$this->assertNull($mapper->map([]), 'Missing value not returned correctly');
}
}