title: How to Behat test for date dependent Symfony command?
body: <p>I run a CLI Symfony command that works on last month transactions. It's CLI - I can't just mock the system clock so how do I test this with Behat? It's November, the following scenario will fail in December:</p>
  <pre><code>  Scenario: Do something with last month transactions
      Given there is a transaction &quot;7ccf7387&quot; for 2020-10
      And there is a transaction &quot;39d7f278&quot; for 2020-10
      When I execute &quot;bin/console billing:last-month&quot; from project root
      Then command should succeed
      And output should contain &quot;Closed 2 transactions&quot;
  </code></pre>
  <p>This is current command implementation:</p>
  <pre class="lang-php prettyprint-override"><code>    final class CloseLastMonth extends Command
      {
          /* ... */
      
          protected function execute(InputInterface $input, OutputInterface $output): int
          {
              $month = (GregorianCalendar::UTC())-&gt;currentMonth()-&gt;previous();
              $trxs = $this-&gt;bus-&gt;dispatch(new GetActiveTrxsByMonthQuery($month));
              foreach ($trxs as $trx) {
                  $this-&gt;bus-&gt;dispatch(new CloseTransactionCommand($trx-&gt;id));
              }
              $this-&gt;io-&gt;success(sprintf('Closed %d transactions', count($trxs)));
      
              return 0;
          }
      
          /* ... */
      }
  </code></pre>
  <p>I could force the user to always pass a current month in the command arguments but it's inelegant. New Symfony service that always returns current month is an overkill.</p>