mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-23 07:33:58 -06:00
42 lines
1.7 KiB
PHP
42 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace ShlinkioApiTest\Shlink\Rest\Fixtures;
|
|
|
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use Shlinkio\Shlink\Core\Entity\ShortUrl;
|
|
use Shlinkio\Shlink\Core\Entity\Visit;
|
|
use Shlinkio\Shlink\Core\Model\Visitor;
|
|
|
|
class VisitsFixture extends AbstractFixture implements DependentFixtureInterface
|
|
{
|
|
public function getDependencies(): array
|
|
{
|
|
return [ShortUrlsFixture::class];
|
|
}
|
|
|
|
public function load(ObjectManager $manager): void
|
|
{
|
|
/** @var ShortUrl $abcShortUrl */
|
|
$abcShortUrl = $this->getReference('abc123_short_url');
|
|
$manager->persist(new Visit($abcShortUrl, new Visitor('shlink-tests-agent', '', '44.55.66.77')));
|
|
$manager->persist(new Visit($abcShortUrl, new Visitor('shlink-tests-agent', 'https://google.com', '4.5.6.7')));
|
|
$manager->persist(new Visit($abcShortUrl, new Visitor('shlink-tests-agent', '', '1.2.3.4')));
|
|
|
|
/** @var ShortUrl $defShortUrl */
|
|
$defShortUrl = $this->getReference('def456_short_url');
|
|
$manager->persist(new Visit($defShortUrl, new Visitor('shlink-tests-agent', '', '127.0.0.1')));
|
|
$manager->persist(new Visit($defShortUrl, new Visitor('shlink-tests-agent', 'https://app.shlink.io', '')));
|
|
|
|
/** @var ShortUrl $defShortUrl */
|
|
$defShortUrl = $this->getReference('ghi789_short_url');
|
|
$manager->persist(new Visit($defShortUrl, new Visitor('shlink-tests-agent', '', '1.2.3.4')));
|
|
$manager->persist(new Visit($defShortUrl, new Visitor('shlink-tests-agent', 'https://app.shlink.io', '')));
|
|
|
|
$manager->flush();
|
|
}
|
|
}
|