Renamed method to be more consistent to what it actually does

This commit is contained in:
Alejandro Celaya 2021-01-04 15:16:51 +01:00
parent a01e0ba337
commit 262a06f624
7 changed files with 9 additions and 9 deletions

View File

@ -35,11 +35,11 @@ class ListDomainsCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): ?int
{
$regularDomains = $this->domainService->listDomainsWithout();
$domains = $this->domainService->listDomains();
ShlinkTable::fromOutput($output)->render(
['Domain', 'Is default'],
map($regularDomains, fn (DomainItem $domain) => [$domain->toString(), $domain->isDefault() ? 'Yes' : 'No']),
map($domains, fn (DomainItem $domain) => [$domain->toString(), $domain->isDefault() ? 'Yes' : 'No']),
);
return ExitCodes::EXIT_SUCCESS;

View File

@ -45,7 +45,7 @@ class ListDomainsCommandTest extends TestCase
+---------+------------+
OUTPUT;
$listDomains = $this->domainService->listDomainsWithout()->willReturn([
$listDomains = $this->domainService->listDomains()->willReturn([
new DomainItem('foo.com', true),
new DomainItem('bar.com', false),
new DomainItem('baz.com', false),

View File

@ -25,7 +25,7 @@ class DomainService implements DomainServiceInterface
/**
* @return DomainItem[]
*/
public function listDomainsWithout(): array
public function listDomains(): array
{
/** @var DomainRepositoryInterface $repo */
$repo = $this->em->getRepository(Domain::class);

View File

@ -11,5 +11,5 @@ interface DomainServiceInterface
/**
* @return DomainItem[]
*/
public function listDomainsWithout(): array;
public function listDomains(): array;
}

View File

@ -30,13 +30,13 @@ class DomainServiceTest extends TestCase
* @test
* @dataProvider provideExcludedDomains
*/
public function listDomainsWithoutDelegatesIntoRepository(array $domains, array $expectedResult): void
public function listDomainsDelegatesIntoRepository(array $domains, array $expectedResult): void
{
$repo = $this->prophesize(DomainRepositoryInterface::class);
$getRepo = $this->em->getRepository(Domain::class)->willReturn($repo->reveal());
$findDomains = $repo->findDomainsWithout('default.com')->willReturn($domains);
$result = $this->domainService->listDomainsWithout();
$result = $this->domainService->listDomains();
self::assertEquals($expectedResult, $result);
$getRepo->shouldHaveBeenCalledOnce();

View File

@ -24,7 +24,7 @@ class ListDomainsAction extends AbstractRestAction
public function handle(ServerRequestInterface $request): ResponseInterface
{
$domainItems = $this->domainService->listDomainsWithout();
$domainItems = $this->domainService->listDomains();
return new JsonResponse([
'domains' => [

View File

@ -33,7 +33,7 @@ class ListDomainsActionTest extends TestCase
new DomainItem('bar.com', true),
new DomainItem('baz.com', false),
];
$listDomains = $this->domainService->listDomainsWithout()->willReturn($domains);
$listDomains = $this->domainService->listDomains()->willReturn($domains);
/** @var JsonResponse $resp */
$resp = $this->action->handle(ServerRequestFactory::fromGlobals());