<?php
require_once 'core/slir.class.php';

abstract class SLIRTestCase extends PHPUnit_Framework_TestCase
{
  /**
   * @var SLIR
   */
  protected $slir;

  /**
   * @return void
   */
  protected function setUp()
  {
    $this->slir = new SLIR();
    $this->slir->getConfig();
    SLIRConfig::$defaultImagePath = null;
    SLIRConfig::$forceQueryString = false;

    // Try to fix documentRoot for CLI
    SLIRConfig::$documentRoot = preg_replace('`/slir/?$`', '', SLIRConfig::$documentRoot);
  }

  /**
   * @return void
   */
  protected function tearDown()
  {
    unset($this->slir);
  }
}

<?php
require_once 'core/slir.class.php';

abstract class SLIRTestCase extends PHPUnit_Framework_TestCase
{
  protected function setUp()
  {
    $slir = new SLIR();
    $slir->getConfig();
    SLIRConfig::$defaultImagePath = null;
    SLIRConfig::$forceQueryString = false;

    // Try to fix documentRoot for CLI
    SLIRConfig::$documentRoot = preg_replace('`/slir/?$`', '', SLIRConfig::$documentRoot);
  }
}

--- 
+++ 
@@ -3,14 +3,30 @@
 
 abstract class SLIRTestCase extends PHPUnit_Framework_TestCase
 {
+  /**
+   * @var SLIR
+   */
+  protected $slir;
+
+  /**
+   * @return void
+   */
   protected function setUp()
   {
-    $slir = new SLIR();
-    $slir->getConfig();
+    $this->slir = new SLIR();
+    $this->slir->getConfig();
     SLIRConfig::$defaultImagePath = null;
     SLIRConfig::$forceQueryString = false;
 
     // Try to fix documentRoot for CLI
     SLIRConfig::$documentRoot = preg_replace('`/slir/?$`', '', SLIRConfig::$documentRoot);
   }
+
+  /**
+   * @return void
+   */
+  protected function tearDown()
+  {
+    unset($this->slir);
+  }
 }
Set up the instance of SLIR as a property of the object so it can be used by test cases if we want to.
