2020-11-21 10:44:28 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace ShlinkioApiTest\Shlink\Rest\Fixtures;
|
|
|
|
|
|
|
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
|
|
use Doctrine\Persistence\ObjectManager;
|
2021-07-23 14:11:09 +03:00
|
|
|
use Shlinkio\Shlink\Core\Config\NotFoundRedirects;
|
2022-09-23 20:03:32 +03:00
|
|
|
use Shlinkio\Shlink\Core\Domain\Entity\Domain;
|
2020-11-21 10:44:28 +03:00
|
|
|
|
|
|
|
class DomainFixture extends AbstractFixture
|
|
|
|
{
|
|
|
|
public function load(ObjectManager $manager): void
|
|
|
|
{
|
2021-07-22 21:48:58 +03:00
|
|
|
$domain = Domain::withAuthority('example.com');
|
2021-01-10 10:40:18 +03:00
|
|
|
$manager->persist($domain);
|
|
|
|
$this->addReference('example_domain', $domain);
|
|
|
|
|
2021-07-22 21:48:58 +03:00
|
|
|
$manager->persist(Domain::withAuthority('this_domain_is_detached.com'));
|
2021-07-23 14:11:09 +03:00
|
|
|
|
|
|
|
$detachedWithRedirects = Domain::withAuthority('detached-with-redirects.com');
|
2021-08-03 15:08:36 +03:00
|
|
|
$detachedWithRedirects->configureNotFoundRedirects(NotFoundRedirects::withRedirects('foo.com', 'bar.com'));
|
2021-07-23 14:11:09 +03:00
|
|
|
$manager->persist($detachedWithRedirects);
|
|
|
|
|
2020-11-21 10:44:28 +03:00
|
|
|
$manager->flush();
|
|
|
|
}
|
|
|
|
}
|