Skip to content

Commit

Permalink
Merge pull request #184 from dkreuer/patch-2
Browse files Browse the repository at this point in the history
Fix returning possible null values
  • Loading branch information
X-Coder264 authored Mar 12, 2020
2 parents 6d65806 + bbbf5ed commit da38b7a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Command/ListClientsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private function getRows(array $clients, array $columns): array
];

return array_map(static function (string $column) use ($values): string {
return $values[$column];
return $values[$column] ?? '';
}, $columns);
}, $clients);
}
Expand Down
22 changes: 22 additions & 0 deletions Tests/Acceptance/ListClientsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ public function testListClients(): void
$this->assertEquals(trim($expected), trim($output));
}

public function testListClientsWithClientHavingNoSecret(): void
{
$client = $this->fakeAClient('foobar', null);
$this->getClientManager()->save($client);

$command = $this->command();
$commandTester = new CommandTester($command);
$commandTester->execute([
'command' => $command->getName(),
]);
$output = $commandTester->getDisplay();
$expected = <<<TABLE
------------ -------- ------- -------------- ------------
identifier secret scope redirect uri grant type
------------ -------- ------- -------------- ------------
foobar
------------ -------- ------- -------------- ------------
TABLE;

$this->assertEquals(trim($expected), trim($output));
}

public function testListClientsEmpty(): void
{
$command = $this->command();
Expand Down

0 comments on commit da38b7a

Please sign in to comment.