Added validation to not found redirects for domain

This commit is contained in:
Alejandro Celaya
2021-08-03 14:08:36 +02:00
parent 20f70b8b07
commit 9f25979b4c
9 changed files with 106 additions and 25 deletions

View File

@@ -40,7 +40,7 @@ class DomainRedirectsCommandTest extends TestCase
$findDomain = $this->domainService->findByAuthority($domainAuthority)->willReturn($domain);
$configureRedirects = $this->domainService->configureNotFoundRedirects(
$domainAuthority,
new NotFoundRedirects('foo.com', null, 'baz.com'),
NotFoundRedirects::withRedirects('foo.com', null, 'baz.com'),
)->willReturn(Domain::withAuthority(''));
$this->commandTester->setInputs(['foo.com', '', 'baz.com']);
@@ -71,12 +71,12 @@ class DomainRedirectsCommandTest extends TestCase
{
$domainAuthority = 'example.com';
$domain = Domain::withAuthority($domainAuthority);
$domain->configureNotFoundRedirects(new NotFoundRedirects('foo.com', 'bar.com', 'baz.com'));
$domain->configureNotFoundRedirects(NotFoundRedirects::withRedirects('foo.com', 'bar.com', 'baz.com'));
$findDomain = $this->domainService->findByAuthority($domainAuthority)->willReturn($domain);
$configureRedirects = $this->domainService->configureNotFoundRedirects(
$domainAuthority,
new NotFoundRedirects(null, 'edited.com', 'baz.com'),
NotFoundRedirects::withRedirects(null, 'edited.com', 'baz.com'),
)->willReturn($domain);
$this->commandTester->setInputs(['2', '1', 'edited.com', '0']);
@@ -105,7 +105,7 @@ class DomainRedirectsCommandTest extends TestCase
$findDomain = $this->domainService->findByAuthority($domainAuthority)->willReturn($domain);
$configureRedirects = $this->domainService->configureNotFoundRedirects(
$domainAuthority,
new NotFoundRedirects(),
NotFoundRedirects::withoutRedirects(),
)->willReturn($domain);
$this->commandTester->setInputs([$domainAuthority, '', '', '']);
@@ -132,7 +132,7 @@ class DomainRedirectsCommandTest extends TestCase
$findDomain = $this->domainService->findByAuthority($domainAuthority)->willReturn($domain);
$configureRedirects = $this->domainService->configureNotFoundRedirects(
$domainAuthority,
new NotFoundRedirects(),
NotFoundRedirects::withoutRedirects(),
)->willReturn($domain);
$this->commandTester->setInputs(['1', '', '', '']);
@@ -162,7 +162,7 @@ class DomainRedirectsCommandTest extends TestCase
$findDomain = $this->domainService->findByAuthority($domainAuthority)->willReturn($domain);
$configureRedirects = $this->domainService->configureNotFoundRedirects(
$domainAuthority,
new NotFoundRedirects(),
NotFoundRedirects::withoutRedirects(),
)->willReturn($domain);
$this->commandTester->setInputs(['2', $domainAuthority, '', '', '']);

View File

@@ -36,7 +36,7 @@ class ListDomainsCommandTest extends TestCase
public function allDomainsAreProperlyPrinted(array $input, string $expectedOutput): void
{
$bazDomain = Domain::withAuthority('baz.com');
$bazDomain->configureNotFoundRedirects(new NotFoundRedirects(
$bazDomain->configureNotFoundRedirects(NotFoundRedirects::withRedirects(
null,
'https://foo.com/baz-domain/regular',
'https://foo.com/baz-domain/invalid',