Skip to content

[Uid] Realign inspect commands labels #41677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Symfony/Component/Uid/Command/InspectUlidCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

$io->table(['Label', 'Value'], [
['Canonical (Base 32)', (string) $ulid],
['Base 58', $ulid->toBase58()],
['RFC 4122', $ulid->toRfc4122()],
['toBase32 (canonical)', (string) $ulid],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

canonical is the word we chose in UidNormalizer

['toBase58', $ulid->toBase58()],
['toRfc4122', $ulid->toRfc4122()],
new TableSeparator(),
['Timestamp', ($ulid->getDateTime())->format('Y-m-d H:i:s.v')],
['Time', ($ulid->getDateTime())->format('Y-m-d H:i:s.v \U\T\C')],
]);

return 0;
Expand Down
8 changes: 4 additions & 4 deletions src/Symfony/Component/Uid/Command/InspectUuidCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ protected function execute(InputInterface $input, OutputInterface $output)

$rows = [
['Version', $version],
['Canonical (RFC 4122)', (string) $uuid],
['Base 58', $uuid->toBase58()],
['Base 32', $uuid->toBase32()],
['toRfc4122 (canonical)', (string) $uuid],
['toBase58', $uuid->toBase58()],
['toBase32', $uuid->toBase32()],
];

if ($uuid instanceof UuidV1 || $uuid instanceof UuidV6) {
$rows[] = new TableSeparator();
$rows[] = ['Timestamp', $uuid->getDateTime()->format('Y-m-d H:i:s.u')];
$rows[] = ['Time', $uuid->getDateTime()->format('Y-m-d H:i:s.u \U\T\C')];
}

$io->table(['Label', 'Value'], $rows);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public function test()
] as $ulid) {
$this->assertSame(0, $commandTester->execute(['ulid' => $ulid]));
$this->assertSame(<<<EOF
--------------------- --------------------------------------
Label Value
--------------------- --------------------------------------
Canonical (Base 32) 01E439TP9XJZ9RPFH3T1PYBCR8
Base 58 1BKocMc5BnrVcuq2ti4Eqm
RFC 4122 0171069d-593d-97d3-8b3e-23d06de5b308
--------------------- --------------------------------------
Timestamp 2020-03-23 08:58:27.517
--------------------- --------------------------------------
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
toBase32 (canonical) 01E439TP9XJZ9RPFH3T1PYBCR8
toBase58 1BKocMc5BnrVcuq2ti4Eqm
toRfc4122 0171069d-593d-97d3-8b3e-23d06de5b308
---------------------- --------------------------------------
Time 2020-03-23 08:58:27.517 UTC
---------------------- --------------------------------------


EOF
Expand Down
168 changes: 84 additions & 84 deletions src/Symfony/Component/Uid/Tests/Command/InspectUuidCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function testNil()

$this->assertSame(0, $commandTester->execute(['uuid' => '00000000-0000-0000-0000-000000000000']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version nil
Canonical (RFC 4122) 00000000-0000-0000-0000-000000000000
Base 58 1111111111111111111111
Base 32 00000000000000000000000000
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version nil
toRfc4122 (canonical) 00000000-0000-0000-0000-000000000000
toBase58 1111111111111111111111
toBase32 00000000000000000000000000
----------------------- --------------------------------------


EOF
Expand All @@ -51,59 +51,59 @@ public function testUnknown()

$this->assertSame(0, $commandTester->execute(['uuid' => '461cc9b9-2397-0dba-91e9-33af4c63f7ec']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version unknown
Canonical (RFC 4122) 461cc9b9-2397-0dba-91e9-33af4c63f7ec
Base 58 9f9nftX6dw4oVPm5uT17um
Base 32 263K4VJ8WQ1PX93T9KNX667XZC
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version unknown
toRfc4122 (canonical) 461cc9b9-2397-0dba-91e9-33af4c63f7ec
toBase58 9f9nftX6dw4oVPm5uT17um
toBase32 263K4VJ8WQ1PX93T9KNX667XZC
----------------------- --------------------------------------


EOF
, $commandTester->getDisplay(true));

$this->assertSame(0, $commandTester->execute(['uuid' => '461cc9b9-2397-2dba-91e9-33af4c63f7ec']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version unknown
Canonical (RFC 4122) 461cc9b9-2397-2dba-91e9-33af4c63f7ec
Base 58 9f9nftX6fjLfNnvSAHMV7Z
Base 32 263K4VJ8WQ5PX93T9KNX667XZC
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version unknown
toRfc4122 (canonical) 461cc9b9-2397-2dba-91e9-33af4c63f7ec
toBase58 9f9nftX6fjLfNnvSAHMV7Z
toBase32 263K4VJ8WQ5PX93T9KNX667XZC
----------------------- --------------------------------------


EOF
, $commandTester->getDisplay(true));

$this->assertSame(0, $commandTester->execute(['uuid' => '461cc9b9-2397-7dba-91e9-33af4c63f7ec']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version unknown
Canonical (RFC 4122) 461cc9b9-2397-7dba-91e9-33af4c63f7ec
Base 58 9f9nftX6kE2K6HpooNEQ83
Base 32 263K4VJ8WQFPX93T9KNX667XZC
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version unknown
toRfc4122 (canonical) 461cc9b9-2397-7dba-91e9-33af4c63f7ec
toBase58 9f9nftX6kE2K6HpooNEQ83
toBase32 263K4VJ8WQFPX93T9KNX667XZC
----------------------- --------------------------------------


EOF
, $commandTester->getDisplay(true));

$this->assertSame(0, $commandTester->execute(['uuid' => '461cc9b9-2397-cdba-91e9-33af4c63f7ec']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version unknown
Canonical (RFC 4122) 461cc9b9-2397-cdba-91e9-33af4c63f7ec
Base 58 9f9nftX6pihxonjBST7K8X
Base 32 263K4VJ8WQSPX93T9KNX667XZC
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version unknown
toRfc4122 (canonical) 461cc9b9-2397-cdba-91e9-33af4c63f7ec
toBase58 9f9nftX6pihxonjBST7K8X
toBase32 263K4VJ8WQSPX93T9KNX667XZC
----------------------- --------------------------------------


EOF
Expand All @@ -116,16 +116,16 @@ public function testV1()

$this->assertSame(0, $commandTester->execute(['uuid' => '4c8e3a2a-5993-11eb-a861-2bf05af69e52']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version 1
Canonical (RFC 4122) 4c8e3a2a-5993-11eb-a861-2bf05af69e52
Base 58 ATJGVdrgFqvc6thDFXv1Qu
Base 32 2CHRX2MPCK27NTGR9BY1DFD7JJ
---------------------- --------------------------------------
Timestamp 2021-01-18 13:44:34.438609
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version 1
toRfc4122 (canonical) 4c8e3a2a-5993-11eb-a861-2bf05af69e52
toBase58 ATJGVdrgFqvc6thDFXv1Qu
toBase32 2CHRX2MPCK27NTGR9BY1DFD7JJ
----------------------- --------------------------------------
Time 2021-01-18 13:44:34.438609 UTC
----------------------- --------------------------------------


EOF
Expand All @@ -138,14 +138,14 @@ public function testV3()

$this->assertSame(0, $commandTester->execute(['uuid' => 'd108a1a0-957e-3c77-b110-d3f912374439']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version 3
Canonical (RFC 4122) d108a1a0-957e-3c77-b110-d3f912374439
Base 58 Sp7q16VVeC7zPsMPVEToq2
Base 32 6H12GT15BY7HVV246KZ493EH1S
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version 3
toRfc4122 (canonical) d108a1a0-957e-3c77-b110-d3f912374439
toBase58 Sp7q16VVeC7zPsMPVEToq2
toBase32 6H12GT15BY7HVV246KZ493EH1S
----------------------- --------------------------------------


EOF
Expand All @@ -158,14 +158,14 @@ public function testV4()

$this->assertSame(0, $commandTester->execute(['uuid' => '705c6eab-a535-4f49-bd51-436d0e81206a']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version 4
Canonical (RFC 4122) 705c6eab-a535-4f49-bd51-436d0e81206a
Base 58 EsjuVs1nd42xt7jSB8hNQH
Base 32 3GBHQAQ99N9X4VTMA3DM78283A
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version 4
toRfc4122 (canonical) 705c6eab-a535-4f49-bd51-436d0e81206a
toBase58 EsjuVs1nd42xt7jSB8hNQH
toBase32 3GBHQAQ99N9X4VTMA3DM78283A
----------------------- --------------------------------------


EOF
Expand All @@ -178,14 +178,14 @@ public function testV5()

$this->assertSame(0, $commandTester->execute(['uuid' => '4ec6c3ad-de94-5f75-b5f0-ad56661a30c4']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version 5
Canonical (RFC 4122) 4ec6c3ad-de94-5f75-b5f0-ad56661a30c4
Base 58 AjCoyQeK6TtFemqYWV5uKZ
Base 32 2ERV1TVQMMBXTVBW5DASK1MC64
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version 5
toRfc4122 (canonical) 4ec6c3ad-de94-5f75-b5f0-ad56661a30c4
toBase58 AjCoyQeK6TtFemqYWV5uKZ
toBase32 2ERV1TVQMMBXTVBW5DASK1MC64
----------------------- --------------------------------------


EOF
Expand All @@ -198,16 +198,16 @@ public function testV6()

$this->assertSame(0, $commandTester->execute(['uuid' => '1eb59937-b0a7-6288-a861-db3dc2d8d4db']));
$this->assertSame(<<<EOF
---------------------- --------------------------------------
Label Value
---------------------- --------------------------------------
Version 6
Canonical (RFC 4122) 1eb59937-b0a7-6288-a861-db3dc2d8d4db
Base 58 4nwhs6vwvNU2AbcCSD1XP8
Base 32 0YPPCKFC57CA4AGREV7Q1DHN6V
---------------------- --------------------------------------
Timestamp 2021-01-18 13:45:52.427892
---------------------- --------------------------------------
----------------------- --------------------------------------
Label Value
----------------------- --------------------------------------
Version 6
toRfc4122 (canonical) 1eb59937-b0a7-6288-a861-db3dc2d8d4db
toBase58 4nwhs6vwvNU2AbcCSD1XP8
toBase32 0YPPCKFC57CA4AGREV7Q1DHN6V
----------------------- --------------------------------------
Time 2021-01-18 13:45:52.427892 UTC
----------------------- --------------------------------------


EOF
Expand Down