mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Renamed method to be more consistent to what it actually does
This commit is contained in:
parent
a01e0ba337
commit
262a06f624
@ -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;
|
||||
|
@ -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),
|
||||
|
@ -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);
|
||||
|
@ -11,5 +11,5 @@ interface DomainServiceInterface
|
||||
/**
|
||||
* @return DomainItem[]
|
||||
*/
|
||||
public function listDomainsWithout(): array;
|
||||
public function listDomains(): array;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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' => [
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user