-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CLI-1410: self:status command * fix tests * cleanup * coverage
- Loading branch information
1 parent
8c65600
commit de7fb0e
Showing
9 changed files
with
92 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Acquia\Cli\Command\Self; | ||
|
||
use Acquia\Cli\Command\CommandBase; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Helper\Table; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
#[AsCommand(name: 'self:info', description: 'Print information about the running version of Acquia CLI')] | ||
|
||
final class SelfInfoCommand extends CommandBase | ||
{ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$table = $this->createTable($output, 'Acquia CLI information', ['Property', 'Value']); | ||
$table->addRow(['Version', $this->getApplication()->getVersion()]); | ||
$table->addRow(['Cloud datastore', $this->datastoreCloud->filepath]); | ||
$table->addRow(['ACLI datastore', $this->datastoreAcli->filepath]); | ||
$table->addRow(['Telemetry enabled', var_export($this->telemetryHelper->telemetryEnabled(), true)]); | ||
$table->addRow(['User ID', $this->telemetryHelper->getUserId()]); | ||
foreach ($this->telemetryHelper->getTelemetryUserData() as $key => $value) { | ||
$table->addRow([$key, $value]); | ||
} | ||
$table->render(); | ||
return Command::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Acquia\Cli\Tests\Commands\Self; | ||
|
||
use Acquia\Cli\Command\CommandBase; | ||
use Acquia\Cli\Command\Self\SelfInfoCommand; | ||
use Acquia\Cli\Tests\CommandTestBase; | ||
|
||
/** | ||
* @property \Acquia\Cli\Command\Self\SelfInfoCommand $command | ||
*/ | ||
class SelfInfoCommandTest extends CommandTestBase | ||
{ | ||
protected function createCommand(): CommandBase | ||
{ | ||
return $this->injectCommand(SelfInfoCommand::class); | ||
} | ||
|
||
/** | ||
* @throws \Exception | ||
*/ | ||
public function testSelfInfoCommand(): void | ||
{ | ||
$this->mockRequest('getAccount'); | ||
$this->executeCommand(); | ||
$output = $this->getDisplay(); | ||
$this->assertStringContainsString('Property', $output); | ||
$this->assertStringContainsString('--------', $output); | ||
$this->assertStringContainsString('Version', $output); | ||
$this->assertStringContainsString('Cloud datastore', $output); | ||
$this->assertStringContainsString('ACLI datastore', $output); | ||
$this->assertStringContainsString('Telemetry enabled', $output); | ||
$this->assertStringContainsString('User ID', $output); | ||
$this->assertStringContainsString('is_acquian', $output); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters