2018-10-16 19:21:51 +03:00
|
|
|
<?php
|
2019-10-05 18:26:10 +03:00
|
|
|
|
2018-10-16 19:21:51 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace ShlinkioTest\Shlink\Core\Entity;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use Shlinkio\Shlink\Core\Entity\VisitLocation;
|
2019-08-10 14:42:37 +03:00
|
|
|
use Shlinkio\Shlink\IpGeolocation\Model\Location;
|
2018-10-16 19:21:51 +03:00
|
|
|
|
|
|
|
class VisitLocationTest extends TestCase
|
|
|
|
{
|
2019-02-27 00:39:26 +03:00
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
* @dataProvider provideArgs
|
|
|
|
*/
|
|
|
|
public function isEmptyReturnsTrueWhenAllValuesAreEmpty(array $args, bool $isEmpty): void
|
|
|
|
{
|
|
|
|
$payload = new Location(...$args);
|
|
|
|
$location = new VisitLocation($payload);
|
|
|
|
|
2020-10-04 01:35:14 +03:00
|
|
|
self::assertEquals($isEmpty, $location->isEmpty());
|
2019-02-27 00:39:26 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function provideArgs(): iterable
|
|
|
|
{
|
|
|
|
yield [['', '', '', '', 0.0, 0.0, ''], true];
|
|
|
|
yield [['', '', '', '', 0.0, 0.0, 'dd'], false];
|
|
|
|
yield [['', '', '', 'dd', 0.0, 0.0, ''], false];
|
|
|
|
yield [['', '', 'dd', '', 0.0, 0.0, ''], false];
|
|
|
|
yield [['', 'dd', '', '', 0.0, 0.0, ''], false];
|
|
|
|
yield [['dd', '', '', '', 0.0, 0.0, ''], false];
|
|
|
|
yield [['', '', '', '', 1.0, 0.0, ''], false];
|
|
|
|
yield [['', '', '', '', 0.0, 1.0, ''], false];
|
|
|
|
}
|
2018-10-16 19:21:51 +03:00
|
|
|
}
|