Skip to content

Commit 324ee91

Browse files
author
Michele Fantetti
committed
Add frontend template hints status command unit tests after suggestions
1 parent a7504d7 commit 324ee91

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

app/code/Magento/Developer/Console/Command/TemplateHintsStatusCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,20 @@ public function execute(InputInterface $input, OutputInterface $output)
6666
{
6767
$this->reinitableConfig->reinit();
6868
$templateHintsStatus =
69-
$this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default')
69+
($this->isTemplateHintsEnabled())
7070
? 'enabled'
7171
: 'disabled';
7272
$templateHintsMessage = __("Template hints are %status", ['status' => $templateHintsStatus]);
7373
$output->writeln("<info>$templateHintsMessage</info>");
7474

7575
return Cli::RETURN_SUCCESS;
7676
}
77+
78+
/**
79+
* @return bool
80+
*/
81+
private function isTemplateHintsEnabled(): bool
82+
{
83+
return $this->scopeConfig->isSetFlag(self::TEMPLATE_HINTS_STOREFRONT_PATH, 'default');
84+
}
7785
}

app/code/Magento/Developer/Test/Unit/Console/Command/TemplateHintsStatusCommandTest.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,26 @@ protected function setUp()
4949
}
5050

5151
/**
52-
* Verify execution
52+
* Verify ScopeConfigInterface instance
5353
*/
54-
public function testExecute()
54+
public function testScopeConfigInterfaceInstance()
5555
{
56-
$tester = new CommandTester($this->command);
57-
$tester->execute([]);
56+
$this->assertInstanceOf(ScopeConfigInterface::class, $this->scopeConfigMock);
57+
}
5858

59-
$this->assertEquals(
60-
Cli::RETURN_SUCCESS,
61-
$tester->getStatusCode()
62-
);
59+
/**
60+
* Verify ReinitableConfigInterface instance
61+
*/
62+
public function testReinitableConfigInterfaceInstance()
63+
{
64+
$this->assertInstanceOf(ReinitableConfigInterface::class, $this->reinitableConfigMock);
65+
}
66+
67+
/**
68+
* Verify TemplateHintsStatusCommand instance
69+
*/
70+
public function testCommandInstance()
71+
{
72+
$this->assertInstanceOf(TemplateHintsStatusCommand::class, $this->command);
6373
}
6474
}

0 commit comments

Comments
 (0)