Forced explicit string casting when hydrating a VisitLocation from an array

This commit is contained in:
Alejandro Celaya
2018-10-16 18:21:51 +02:00
parent 47117d1fb7
commit 1e4de7fec4
2 changed files with 34 additions and 7 deletions

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace ShlinkioTest\Shlink\Core\Entity;
use PHPUnit\Framework\TestCase;
use Shlinkio\Shlink\Core\Entity\VisitLocation;
class VisitLocationTest extends TestCase
{
/**
* @test
*/
public function valuesFoundWhenExchangingArrayAreCastToString()
{
$payload = [
'latitude' => 1000.7,
'longitude' => -2000.4,
];
$location = new VisitLocation();
$location->exchangeArray($payload);
$this->assertSame('1000.7', $location->getLatitude());
$this->assertSame('-2000.4', $location->getLongitude());
}
}