title: Validating configuration files through Unit Tests?
body: <p>I'm building an application where users can choose one of the defined timezones in <code>config/timezones.php</code>:</p>
  
  <pre><code>return [
      'malta'   =&gt; 'Europe/Malta',
      'manila'  =&gt; 'Asia/Manila',
      'newyork' =&gt; 'America/New_York',
  ];
  </code></pre>
  
  <p>This file has an array with an identifier and a valid time zone string (as found <a href="https://secure.php.net/manual/en/timezones.php" rel="nofollow noreferrer">on PHP.net</a>)</p>
  
  <p>I'm trying to build this application based on test driven development, so naturally I wrote a unit test to check if the time changed correctly when a user changed its timezone:</p>
  
  <pre><code>namespace Tests\Unit;
  
  use Carbon\Carbon;
  use Tests\TestCase;
  use Illuminate\Foundation\Testing\RefreshDatabase;
  
  class TimeZoneTest extends TestCase
  {
  
      use RefreshDatabase;
  
      /** @test */
      public function the_date_and_time_will_be_displayed_based_on_the_timezone_of_the_user() {
  
          $user = factory(\App\User::class)-&gt;create([
              'timezone' =&gt; 'Asia/Manila' // +8 hours
          ]);
  
          $date = Carbon::create(2018, 1, 1, 0, 0, 0); // 2018-01-01 00:00:00
  
          $adjustedDate = $date-&gt;timezone($user-&gt;timezone)-&gt;format('Y-m-d H:i:s'); // +8 hours = 2018-01-01 08:00:00
  
          $this-&gt;assertEquals('2018-01-01 08:00:00', $adjustedDate);
      }
  }
  </code></pre>
  
  <p>This works fine, but here's the problem: if I were to make a typo in the configuration file, the unit test will still pass but the application will break.</p>
  
  <p>I could simply create another unit test where I loop and validate the items of my configuration file using <code>in_array($timezone, timezone_identifiers_list())</code>, but I am not sure if that belongs in a unit test. It feels to me that this only needs to be validated once upon committing your code or something.</p>
  
  <p>My questions: <strong>how/where/when do I check if my configuration file is valid before it's deployed to production?</strong></p>