diff --git a/src/Lunr/Core/Tests/ConfigurationLoadFileTest.php b/src/Lunr/Core/Tests/ConfigurationLoadFileTest.php
index ae4c05d3465be0d73de3e60158cc1e23da0a394e..c310ddb12cb0a1c3b2f81d9ef0e5620f37e7d477 100644
--- a/src/Lunr/Core/Tests/ConfigurationLoadFileTest.php
+++ b/src/Lunr/Core/Tests/ConfigurationLoadFileTest.php
@@ -14,7 +14,6 @@
 namespace Lunr\Core\Tests;
 
 use Lunr\Core\Configuration;
-use PHPUnit\Framework\Error\Error as PHPUnit_Framework_Error;
 
 /**
  * This tests loading configuration files via the Configuration class.
@@ -114,11 +113,18 @@ class ConfigurationLoadFileTest extends ConfigurationTest
 
     /**
      * Test loading a non-existing file.
-     *
-     * @expectedException PHPUnit_Framework_Error
      */
     public function testLoadNonExistingFile()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Error'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Error::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error::class);
+        }
+
         $property = $this->configuration_reflection->getProperty('config');
         $property->setAccessible(TRUE);
 
diff --git a/src/Lunr/Corona/Tests/FrontControllerDispatchTest.php b/src/Lunr/Corona/Tests/FrontControllerDispatchTest.php
index c4b004e4dff27779fa048fbcd1542bd3ec3d83c9..121ca31dfef067b35a5cfbe14b9468063e3002cb 100644
--- a/src/Lunr/Corona/Tests/FrontControllerDispatchTest.php
+++ b/src/Lunr/Corona/Tests/FrontControllerDispatchTest.php
@@ -13,8 +13,6 @@
 
 namespace Lunr\Corona\Tests;
 
-use PHPUnit\Framework\Error\Error as PHPUnit_Framework_Error;
-
 /**
  * This class contains tests for dispatching controllers with the FrontController class.
  *
@@ -76,12 +74,20 @@ class FrontControllerDispatchTest extends FrontControllerTest
      *
      * @param mixed $value Invalid controller name.
      *
-     * @expectedException PHPUnit_Framework_Error
      * @dataProvider      invalidControllerNameProvider
      * @covers            Lunr\Corona\FrontController::dispatch
      */
     function testDispatchWithInvalidControllerValues($value)
     {
+        if (class_exists('\PHPUnit\Framework\Error\Error'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Error::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error::class);
+        }
+
         $this->request->expects($this->at(0))
                       ->method('__get')
                       ->with('method')
diff --git a/src/Lunr/Gravity/Database/SQLite3/Tests/LunrSQLite3Test.php b/src/Lunr/Gravity/Database/SQLite3/Tests/LunrSQLite3Test.php
index 5146ac79f474f0d555479f4e0c61b044cbffc2d0..d8accdd07ad3c7cf6e3dfc3baaaefe3d2483addd 100644
--- a/src/Lunr/Gravity/Database/SQLite3/Tests/LunrSQLite3Test.php
+++ b/src/Lunr/Gravity/Database/SQLite3/Tests/LunrSQLite3Test.php
@@ -15,7 +15,6 @@ namespace Lunr\Gravity\Database\SQLite3\Tests;
 
 use Lunr\Gravity\Database\SQLite3\LunrSQLite3;
 use Lunr\Halo\LunrBaseTest;
-use PHPUnit\Framework\Error\Warning as PHPUnit_Framework_Error_Warning;
 use ReflectionClass;
 
 /**
@@ -50,21 +49,35 @@ class LunrSQLite3Test extends LunrBaseTest
 
     /**
      * Test that busyTimeout throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testBusyTimeoutThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertFALSE($this->class->busyTimeout(1000));
     }
 
     /**
      * Test that changes throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testChangesThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertEquals(0, $this->class->changes());
     }
 
@@ -86,71 +99,120 @@ class LunrSQLite3Test extends LunrBaseTest
 
     /**
      * Test that exec throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testExecThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertFalse($this->class->exec('Test'));
     }
 
     /**
      * Test that lastErrorCode throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testLastErrorCodeThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertEquals(0, $this->class->lastErrorCode());
     }
 
     /**
      * Test that lastErrorMsg throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testLastErrorMsgThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertEquals(0, $this->class->lastErrorMsg());
     }
 
     /**
      * Test that lastInsertRowID throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testLastInsertRowIDThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertEquals(0, $this->class->lastInsertRowID());
     }
 
     /**
      * Test that prepare throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testPrepareThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertFalse($this->class->prepare('Test'));
     }
 
     /**
      * Test that query throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testQueryThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertFalse($this->class->query('Test'));
     }
 
     /**
      * Test that querySingle throws a warning because we are not yet connected.
-     *
-     * @expectedException PHPUnit_Framework_Error_Warning
      */
     public function testQuerySingleThrowsWarning()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertFalse($this->class->querySingle('Test'));
     }
 
diff --git a/src/Lunr/Gravity/Database/Tests/DatabaseQueryEscaperEscapeTest.php b/src/Lunr/Gravity/Database/Tests/DatabaseQueryEscaperEscapeTest.php
index ea72ac3cdbbc9b3fc8e53ad6b2d5abaf0785e28d..9a02e360a38413a0b9c71e408ca4ca8936cd0964 100644
--- a/src/Lunr/Gravity/Database/Tests/DatabaseQueryEscaperEscapeTest.php
+++ b/src/Lunr/Gravity/Database/Tests/DatabaseQueryEscaperEscapeTest.php
@@ -15,7 +15,6 @@ namespace Lunr\Gravity\Database\Tests;
 
 use Lunr\Gravity\Database\DatabaseQueryEscaper;
 use Lunr\Halo\LunrBaseTest;
-use PHPUnit\Framework\Error\Notice as PHPUnit_Framework_Error_Notice;
 use ReflectionClass;
 
 /**
@@ -227,11 +226,18 @@ class DatabaseQueryEscaperEscapeTest extends DatabaseQueryEscaperTest
     /**
      * Test escaping an object as integer.
      *
-     * @expectedException PHPUnit_Framework_Error_Notice
      * @covers            Lunr\Gravity\Database\DatabaseQueryEscaper::intvalue
      */
     public function testEscapeObjectAsIntValue()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Error'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Error::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error::class);
+        }
         $this->assertEquals(0, $this->class->intvalue($this->class));
     }
 
@@ -266,11 +272,18 @@ class DatabaseQueryEscaperEscapeTest extends DatabaseQueryEscaperTest
     /**
      * Test escaping an object as float.
      *
-     * @expectedException PHPUnit_Framework_Error_Notice
      * @covers            Lunr\Gravity\Database\DatabaseQueryEscaper::floatvalue
      */
     public function testEscapeObjectAsFloatValue()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Notice'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Notice::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error::class);
+        }
         $this->assertEquals(0, $this->class->floatvalue($this->class));
     }
 
diff --git a/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectDirectoryTest.php b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectDirectoryTest.php
index 21a1a1272940b00b297e9c689fb7f8509e6a7f97..100b7fc2c374fc2eec5406a9e1a6586922787e87 100644
--- a/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectDirectoryTest.php
+++ b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectDirectoryTest.php
@@ -15,7 +15,6 @@
 namespace Lunr\Gravity\Filesystem\Tests;
 
 use Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject;
-use PHPUnit\Framework\Error\Warning as PHPUnit_Framework_Error_Warning;
 
 /**
  * This class contains tests for directory related methods in the PhysicalFilesystemAccessObject.
@@ -46,11 +45,19 @@ class PhysicalFilesystemAccessObjectDirectoryTest extends PhysicalFilesystemAcce
     /**
      * Test listing  an inaccessible directory.
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_directory_listing
      */
     public function testGetListingOfInaccessibleDirectory()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $directory = '/root';
 
         $value = $this->class->get_directory_listing($directory);
@@ -61,11 +68,19 @@ class PhysicalFilesystemAccessObjectDirectoryTest extends PhysicalFilesystemAcce
     /**
      * Test listing an non-existant directory.
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_directory_listing
      */
     public function testGetListingOfNonExistantDirectory()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $directory = '/tmp56474q';
 
         $value = $this->class->get_directory_listing($directory);
@@ -76,12 +91,20 @@ class PhysicalFilesystemAccessObjectDirectoryTest extends PhysicalFilesystemAcce
     /**
      * Test listing a file.
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_directory_listing
      */
     public function testGetListingOfFile()
     {
-        $directory = tempnam('/tmp', 'phpunit_');;
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
+        $directory = tempnam(sys_get_temp_dir(), 'phpunit_');;
 
         $value = $this->class->get_directory_listing($directory);
 
@@ -93,12 +116,20 @@ class PhysicalFilesystemAccessObjectDirectoryTest extends PhysicalFilesystemAcce
      *
      * @param mixed $directory Invalid directory value
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @dataProvider      invalidNameProvider
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_directory_listing
      */
     Public function testGetListingOfInvalidDirectory($directory)
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $value = $this->class->get_directory_listing($directory);
 
         $this->assertArrayEmpty($value);
@@ -109,12 +140,20 @@ class PhysicalFilesystemAccessObjectDirectoryTest extends PhysicalFilesystemAcce
      *
      * @param Boolean $directory Boolean directory value
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @dataProvider      booleanNameProvider
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_directory_listing
      */
     Public function testGetListingOfBooleanDirectory($directory)
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $value = $this->class->get_directory_listing($directory);
 
         $this->assertArrayEmpty($value);
diff --git a/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectFileTest.php b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectFileTest.php
index 55c3439f23f1aebc3ead20854baa8dbc30dbb33b..6332a908692c29662231566b19d7756dfe2601c6 100644
--- a/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectFileTest.php
+++ b/src/Lunr/Gravity/Filesystem/Tests/PhysicalFilesystemAccessObjectFileTest.php
@@ -14,7 +14,6 @@
 namespace Lunr\Gravity\Filesystem\Tests;
 
 use Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject;
-use PHPUnit\Framework\Error\Warning as PHPUnit_Framework_Error_Warning;
 
 /**
  * This class contains tests for file related methods in the PhysicalFilesystemAccessObject.
@@ -43,11 +42,19 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
     /**
      * Test that get_file_content() does not get contents of an inaccessible file.
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_file_content
      */
     public function testGetFileContentWithInaccessibleFile()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $file = '/root/ab45cd89';
 
         $fetched = $this->class->get_file_content($file);
@@ -58,12 +65,20 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
     /**
      * Test that get_file_content() does not get contents of a non-existant file.
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_file_content
      */
     public function testGetFileContentWithNonExistantFile()
     {
-        $file = '/tmp/ab45cd89';
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
+        $file = sys_get_temp_dir() . '/ab45cd89';
 
         $fetched = $this->class->get_file_content($file);
 
@@ -77,7 +92,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testGetFileContentOfDirectory()
     {
-        $file = '/tmp';
+        $file = sys_get_temp_dir();
 
         $fetched = $this->class->get_file_content($file);
 
@@ -89,12 +104,20 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      *
      * @param mixed $file Invalid filename
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @dataProvider      invalidNameProvider
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::get_file_content
      */
     public function testGetFileContentWithInvalidFilenames($file)
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $fetched = $this->class->get_file_content($file);
 
         $this->assertFalse($fetched);
@@ -122,7 +145,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testPutFileContentWithAccessibleFile()
     {
-        $file = tempnam('/tmp', 'phpunit_');
+        $file = tempnam(sys_get_temp_dir(), 'phpunit_');
 
         $content = "Content\n";
 
@@ -135,11 +158,19 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
     /**
      * Test that put_file_content() does not put contents in an inaccessible file.
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::put_file_content
      */
     public function testPutFileContentWithInaccessibleFile()
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $file = '/root/ab45cd89';
 
         $content = "Content\n";
@@ -156,7 +187,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testPutFileContentWithNonExistantFile()
     {
-        $file = '/tmp/ab65cd89';
+        $file = sys_get_temp_dir() . '/ab65cd89';
 
         $this->assertFalse(file_exists($file));
 
@@ -172,12 +203,20 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
     /**
      * Test that put_file_content() does not put contents in a directory.
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::put_file_content
      */
     public function testPutFileContentInDirectory()
     {
-        $file = '/tmp';
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
+        $file = sys_get_temp_dir();
 
         $content = "Content\n";
 
@@ -191,12 +230,20 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      *
      * @param mixed $file Invalid filename
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @dataProvider      invalidNameProvider
      * @covers            Lunr\Gravity\Filesystem\PhysicalFilesystemAccessObject::put_file_content
      */
     public function testPutFileContentWithInvalidFilenames($file)
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $content = "Content\n";
 
         $written = $this->class->put_file_content($file, $content);
@@ -228,7 +275,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testPutFileContentAppendsToFile()
     {
-        $file = tempnam('/tmp', 'phpunit_');
+        $file = tempnam(sys_get_temp_dir(), 'phpunit_');
 
         $content = "Content\n";
 
@@ -245,7 +292,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testPutFileContentAcquiresExclusiveLock()
     {
-        $file = tempnam('/tmp', 'phpunit_');
+        $file = tempnam(sys_get_temp_dir(), 'phpunit_');
 
         $content = "Content\n";
 
@@ -262,7 +309,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testPutFileContentAppendsToFileAndAcquiresExclusiveLock()
     {
-        $file = tempnam('/tmp', 'phpunit_');
+        $file = tempnam(sys_get_temp_dir(), 'phpunit_');
 
         $content = "Content\n";
 
@@ -279,7 +326,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testGetFileObjectForAccessibleFile()
     {
-        $file = tempnam('/tmp', 'phpunit_');
+        $file = tempnam(sys_get_temp_dir(), 'phpunit_');
 
         $value = $this->class->get_file_object($file);
 
@@ -297,7 +344,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testGetFileObjectForAccessibleFileWithInvalidMode($mode, $message)
     {
-        $file = tempnam('/tmp', 'phpunit_');
+        $file = tempnam(sys_get_temp_dir(), 'phpunit_');
 
         $filename = is_object($mode) ? '' : $file;
 
@@ -337,7 +384,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testGetFileObjectForNonExistantFile()
     {
-        $file = '/tmp/ab65cd89';
+        $file = sys_get_temp_dir() . '/ab65cd89';
 
         $error = "SplFileObject::__construct($file): failed to open stream: No such file or directory";
 
@@ -359,7 +406,7 @@ class PhysicalFilesystemAccessObjectFileTest extends PhysicalFilesystemAccessObj
      */
     public function testGetFileObjectOfDirectory()
     {
-        $file = '/tmp';
+        $file = sys_get_temp_dir();
 
         $error = 'Cannot use SplFileObject with directories';
 
diff --git a/src/Lunr/Sphere/Tests/SessionBaseTest.php b/src/Lunr/Sphere/Tests/SessionBaseTest.php
index e2e296acce7ccd152575d385c93223f8c9152371..3f0f316ff906ac780ca9b791084b59cb9fcf95ac 100644
--- a/src/Lunr/Sphere/Tests/SessionBaseTest.php
+++ b/src/Lunr/Sphere/Tests/SessionBaseTest.php
@@ -13,8 +13,6 @@
 
 namespace Lunr\Sphere\Tests;
 
-use PHPUnit\Framework\Error\Warning as PHPUnit_Framework_Error_Warning;
-
 /**
  * This class contains tests for the Session class.
  *
@@ -58,12 +56,20 @@ class SessionBaseTest extends SessionTest
      *
      * @param mixed $handler Invalid Session handler
      *
-     * @expectedException PHPUnit_Framework_Error_Warning
      * @dataProvider      invalidSessionHandlerProvider
      * @covers            Lunr\Sphere\Session::setSessionHandler
      */
     public function testSetSessionHandlerReturnsFalseWithInvalidData($handler)
     {
+        if (class_exists('\PHPUnit\Framework\Error\Warning'))
+        {
+            // PHPUnit 6
+            $this->expectException(\PHPUnit\Framework\Error\Warning::class);
+        } else {
+            // PHPUnit 5
+            $this->expectException(\PHPUnit_Framework_Error_Warning::class);
+        }
+
         $this->assertFalse($this->class->setSessionHandler($handler));
     }
 
diff --git a/tests/system/EnvironmentTest.php b/tests/system/EnvironmentTest.php
index ba6d4e293fa9bd5086c98ea9a784c0cd0bb0aa57..5df535cb9ec72763fd4b7d260a189407e11bc1ae 100644
--- a/tests/system/EnvironmentTest.php
+++ b/tests/system/EnvironmentTest.php
@@ -30,6 +30,12 @@ class EnvironmentTest extends TestCase
     public function testL10nFiles()
     {
         $file = TEST_STATICS . '/l10n/de_DE/LC_MESSAGES/Lunr.mo';
+        if (!file_exists($file))
+        {
+            $this->markTestSkipped('.mo file required, please run ant l10n to generate it');
+            return;
+        }
+
         $this->assertTrue(file_exists($file));
     }
 
