title: Why is Laravel PHPUnit in-memory test seeding my main db?
body: <p><strong>[UPDATE] Testing seems to work find in-memory if i used query builder (i.e. DB::table()), but uses main table when using Eloquent. Still no hint.</strong></p>
  
  <p>I have followed these 2 tutorials to get in-memory testing to work: </p>
  
  <p><a href="http://code.tutsplus.com/tutorials/testing-like-a-boss-in-laravel-models--net-30087" rel="nofollow">testing-like-a-boss-in-laravel-models</a></p>
  
  <p><a href="http://ryanstelmat.com/laravel-setting-up-an-in-memory-test-database/" rel="nofollow">laravel-setting-up-an-in-memory-test-database</a></p>
  
  <p>I first tried with migrating/seeding a table that doesn't exist in my main mysql database. Everything was fine, the table was not created in mysql and test assertion was successful.</p>
  
  <p>Then I tried migrating/seeding/in-memory testing with a real table, found that it was seeded in my main mysql db.</p>
  
  <p>Newly trying in-memory testing. Need help with this: 
  1. No idea why my main db is being touched.
  2. How to verify in-memory db is populated? Any way to browse through it?</p>
  
  <p>Main steps followed:</p>
  
  <p>in app/config/testing/database.php</p>
  
  <pre><code>'default' =&gt; 'testing',
  
  'testing' =&gt; array(
              'driver'   =&gt; 'sqlite',
              'database' =&gt; ':memory:',
              'prefix'   =&gt; '',
          )
  </code></pre>
  
  <p>in phpunit.xml, added this:</p>
  
  <pre><code>&lt;php&gt;
          &lt;env name="APP_ENV" value="testing"/&gt;
          &lt;env name="CACHE_DRIVER" value="array"/&gt;
          &lt;env name="SESSION_DRIVER" value="array"/&gt;
          &lt;env name="QUEUE_DRIVER" value="sync"/&gt;
          &lt;env name="DB_CONNECTION" value="testing"/&gt;
      &lt;/php&gt;
  </code></pre>
  
  <p>in TestCase class:</p>
  
  <pre><code>public function createApplication()
      {
          $unitTesting = true;
          $testEnvironment = 'testing';
          return require __DIR__.'/../../bootstrap/start.php';
      }
  </code></pre>
  
  <p>in my test class:</p>
  
  <pre><code>public function setUp()
      {
          parent::setUp();
          Artisan::call('migrate');
          Artisan::call('db:seed', ['--class' =&gt; 'DatabaseSeeder', '--database' =&gt; 'testing']);
      }
  </code></pre>