heroku / heroku-buildpack-php

Heroku's buildpack for PHP applications.
https://devcenter.heroku.com/categories/php
MIT License
808 stars 1.59k forks source link

Tests for Dev Center generator #701

Closed dzuelke closed 8 months ago

dzuelke commented 8 months ago

The various version tables for the PHP Support article on Dev Center are generated by a utility program with fairly complex logic that should be covered by tests to avoid regressions and make it easier to confidently update it in the future, so here are some tests for it.

Fixtures are heavily filtered repositories that still have realistic data, keeps the size reasonable. README.md in fixture dir explains jq program used to do this, for future updates.

The generate.php program now accepts overrides for current date, stacks, and PHP version series, to ensure that the test remains stable over time (the generated HTML would otherwise change once a future version goes into security/EOL mode, or when a stack is added/removed, or when the PHP version series change).

Some minor cleanup that improves the generated Markdown (HTML, really) table elements' indentation, too; excerpt:

--- /dev/fd/63  2024-02-28 14:49:38.859815727 +0000
+++ /dev/fd/62  2024-02-28 14:49:38.859815727 +0000
@@ -53,34 +53,34 @@
    <tbody>
        <tr style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">
            <td style="white-space:nowrap">PHP 7.3</td>
-               <td>7.3.33</td>
-               <td>-</td>
-           </tr>
+           <td>7.3.33</td>
+           <td>-</td>
+       </tr>
        <tr style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">
            <td style="white-space:nowrap">PHP 7.4</td>
…
@@ -202,490 +202,490 @@
    <tbody>
        <tr>
            <td style="white-space: nowrap"><code><a href="http://php.net/bcmath">ext-bcmath</a></code></td>
-               <td style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">&#x2714;<br/></td>
-               <td style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">&#x2731;<br/></td>
-               <td style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">&#x2731;<br/></td>
-               <td style="background-color: #fff3c5; color: #927200">&#x2731;<br/></td>
-               <td>&#x2731;<br/></td>
-               <td>&#x2731;<br/></td>
-           </tr>
+           <td style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">&#x2714;</td>
+           <td style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">&#x2731;</td>
+           <td style="background-color: rgba(194, 66, 0, 0.1); color: #C24200">&#x2731;</td>
+           <td style="background-color: #fff3c5; color: #927200">&#x2731;</td>
+           <td>&#x2731;</td>
+           <td>&#x2731;</td>
+       </tr>
        <tr>
            <td style="white-space: nowrap"><code><a href="http://php.net/bzip2">ext-bz2</a></code></td>
…

GUS-W-15149734