mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Forced explicit string casting when hydrating a VisitLocation from an array
This commit is contained in:
27
module/Core/test/Entity/VisitLocationTest.php
Normal file
27
module/Core/test/Entity/VisitLocationTest.php
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user