Skip to content

Commit

Permalink
feat: Include the PHAR timestamp in the PHAR diff (#1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Oct 22, 2023
1 parent 4f61e51 commit 20027b9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Console/Command/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ private static function renderShortSummary(PharInfo $pharInfo, IO $io): void
PharInfoRenderer::renderCompression($pharInfo, $io);
PharInfoRenderer::renderSignature($pharInfo, $io);
PharInfoRenderer::renderMetadata($pharInfo, $io);
PharInfoRenderer::renderTimestamp($pharInfo, $io);
PharInfoRenderer::renderContentsSummary($pharInfo, $io);
}
}
44 changes: 44 additions & 0 deletions tests/Console/Command/DiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ private static function commonDiffPharsProvider(DiffMode $diffMode): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-bar-compressed.phar
Expand All @@ -332,6 +333,7 @@ private static function commonDiffPharsProvider(DiffMode $diffMode): iterable
Signature: SHA-1
Signature Hash: 3A388D86C91C36659A043D52C2DEB64E8848DD1A
Metadata: None
Timestamp: 1552856416 (2019-03-17T21:00:16+00:00)
Contents: 1 file (6.65KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -344,7 +346,9 @@ private static function commonDiffPharsProvider(DiffMode $diffMode): iterable
<diff-expected>-Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-expected>
<diff-actual>+Signature Hash: 3A388D86C91C36659A043D52C2DEB64E8848DD1A</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-expected>
<diff-expected>-Contents: 1 file (6.64KB)</diff-expected>
<diff-actual>+Timestamp: 1552856416 (2019-03-17T21:00:16+00:00)</diff-actual>
<diff-actual>+Contents: 1 file (6.65KB)</diff-actual>
// Comparing the two archives contents (%s diff)...
Expand Down Expand Up @@ -375,6 +379,7 @@ private static function fileNameDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57
Metadata: None
Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-bar.phar
Expand All @@ -383,6 +388,7 @@ private static function fileNameDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -394,6 +400,8 @@ private static function fileNameDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57</diff-expected>
<diff-actual>+Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)</diff-expected>
<diff-actual>+Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-actual>
Contents: 1 file (6.64KB)
// Comparing the two archives contents (file-name diff)...
Expand Down Expand Up @@ -424,6 +432,7 @@ private static function fileNameDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-baz.phar
Expand All @@ -432,6 +441,7 @@ private static function fileNameDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5
Metadata: None
Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)
Contents: 1 file (6.61KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -443,7 +453,9 @@ private static function fileNameDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-expected>
<diff-actual>+Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-expected>
<diff-expected>-Contents: 1 file (6.64KB)</diff-expected>
<diff-actual>+Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)</diff-actual>
<diff-actual>+Contents: 1 file (6.61KB)</diff-actual>
// Comparing the two archives contents (file-name diff)...
Expand Down Expand Up @@ -472,6 +484,7 @@ public static function gitDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57
Metadata: None
Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-bar.phar
Expand All @@ -480,6 +493,7 @@ public static function gitDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -491,6 +505,8 @@ public static function gitDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57</diff-expected>
<diff-actual>+Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)</diff-expected>
<diff-actual>+Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-actual>
Contents: 1 file (6.64KB)
// Comparing the two archives contents (git diff)...
Expand All @@ -517,6 +533,7 @@ public static function gitDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-baz.phar
Expand All @@ -525,6 +542,7 @@ public static function gitDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5
Metadata: None
Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)
Contents: 1 file (6.61KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -536,7 +554,9 @@ public static function gitDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-expected>
<diff-actual>+Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-expected>
<diff-expected>-Contents: 1 file (6.64KB)</diff-expected>
<diff-actual>+Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)</diff-actual>
<diff-actual>+Contents: 1 file (6.61KB)</diff-actual>
// Comparing the two archives contents (git diff)...
Expand Down Expand Up @@ -573,6 +593,7 @@ public static function GNUDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57
Metadata: None
Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-bar.phar
Expand All @@ -581,6 +602,7 @@ public static function GNUDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -592,6 +614,8 @@ public static function GNUDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57</diff-expected>
<diff-actual>+Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)</diff-expected>
<diff-actual>+Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-actual>
Contents: 1 file (6.64KB)
// Comparing the two archives contents (gnu diff)...
Expand All @@ -617,6 +641,7 @@ public static function GNUDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-baz.phar
Expand All @@ -625,6 +650,7 @@ public static function GNUDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5
Metadata: None
Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)
Contents: 1 file (6.61KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -636,7 +662,9 @@ public static function GNUDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-expected>
<diff-actual>+Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-expected>
<diff-expected>-Contents: 1 file (6.64KB)</diff-expected>
<diff-actual>+Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)</diff-actual>
<diff-actual>+Contents: 1 file (6.61KB)</diff-actual>
// Comparing the two archives contents (gnu diff)...
Expand All @@ -658,6 +686,7 @@ public static function GNUDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-baz.phar
Expand All @@ -666,6 +695,7 @@ public static function GNUDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5
Metadata: None
Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)
Contents: 1 file (6.61KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -677,7 +707,9 @@ public static function GNUDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-expected>
<diff-actual>+Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-expected>
<diff-expected>-Contents: 1 file (6.64KB)</diff-expected>
<diff-actual>+Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)</diff-actual>
<diff-actual>+Contents: 1 file (6.61KB)</diff-actual>
// Comparing the two archives contents (gnu diff)...
Expand Down Expand Up @@ -720,6 +752,7 @@ public static function checksumDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57
Metadata: None
Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-bar.phar
Expand All @@ -728,6 +761,7 @@ public static function checksumDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -739,6 +773,8 @@ public static function checksumDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57</diff-expected>
<diff-actual>+Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)</diff-expected>
<diff-actual>+Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-actual>
Contents: 1 file (6.64KB)
// Comparing the two archives contents (checksum diff)...
Expand Down Expand Up @@ -769,6 +805,7 @@ public static function checksumDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57
Metadata: None
Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-bar.phar
Expand All @@ -777,6 +814,7 @@ public static function checksumDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -788,6 +826,8 @@ public static function checksumDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 311080EF8E479CE18D866B744B7D467880BFBF57</diff-expected>
<diff-actual>+Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839821 (2019-03-17T16:23:41+00:00)</diff-expected>
<diff-actual>+Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-actual>
Contents: 1 file (6.64KB)
// Comparing the two archives contents (checksum diff)...
Expand Down Expand Up @@ -818,6 +858,7 @@ public static function checksumDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51
Metadata: None
Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)
Contents: 1 file (6.64KB)
Archive: simple-phar-baz.phar
Expand All @@ -826,6 +867,7 @@ public static function checksumDiffPharsProvider(): iterable
Signature: SHA-1
Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5
Metadata: None
Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)
Contents: 1 file (6.61KB)
<diff-expected>--- PHAR A</diff-expected>
Expand All @@ -837,7 +879,9 @@ public static function checksumDiffPharsProvider(): iterable
<diff-expected>-Signature Hash: 9ADC09F73909EDF14F8A4ABF9758B6FFAD1BBC51</diff-expected>
<diff-actual>+Signature Hash: 122A636B8BB0348C9514833D70281EF6306A5BF5</diff-actual>
Metadata: None
<diff-expected>-Timestamp: 1552839827 (2019-03-17T16:23:47+00:00)</diff-expected>
<diff-expected>-Contents: 1 file (6.64KB)</diff-expected>
<diff-actual>+Timestamp: 1552839693 (2019-03-17T16:21:33+00:00)</diff-actual>
<diff-actual>+Contents: 1 file (6.61KB)</diff-actual>
// Comparing the two archives contents (checksum diff)...
Expand Down

0 comments on commit 20027b9

Please sign in to comment.