Skip to content

Commit

Permalink
Merge pull request #232 from acelaya/feature/float-locations
Browse files Browse the repository at this point in the history
Feature/float locations
  • Loading branch information
acelaya authored Oct 16, 2018
2 parents 47117d1 + a74fe62 commit 36ab475
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 7 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# CHANGELOG

## 1.13.1 - 2018-10-16

#### Added

* *Nothing*

#### Changed

* *Nothing*

#### Deprecated

* *Nothing*

#### Removed

* *Nothing*

#### Fixed

* [#231](https://github.com/shlinkio/shlink/issues/197) Fixed error when processing visits.


## 1.13.0 - 2018-10-06

#### Added
Expand Down
14 changes: 7 additions & 7 deletions module/Core/src/Entity/VisitLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,25 @@ public function setTimezone(string $timezone): self
public function exchangeArray(array $array): void
{
if (\array_key_exists('country_code', $array)) {
$this->setCountryCode($array['country_code']);
$this->setCountryCode((string) $array['country_code']);
}
if (\array_key_exists('country_name', $array)) {
$this->setCountryName($array['country_name']);
$this->setCountryName((string) $array['country_name']);
}
if (\array_key_exists('region_name', $array)) {
$this->setRegionName($array['region_name']);
$this->setRegionName((string) $array['region_name']);
}
if (\array_key_exists('city', $array)) {
$this->setCityName($array['city']);
$this->setCityName((string) $array['city']);
}
if (\array_key_exists('latitude', $array)) {
$this->setLatitude($array['latitude']);
$this->setLatitude((string) $array['latitude']);
}
if (\array_key_exists('longitude', $array)) {
$this->setLongitude($array['longitude']);
$this->setLongitude((string) $array['longitude']);
}
if (\array_key_exists('time_zone', $array)) {
$this->setTimezone($array['time_zone']);
$this->setTimezone((string) $array['time_zone']);
}
}

Expand Down
27 changes: 27 additions & 0 deletions module/Core/test/Entity/VisitLocationTest.php
Original file line number Diff line number Diff line change
@@ -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());
}
}

0 comments on commit 36ab475

Please sign in to comment.