Defined new structure for tracking config, together with new options

This commit is contained in:
Alejandro Celaya
2021-05-16 09:30:04 +02:00
parent 8a8e3c3fc8
commit d423d18249
17 changed files with 176 additions and 55 deletions

View File

@@ -14,7 +14,7 @@ use Shlinkio\Shlink\Common\Response\PixelResponse;
use Shlinkio\Shlink\Core\Action\PixelAction;
use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Model\ShortUrlIdentifier;
use Shlinkio\Shlink\Core\Options\AppOptions;
use Shlinkio\Shlink\Core\Options\TrackingOptions;
use Shlinkio\Shlink\Core\Service\ShortUrl\ShortUrlResolverInterface;
use Shlinkio\Shlink\Core\Visit\VisitsTracker;
@@ -34,7 +34,7 @@ class PixelActionTest extends TestCase
$this->action = new PixelAction(
$this->urlResolver->reveal(),
$this->visitTracker->reveal(),
new AppOptions(),
new TrackingOptions(),
);
}

View File

@@ -42,7 +42,7 @@ class RedirectActionTest extends TestCase
$this->action = new RedirectAction(
$this->urlResolver->reveal(),
$this->visitTracker->reveal(),
new Options\AppOptions(['disableTrackParam' => 'foobar']),
new Options\TrackingOptions(['disableTrackParam' => 'foobar']),
$this->redirectRespHelper->reveal(),
);
}

View File

@@ -22,7 +22,7 @@ class SimplifiedConfigParserTest extends TestCase
public function properlyMapsSimplifiedConfig(): void
{
$config = [
'app_options' => [
'tracking' => [
'disable_track_param' => 'foo',
],
@@ -70,8 +70,9 @@ class SimplifiedConfigParserTest extends TestCase
'port' => 8888,
];
$expected = [
'app_options' => [
'tracking' => [
'disable_track_param' => 'bar',
'anonymize_remote_addr' => false,
],
'entity_manager' => [
@@ -96,7 +97,6 @@ class SimplifiedConfigParserTest extends TestCase
'https://third-party.io/foo',
],
'default_short_codes_length' => 8,
'anonymize_remote_addr' => false,
'redirect_status_code' => 301,
'redirect_cache_lifetime' => 90,
],

View File

@@ -14,7 +14,7 @@ use Shlinkio\Shlink\Core\Entity\ShortUrl;
use Shlinkio\Shlink\Core\Entity\Visit;
use Shlinkio\Shlink\Core\EventDispatcher\Event\UrlVisited;
use Shlinkio\Shlink\Core\Model\Visitor;
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
use Shlinkio\Shlink\Core\Options\TrackingOptions;
use Shlinkio\Shlink\Core\Visit\VisitsTracker;
class VisitsTrackerTest extends TestCase
@@ -24,7 +24,7 @@ class VisitsTrackerTest extends TestCase
private VisitsTracker $visitsTracker;
private ObjectProphecy $em;
private ObjectProphecy $eventDispatcher;
private UrlShortenerOptions $options;
private TrackingOptions $options;
public function setUp(): void
{
@@ -35,7 +35,7 @@ class VisitsTrackerTest extends TestCase
});
$this->eventDispatcher = $this->prophesize(EventDispatcherInterface::class);
$this->options = new UrlShortenerOptions();
$this->options = new TrackingOptions();
$this->visitsTracker = new VisitsTracker($this->em->reveal(), $this->eventDispatcher->reveal(), $this->options);
}