From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Sun, 13 Dec 2020 15:55:19 -0400
Subject: Adapt to recent version of PHPUnit (9)

---
 tests/AppTest.php                | 489 ++++++++++++++++++++++++++++++++-------
 tests/ContainerTest.php          |  13 +-
 tests/Handlers/ErrorTest.php     |   4 +-
 tests/Handlers/PhpErrorTest.php  |   2 +-
 tests/Http/BodyTest.php          |  15 +-
 tests/Http/HeadersTest.php       |  16 +-
 tests/Http/MessageTest.php       |   4 +-
 tests/Http/RequestBodyTest.php   |  17 +-
 tests/Http/RequestTest.php       |  85 ++++---
 tests/Http/ResponseTest.php      | 109 +++++++--
 tests/Http/StreamTest.php        |  12 +-
 tests/Http/UploadedFilesTest.php |   3 +-
 tests/Http/UriTest.php           | 283 +++++++++++++++++-----
 tests/MiddlewareAwareTest.php    |   4 +-
 tests/RouteTest.php              |  31 ++-
 tests/RouterTest.php             |  47 ++--
 16 files changed, 859 insertions(+), 275 deletions(-)

diff --git a/tests/AppTest.php b/tests/AppTest.php
index 1dda3d6..9e0f038 100644
--- a/tests/AppTest.php
+++ b/tests/AppTest.php
@@ -15,6 +15,7 @@ use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\UriInterface;
 use ReflectionMethod;
+use ReflectionObject;
 use RuntimeException;
 use Slim\App;
 use Slim\Container;
@@ -91,7 +92,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->get($path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('GET', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('GET', $value);
     }
 
     public function testPostRoute()
@@ -104,7 +111,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->post($path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('POST', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('POST', $value);
     }
 
     public function testPutRoute()
@@ -117,7 +130,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->put($path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('PUT', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('PUT', $value);
     }
 
     public function testPatchRoute()
@@ -130,7 +149,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->patch($path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('PATCH', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('PATCH', $value);
     }
 
     public function testDeleteRoute()
@@ -143,7 +168,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->delete($path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('DELETE', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('DELETE', $value);
     }
 
     public function testOptionsRoute()
@@ -156,7 +187,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->options($path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('OPTIONS', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('OPTIONS', $value);
     }
 
     public function testAnyRoute()
@@ -169,12 +206,48 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->any($path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('GET', 'methods', $route);
-        $this->assertAttributeContains('POST', 'methods', $route);
-        $this->assertAttributeContains('PUT', 'methods', $route);
-        $this->assertAttributeContains('PATCH', 'methods', $route);
-        $this->assertAttributeContains('DELETE', 'methods', $route);
-        $this->assertAttributeContains('OPTIONS', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('GET', $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('POST', $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('PUT', $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('PATCH', $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('DELETE', $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('OPTIONS', $value);
     }
 
     public function testMapRoute()
@@ -187,8 +260,20 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->map(['GET', 'POST'], $path, $callable);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('GET', 'methods', $route);
-        $this->assertAttributeContains('POST', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('GET', $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('POST', $value);
     }
 
     public function testRedirectRoute()
@@ -203,7 +288,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $route = $app->redirect($source, $destination, 301);
 
         $this->assertInstanceOf('\Slim\Route', $route);
-        $this->assertAttributeContains('GET', 'methods', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertContains('GET', $value);
 
         $response = $route->run($request, new Response());
         $this->assertEquals(301, $response->getStatusCode());
@@ -229,7 +320,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo', $value);
     }
 
     public function testSegmentRouteThatEndsInASlash()
@@ -240,7 +337,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/', $value);
     }
 
     public function testSegmentRouteThatDoesNotStartWithASlash()
@@ -251,7 +354,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('foo', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('foo', $value);
     }
 
     public function testSingleSlashRoute()
@@ -262,7 +371,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/', $value);
     }
 
     public function testEmptyRoute()
@@ -273,7 +388,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
     public function testGroupSegmentWithSegmentRouteThatDoesNotEndInASlash()
@@ -286,7 +407,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/bar', $value);
     }
 
     public function testGroupSegmentWithSegmentRouteThatEndsInASlash()
@@ -299,7 +426,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/bar/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/bar/', $value);
     }
 
     public function testGroupSegmentWithSingleSlashRoute()
@@ -312,7 +445,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/', $value);
     }
 
     public function testGroupSegmentWithEmptyRoute()
@@ -325,7 +464,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo', $value);
     }
 
     public function testTwoGroupSegmentsWithSingleSlashRoute()
@@ -340,7 +485,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/baz/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/baz/', $value);
     }
 
     public function testTwoGroupSegmentsWithAnEmptyRoute()
@@ -355,7 +506,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/baz', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/baz', $value);
     }
 
     public function testTwoGroupSegmentsWithSegmentRoute()
@@ -370,7 +527,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/baz/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/baz/bar', $value);
     }
 
     public function testTwoGroupSegmentsWithSegmentRouteThatHasATrailingSlash()
@@ -385,7 +548,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/baz/bar/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/baz/bar/', $value);
     }
 
     public function testGroupSegmentWithSingleSlashNestedGroupAndSegmentRoute()
@@ -400,7 +569,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo//bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo//bar', $value);
     }
 
     public function testGroupSegmentWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash()
@@ -415,7 +590,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/bar', $value);
     }
 
     public function testGroupSegmentWithEmptyNestedGroupAndSegmentRoute()
@@ -430,7 +611,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foo/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foo/bar', $value);
     }
 
     public function testGroupSegmentWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash()
@@ -445,7 +632,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/foobar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/foobar', $value);
     }
 
     public function testGroupSingleSlashWithSegmentRouteThatDoesNotEndInASlash()
@@ -458,7 +651,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//bar', $value);
     }
 
     public function testGroupSingleSlashWithSegmentRouteThatEndsInASlash()
@@ -471,7 +670,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//bar/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//bar/', $value);
     }
 
     public function testGroupSingleSlashWithSingleSlashRoute()
@@ -484,7 +689,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//', $value);
     }
 
     public function testGroupSingleSlashWithEmptyRoute()
@@ -497,7 +708,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/', $value);
     }
 
     public function testGroupSingleSlashWithNestedGroupSegmentWithSingleSlashRoute()
@@ -512,7 +729,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//baz/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//baz/', $value);
     }
 
     public function testGroupSingleSlashWithNestedGroupSegmentWithAnEmptyRoute()
@@ -527,7 +750,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//baz', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//baz', $value);
     }
 
     public function testGroupSingleSlashWithNestedGroupSegmentWithSegmentRoute()
@@ -542,7 +771,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//baz/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//baz/bar', $value);
     }
 
     public function testGroupSingleSlashWithNestedGroupSegmentWithSegmentRouteThatHasATrailingSlash()
@@ -557,7 +792,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//baz/bar/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//baz/bar/', $value);
     }
 
     public function testGroupSingleSlashWithSingleSlashNestedGroupAndSegmentRoute()
@@ -572,7 +813,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('///bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('///bar', $value);
     }
 
     public function testGroupSingleSlashWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash()
@@ -587,7 +834,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//bar', $value);
     }
 
     public function testGroupSingleSlashWithEmptyNestedGroupAndSegmentRoute()
@@ -602,7 +855,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//bar', $value);
     }
 
     public function testGroupSingleSlashWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash()
@@ -617,7 +876,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/bar', $value);
     }
 
     public function testEmptyGroupWithSegmentRouteThatDoesNotEndInASlash()
@@ -630,7 +895,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/bar', $value);
     }
 
     public function testEmptyGroupWithSegmentRouteThatEndsInASlash()
@@ -643,7 +914,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/bar/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/bar/', $value);
     }
 
     public function testEmptyGroupWithSingleSlashRoute()
@@ -656,7 +933,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/', $value);
     }
 
     public function testEmptyGroupWithEmptyRoute()
@@ -669,7 +952,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
     public function testEmptyGroupWithNestedGroupSegmentWithSingleSlashRoute()
@@ -684,7 +973,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/baz/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/baz/', $value);
     }
 
     public function testEmptyGroupWithNestedGroupSegmentWithAnEmptyRoute()
@@ -699,7 +994,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/baz', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/baz', $value);
     }
 
     public function testEmptyGroupWithNestedGroupSegmentWithSegmentRoute()
@@ -714,7 +1015,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/baz/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/baz/bar', $value);
     }
 
     public function testEmptyGroupWithNestedGroupSegmentWithSegmentRouteThatHasATrailingSlash()
@@ -729,7 +1036,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/baz/bar/', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/baz/bar/', $value);
     }
 
     public function testEmptyGroupWithSingleSlashNestedGroupAndSegmentRoute()
@@ -744,7 +1057,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('//bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('//bar', $value);
     }
 
     public function testEmptyGroupWithSingleSlashGroupAndSegmentRouteWithoutLeadingSlash()
@@ -759,7 +1078,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/bar', $value);
     }
 
     public function testEmptyGroupWithEmptyNestedGroupAndSegmentRoute()
@@ -774,7 +1099,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('/bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/bar', $value);
     }
 
     public function testEmptyGroupWithEmptyNestedGroupAndSegmentRouteWithoutLeadingSlash()
@@ -789,7 +1120,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         });
         /** @var Router $router */
         $router = $app->getContainer()->get('router');
-        $this->assertAttributeEquals('bar', 'pattern', $router->lookupRoute('route0'));
+        $reflector = new ReflectionObject($router->lookupRoute('route0'));
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($router->lookupRoute('route0'));
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('bar', $value);
     }
 
     public function testBottomMiddlewareIsApp()
@@ -1034,7 +1371,7 @@ class AppTest extends PHPUnit\Framework\TestCase
         $this->assertInstanceOf('\Psr\Http\Message\ResponseInterface', $resOut);
         $this->assertEquals(405, (string)$resOut->getStatusCode());
         $this->assertEquals(['GET'], $resOut->getHeader('Allow'));
-        $this->assertContains(
+        $this->assertStringContainsString(
             '<p>Method not allowed. Must be one of: <strong>GET</strong></p>',
             (string)$resOut->getBody()
         );
@@ -1247,7 +1584,13 @@ class AppTest extends PHPUnit\Framework\TestCase
         $resOut = $app($req, $res);
 
         $this->assertInstanceOf('\Psr\Http\Message\ResponseInterface', $resOut);
-        $this->assertAttributeEquals(404, 'status', $resOut);
+        $reflector = new ReflectionObject($resOut);
+        $attribute = $reflector->getProperty('status');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($resOut);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(404, $value);
 
         // now test that exception is raised if the handler isn't registered
         unset($app->getContainer()['notFoundHandler']);
@@ -1960,11 +2303,9 @@ class AppTest extends PHPUnit\Framework\TestCase
         return $app;
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testRunExceptionNoHandler()
     {
+        $this->expectException('Exception');
         $app = $this->appFactory();
 
         $container = $app->getContainer();
@@ -2032,11 +2373,9 @@ class AppTest extends PHPUnit\Framework\TestCase
         $this->assertEquals(404, $res->getStatusCode());
     }
 
-    /**
-     * @expectedException \Slim\Exception\NotFoundException
-     */
     public function testRunNotFoundWithoutHandler()
     {
+        $this->expectException('\Slim\Exception\NotFoundException');
         $app = $this->appFactory();
         $container = $app->getContainer();
         unset($container['notFoundHandler']);
@@ -2065,11 +2404,9 @@ class AppTest extends PHPUnit\Framework\TestCase
         $this->assertEquals(405, $res->getStatusCode());
     }
 
-    /**
-     * @expectedException \Slim\Exception\MethodNotAllowedException
-     */
     public function testRunNotAllowedWithoutHandler()
     {
+        $this->expectException('\Slim\Exception\MethodNotAllowedException');
         $app = $this->appFactory();
         $container = $app->getContainer();
         unset($container['notAllowedHandler']);
@@ -2187,11 +2524,9 @@ class AppTest extends PHPUnit\Framework\TestCase
         $this->assertSame(404, $response->getStatusCode());
     }
 
-    /**
-     * @expectedException BadMethodCallException
-     */
     public function testCallingFromContainerNotCallable()
     {
+        $this->expectException('BadMethodCallException');
         $settings = [
             'foo' => function ($c) {
                 return null;
@@ -2201,20 +2536,16 @@ class AppTest extends PHPUnit\Framework\TestCase
         $app->foo('bar');
     }
 
-    /**
-     * @expectedException BadMethodCallException
-     */
     public function testCallingAnUnknownContainerCallableThrows()
     {
+        $this->expectException('BadMethodCallException');
         $app = new App();
         $app->foo('bar');
     }
 
-    /**
-     * @expectedException BadMethodCallException
-     */
     public function testCallingAnUncallableContainerKeyThrows()
     {
+        $this->expectException('BadMethodCallException');
         $app = new App();
         $app->getContainer()['bar'] = 'foo';
         $app->foo('bar');
@@ -2236,12 +2567,10 @@ class AppTest extends PHPUnit\Framework\TestCase
         $this->assertFalse($response->hasHeader('Content-Length'));
     }
 
-    /**
-     * @expectedException RuntimeException
-     * @expectedExceptionMessage Unexpected data in output buffer
-     */
     public function testForUnexpectedDataInOutputBuffer()
     {
+        $this->expectException('RuntimeException');
+	$this->expectExceptionMessage('Unexpected data in output buffer');
         $this->expectOutputString('test'); // needed to avoid risky test warning
         echo "test";
         $method = new ReflectionMethod('Slim\App', 'finalize');
diff --git a/tests/ContainerTest.php b/tests/ContainerTest.php
index a4e3b6d..bfadb57 100644
--- a/tests/ContainerTest.php
+++ b/tests/ContainerTest.php
@@ -29,22 +29,19 @@ class ContainerTest extends PHPUnit\Framework\TestCase
         $this->assertInstanceOf('\Slim\Http\Environment', $this->container->get('environment'));
     }
 
-    /**
-     * @expectedException \Slim\Exception\ContainerValueNotFoundException
-     */
     public function testGetWithValueNotFoundError()
     {
+        $this->expectException('\Slim\Exception\ContainerValueNotFoundException');
         $this->container->get('foo');
     }
 
     /**
      * Test `get()` throws something that is a ContainerException - typically a NotFoundException, when there is a DI
      * config error
-     *
-     * @expectedException \Slim\Exception\ContainerValueNotFoundException
      */
     public function testGetWithDiConfigErrorThrownAsContainerValueNotFoundException()
     {
+        $this->expectException('\Slim\Exception\ContainerValueNotFoundException');
         $container = new Container;
         $container['foo'] =
             function (ContainerInterface $container) {
@@ -57,11 +54,10 @@ class ContainerTest extends PHPUnit\Framework\TestCase
     /**
      * Test `get()` recasts InvalidArgumentException as psr/container exceptions when an error is present
      * in the DI config
-     *
-     * @expectedException \Slim\Exception\ContainerException
      */
     public function testGetWithDiConfigErrorThrownAsInvalidArgumentException()
     {
+        $this->expectException('\Slim\Exception\ContainerException');
         $container = new Container;
         $container['foo'] =
             function (ContainerInterface $container) {
@@ -73,11 +69,10 @@ class ContainerTest extends PHPUnit\Framework\TestCase
 
     /**
      * Test `get()` does not recast exceptions which are thrown in a factory closure
-     *
-     * @expectedException InvalidArgumentException
      */
     public function testGetWithErrorThrownByFactoryClosure()
     {
+        $this->expectException('InvalidArgumentException');
         $invokable = $this->getMockBuilder('StdClass')->setMethods(['__invoke'])->getMock();
         /** @var callable $invokable */
         $invokable->expects($this->any())
diff --git a/tests/Handlers/ErrorTest.php b/tests/Handlers/ErrorTest.php
index 747c8bc..055a5f1 100644
--- a/tests/Handlers/ErrorTest.php
+++ b/tests/Handlers/ErrorTest.php
@@ -67,11 +67,9 @@ class ErrorTest extends PHPUnit\Framework\TestCase
         $this->assertEquals(0, strpos((string)$res->getBody(), $startOfBody));
     }
 
-    /**
-     * @expectedException UnexpectedValueException
-     */
     public function testNotFoundContentType()
     {
+        $this->expectException('UnexpectedValueException');
         $errorMock = $this->getMockBuilder(Error::class)->setMethods(['determineContentType'])->getMock();
         $errorMock->method('determineContentType')
             ->will($this->returnValue('unknown/type'));
diff --git a/tests/Handlers/PhpErrorTest.php b/tests/Handlers/PhpErrorTest.php
index 405b88b..768e5ed 100644
--- a/tests/Handlers/PhpErrorTest.php
+++ b/tests/Handlers/PhpErrorTest.php
@@ -142,10 +142,10 @@ class PhpErrorTest extends PHPUnit\Framework\TestCase
 
     /**
      * @requires PHP 5.0
-     * @expectedException UnexpectedValueException
      */
     public function testNotFoundContentType5()
     {
+        $this->expectException('UnexpectedValueException');
         $this->skipIfPhp70();
         $errorMock = $this->getMock(PhpError::class, ['determineContentType']);
         $errorMock->method('determineContentType')
diff --git a/tests/Http/BodyTest.php b/tests/Http/BodyTest.php
index 8dbe09d..ad91a92 100644
--- a/tests/Http/BodyTest.php
+++ b/tests/Http/BodyTest.php
@@ -9,6 +9,7 @@ namespace Slim\Tests\Http;
 
 use InvalidArgumentException;
 use PHPUnit;
+use ReflectionObject;
 use ReflectionProperty;
 use Slim\Http\Body;
 
@@ -60,11 +61,9 @@ class BodyTest extends PHPUnit\Framework\TestCase
         $this->assertSame($this->stream, $bodyStream->getValue($body));
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testConstructorInvalidStream()
     {
+        $this->expectException('InvalidArgumentException');
         $this->stream = 'foo';
         $body = new Body($this->stream);
     }
@@ -74,7 +73,7 @@ class BodyTest extends PHPUnit\Framework\TestCase
         $this->stream = $this->resourceFactory();
         $body = new Body($this->stream);
 
-        $this->assertInternalType('array', $body->getMetadata());
+        $this->assertIsArray($body->getMetadata());
     }
 
     public function testGetMetadataKey()
@@ -158,7 +157,13 @@ class BodyTest extends PHPUnit\Framework\TestCase
         $body = new Body($this->stream);
         $body->close();
 
-        $this->assertAttributeEquals(null, 'stream', $body);
+        $reflector = new ReflectionObject($body);
+        $attribute = $reflector->getProperty('stream');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($body);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(null, $value);
         //$this->assertFalse($body->isAttached()); #1269
     }
 
diff --git a/tests/Http/HeadersTest.php b/tests/Http/HeadersTest.php
index 3c664e4..38952d3 100644
--- a/tests/Http/HeadersTest.php
+++ b/tests/Http/HeadersTest.php
@@ -23,7 +23,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['accept']);
+        $this->assertIsArray($prop->getValue($h)['accept']);
         $this->assertEquals('application/json', $prop->getValue($h)['accept']['value'][0]);
     }
 
@@ -36,7 +36,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['content-type']);
+        $this->assertIsArray($prop->getValue($h)['content-type']);
         $this->assertEquals('application/json', $prop->getValue($h)['content-type']['value'][0]);
     }
 
@@ -61,7 +61,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['content-length']);
+        $this->assertIsArray($prop->getValue($h)['content-length']);
         $this->assertEquals(100, $prop->getValue($h)['content-length']['value'][0]);
     }
 
@@ -72,7 +72,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['content-length']);
+        $this->assertIsArray($prop->getValue($h)['content-length']);
         $this->assertEquals(100, $prop->getValue($h)['content-length']['value'][0]);
     }
 
@@ -83,7 +83,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['allow']);
+        $this->assertIsArray($prop->getValue($h)['allow']);
         $this->assertEquals(['GET', 'POST'], $prop->getValue($h)['allow']['value']);
     }
 
@@ -129,7 +129,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['foo']);
+        $this->assertIsArray($prop->getValue($h)['foo']);
         $this->assertEquals(['Bar'], $prop->getValue($h)['foo']['value']);
     }
 
@@ -141,7 +141,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['foo']);
+        $this->assertIsArray($prop->getValue($h)['foo']);
         $this->assertEquals(['Bar', 'Xyz'], $prop->getValue($h)['foo']['value']);
     }
 
@@ -153,7 +153,7 @@ class HeadersTest extends PHPUnit\Framework\TestCase
         $prop = new ReflectionProperty($h, 'data');
         $prop->setAccessible(true);
 
-        $this->assertInternalType('array', $prop->getValue($h)['foo']);
+        $this->assertIsArray($prop->getValue($h)['foo']);
         $this->assertEquals(['Bar', 'Xyz', '123'], $prop->getValue($h)['foo']['value']);
     }
 
diff --git a/tests/Http/MessageTest.php b/tests/Http/MessageTest.php
index ef73a5f..6245e3f 100644
--- a/tests/Http/MessageTest.php
+++ b/tests/Http/MessageTest.php
@@ -32,11 +32,9 @@ class MessageTest extends PHPUnit\Framework\TestCase
         $this->assertEquals('1.0', $clone->protocolVersion);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithProtocolVersionInvalidThrowsException()
     {
+        $this->expectException('InvalidArgumentException');
         $message = new MessageStub();
         $message->withProtocolVersion('3.0');
     }
diff --git a/tests/Http/RequestBodyTest.php b/tests/Http/RequestBodyTest.php
index 480f7d2..69c23ab 100644
--- a/tests/Http/RequestBodyTest.php
+++ b/tests/Http/RequestBodyTest.php
@@ -8,6 +8,7 @@
 namespace Slim\Tests\Http;
 
 use PHPUnit;
+use ReflectionObject;
 use ReflectionProperty;
 use Slim\Http\RequestBody;
 
@@ -64,7 +65,7 @@ class RequestBodyTest extends PHPUnit\Framework\TestCase
         $bodyStream = new ReflectionProperty($this->body, 'stream');
         $bodyStream->setAccessible(true);
 
-        $this->assertInternalType('resource', $bodyStream->getValue($this->body));
+        $this->assertIsResource($bodyStream->getValue($this->body));
     }
 
     public function testConstructorSetsMetadata()
@@ -72,12 +73,12 @@ class RequestBodyTest extends PHPUnit\Framework\TestCase
         $bodyMetadata = new ReflectionProperty($this->body, 'meta');
         $bodyMetadata->setAccessible(true);
 
-        $this->assertInternalType('array', $bodyMetadata->getValue($this->body));
+        $this->assertIsArray($bodyMetadata->getValue($this->body));
     }
 
     public function testGetMetadata()
     {
-        $this->assertInternalType('array', $this->body->getMetadata());
+        $this->assertIsArray($this->body->getMetadata());
     }
 
     public function testGetMetadataKey()
@@ -109,7 +110,7 @@ class RequestBodyTest extends PHPUnit\Framework\TestCase
 
         $result = $this->body->detach();
 
-        $this->assertInternalType('resource', $result);
+        $this->assertIsResource($result);
         $this->assertNull($bodyStream->getValue($this->body));
         $this->assertNull($bodyMetadata->getValue($this->body));
         $this->assertNull($bodyReadable->getValue($this->body));
@@ -142,7 +143,13 @@ class RequestBodyTest extends PHPUnit\Framework\TestCase
     {
         $this->body->close();
 
-        $this->assertAttributeEquals(null, 'stream', $this->body);
+        $reflector = new ReflectionObject($this->body);
+        $attribute = $reflector->getProperty('stream');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($this->body);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(null, $value);
         $this->assertFalse($this->body->isReadable());
         $this->assertFalse($this->body->isWritable());
         $this->assertEquals('', (string)$this->body);
diff --git a/tests/Http/RequestTest.php b/tests/Http/RequestTest.php
index e19ac41..72f9175 100644
--- a/tests/Http/RequestTest.php
+++ b/tests/Http/RequestTest.php
@@ -12,6 +12,7 @@ use PHPUnit;
 use Prophecy\Argument;
 use Prophecy\Prophecy\MethodProphecy;
 use Psr\Http\Message\UriInterface;
+use ReflectionObject;
 use ReflectionProperty;
 use RuntimeException;
 use Slim\Collection;
@@ -141,23 +142,45 @@ class RequestTest extends PHPUnit\Framework\TestCase
     {
         $request = $this->requestFactory()->withMethod('PUT');
 
-        $this->assertAttributeEquals('PUT', 'method', $request);
-        $this->assertAttributeEquals('PUT', 'originalMethod', $request);
+        $reflector = new ReflectionObject($request);
+        $attribute = $reflector->getProperty('method');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($request);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('PUT', $value);
+        $reflector = new ReflectionObject($request);
+        $attribute = $reflector->getProperty('originalMethod');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($request);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('PUT', $value);
     }
 
     public function testWithAllAllowedCharactersMethod()
     {
         $request = $this->requestFactory()->withMethod("!#$%&'*+.^_`|~09AZ-");
 
-        $this->assertAttributeEquals("!#$%&'*+.^_`|~09AZ-", 'method', $request);
-        $this->assertAttributeEquals("!#$%&'*+.^_`|~09AZ-", 'originalMethod', $request);
+        $reflector = new ReflectionObject($request);
+        $attribute = $reflector->getProperty('method');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($request);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals("!#$%&'*+.^_`|~09AZ-", $value);
+        $reflector = new ReflectionObject($request);
+        $attribute = $reflector->getProperty('originalMethod');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($request);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals("!#$%&'*+.^_`|~09AZ-", $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithMethodInvalid()
     {
+        $this->expectException('InvalidArgumentException');
         $this->requestFactory()->withMethod('B@R');
     }
 
@@ -165,7 +188,13 @@ class RequestTest extends PHPUnit\Framework\TestCase
     {
         $request = $this->requestFactory()->withMethod(null);
 
-        $this->assertAttributeEquals(null, 'originalMethod', $request);
+        $reflector = new ReflectionObject($request);
+        $attribute = $reflector->getProperty('originalMethod');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($request);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(null, $value);
     }
 
     public function testCreateFromEnvironment()
@@ -288,11 +317,9 @@ class RequestTest extends PHPUnit\Framework\TestCase
         $this->assertEquals('PUT', $request->getMethod());
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testCreateRequestWithInvalidMethodString()
     {
+        $this->expectException('InvalidArgumentException');
         $uri = Uri::createFromString('https://example.com:443/foo/bar?abc=123');
         $headers = new Headers();
         $cookies = [];
@@ -301,11 +328,9 @@ class RequestTest extends PHPUnit\Framework\TestCase
         $request = new Request('B@R', $uri, $headers, $cookies, $serverParams, $body);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testCreateRequestWithInvalidMethodOther()
     {
+        $this->expectException('InvalidArgumentException');
         $uri = Uri::createFromString('https://example.com:443/foo/bar?abc=123');
         $headers = new Headers();
         $cookies = [];
@@ -463,14 +488,18 @@ class RequestTest extends PHPUnit\Framework\TestCase
     {
         $clone = $this->requestFactory()->withRequestTarget('/test?user=1');
 
-        $this->assertAttributeEquals('/test?user=1', 'requestTarget', $clone);
+        $reflector = new ReflectionObject($clone);
+        $attribute = $reflector->getProperty('requestTarget');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($clone);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/test?user=1', $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithRequestTargetThatHasSpaces()
     {
+        $this->expectException('InvalidArgumentException');
         $this->requestFactory()->withRequestTarget('/test/m ore/stuff?user=1');
     }
 
@@ -500,7 +529,13 @@ class RequestTest extends PHPUnit\Framework\TestCase
         $request = new Request('GET', $uri1, $headers, $cookies, $serverParams, $body);
         $clone = $request->withUri($uri2);
 
-        $this->assertAttributeSame($uri2, 'uri', $clone);
+        $reflector = new ReflectionObject($clone);
+        $attribute = $reflector->getProperty('uri');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($clone);
+        $attribute->setAccessible(false);
+
+        $this->assertSame($uri2, $value);
     }
 
     public function testWithUriPreservesHost()
@@ -1065,11 +1100,9 @@ class RequestTest extends PHPUnit\Framework\TestCase
         $this->assertEquals(['abc' => '123'], $request->getParsedBody());
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testGetParsedBodyAsArray()
     {
+        $this->expectException('RuntimeException');
         $uri = Uri::createFromString('https://example.com:443/foo/bar?abc=123');
         $headers = new Headers([
             'Content-Type' => 'application/json;charset=utf8',
@@ -1147,19 +1180,15 @@ class RequestTest extends PHPUnit\Framework\TestCase
         $this->assertNull($request->getParsedBody());
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithParsedBodyInvalid()
     {
+        $this->expectException('InvalidArgumentException');
         $this->requestFactory()->withParsedBody(2);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithParsedBodyInvalidFalseValue()
     {
+        $this->expectException('InvalidArgumentException');
         $this->requestFactory()->withParsedBody(false);
     }
 
diff --git a/tests/Http/ResponseTest.php b/tests/Http/ResponseTest.php
index 5e456aa..65a18ba 100755
--- a/tests/Http/ResponseTest.php
+++ b/tests/Http/ResponseTest.php
@@ -9,6 +9,7 @@ namespace Slim\Tests\Http;
 
 use InvalidArgumentException;
 use PHPUnit;
+use ReflectionObject;
 use ReflectionProperty;
 use RuntimeException;
 use Slim\Http\Body;
@@ -21,9 +22,27 @@ class ResponseTest extends PHPUnit\Framework\TestCase
     {
         $response = new Response();
 
-        $this->assertAttributeEquals(200, 'status', $response);
-        $this->assertAttributeInstanceOf('\Slim\Http\Headers', 'headers', $response);
-        $this->assertAttributeInstanceOf('\Psr\Http\Message\StreamInterface', 'body', $response);
+        $reflector = new ReflectionObject($response);
+        $attribute = $reflector->getProperty('status');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($response);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(200, $value);
+        $reflector = new ReflectionObject($response);
+        $attribute = $reflector->getProperty('headers');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($response);
+        $attribute->setAccessible(false);
+
+        $this->assertInstanceOf('\Slim\Http\Headers', $value);
+        $reflector = new ReflectionObject($response);
+        $attribute = $reflector->getProperty('body');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($response);
+        $attribute->setAccessible(false);
+
+        $this->assertInstanceOf('\Psr\Http\Message\StreamInterface', $value);
     }
 
     public function testConstructorWithCustomArgs()
@@ -32,9 +51,27 @@ class ResponseTest extends PHPUnit\Framework\TestCase
         $body = new Body(fopen('php://temp', 'r+'));
         $response = new Response(404, $headers, $body);
 
-        $this->assertAttributeEquals(404, 'status', $response);
-        $this->assertAttributeSame($headers, 'headers', $response);
-        $this->assertAttributeSame($body, 'body', $response);
+        $reflector = new ReflectionObject($response);
+        $attribute = $reflector->getProperty('status');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($response);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(404, $value);
+        $reflector = new ReflectionObject($response);
+        $attribute = $reflector->getProperty('headers');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($response);
+        $attribute->setAccessible(false);
+
+        $this->assertSame($headers, $value);
+        $reflector = new ReflectionObject($response);
+        $attribute = $reflector->getProperty('body');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($response);
+        $attribute->setAccessible(false);
+
+        $this->assertSame($body, $value);
     }
 
     public function testDeepCopyClone()
@@ -44,10 +81,34 @@ class ResponseTest extends PHPUnit\Framework\TestCase
         $response = new Response(404, $headers, $body);
         $clone = clone $response;
 
-        $this->assertAttributeEquals('1.1', 'protocolVersion', $clone);
-        $this->assertAttributeEquals(404, 'status', $clone);
-        $this->assertAttributeNotSame($headers, 'headers', $clone);
-        $this->assertAttributeSame($body, 'body', $clone);
+        $reflector = new ReflectionObject($clone);
+        $attribute = $reflector->getProperty('protocolVersion');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($clone);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('1.1', $value);
+        $reflector = new ReflectionObject($clone);
+        $attribute = $reflector->getProperty('status');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($clone);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(404, $value);
+        $reflector = new ReflectionObject($clone);
+        $attribute = $reflector->getProperty('headers');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($clone);
+        $attribute->setAccessible(false);
+
+        $this->assertNotSame($headers, $value);
+        $reflector = new ReflectionObject($clone);
+        $attribute = $reflector->getProperty('body');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($clone);
+        $attribute->setAccessible(false);
+
+        $this->assertSame($body, $value);
     }
 
     public function testDisableSetter()
@@ -73,24 +134,26 @@ class ResponseTest extends PHPUnit\Framework\TestCase
         $response = new Response();
         $clone = $response->withStatus(302);
 
-        $this->assertAttributeEquals(302, 'status', $clone);
+        $reflector = new ReflectionObject($clone);
+        $attribute = $reflector->getProperty('status');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($clone);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(302, $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithStatusInvalidStatusCodeThrowsException()
     {
+        $this->expectException('InvalidArgumentException');
         $response = new Response();
         $response->withStatus(800);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage ReasonPhrase must be a string
-     */
     public function testWithStatusInvalidReasonPhraseThrowsException()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('ReasonPhrase must be a string');
         $response = new Response();
         $response->withStatus(200, null);
     }
@@ -109,12 +172,10 @@ class ResponseTest extends PHPUnit\Framework\TestCase
         $this->assertEquals('Not Found', $response->getReasonPhrase());
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage ReasonPhrase must be supplied for this code
-     */
     public function testMustSetReasonPhraseForUnrecognisedCode()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('ReasonPhrase must be supplied for this code');
         $response = new Response();
         $response = $response->withStatus(199);
     }
@@ -319,11 +380,9 @@ class ResponseTest extends PHPUnit\Framework\TestCase
         $this->assertEquals($response->getStatusCode(), 201);
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testWithInvalidJsonThrowsException()
     {
+        $this->expectException('RuntimeException');
         $data = ['foo' => 'bar'.chr(233)];
         $this->assertEquals('bar'.chr(233), $data['foo']);
 
diff --git a/tests/Http/StreamTest.php b/tests/Http/StreamTest.php
index 6d0f030..1dcba6e 100644
--- a/tests/Http/StreamTest.php
+++ b/tests/Http/StreamTest.php
@@ -58,31 +58,25 @@ class StreamTest extends PHPUnit\Framework\TestCase
         $this->assertFalse($this->pipeStream->isSeekable());
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testCannotSeekPipe()
     {
+        $this->expectException('RuntimeException');
         $this->openPipeStream();
 
         $this->pipeStream->seek(0);
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testCannotTellPipe()
     {
+        $this->expectException('RuntimeException');
         $this->openPipeStream();
 
         $this->pipeStream->tell();
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testCannotRewindPipe()
     {
+        $this->expectException('RuntimeException');
         $this->openPipeStream();
 
         $this->pipeStream->rewind();
diff --git a/tests/Http/UploadedFilesTest.php b/tests/Http/UploadedFilesTest.php
index 7869335..443109d 100644
--- a/tests/Http/UploadedFilesTest.php
+++ b/tests/Http/UploadedFilesTest.php
@@ -175,11 +175,10 @@ class UploadedFilesTest extends PHPUnit\Framework\TestCase
      * @depends testMoveTo
      *
      * @param UploadedFile $uploadedFile
-     *
-     * @expectedException RuntimeException
      */
     public function testMoveToCannotBeDoneTwice(UploadedFile $uploadedFile)
     {
+        $this->expectException('RuntimeException');
         $tempName = uniqid('file-');
         $path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $tempName;
         $uploadedFile->moveTo($path);
diff --git a/tests/Http/UriTest.php b/tests/Http/UriTest.php
index 9198f3b..a5e7e35 100644
--- a/tests/Http/UriTest.php
+++ b/tests/Http/UriTest.php
@@ -9,6 +9,7 @@ namespace Slim\Tests\Http;
 
 use InvalidArgumentException;
 use PHPUnit;
+use ReflectionObject;
 use Slim\Http\Environment;
 use Slim\Http\Uri;
 
@@ -39,38 +40,52 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withScheme('http');
 
-        $this->assertAttributeEquals('http', 'scheme', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('scheme');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('http', $value);
     }
 
     public function testWithSchemeRemovesSuffix()
     {
         $uri = $this->uriFactory()->withScheme('http://');
 
-        $this->assertAttributeEquals('http', 'scheme', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('scheme');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('http', $value);
     }
 
     public function testWithSchemeEmpty()
     {
         $uri = $this->uriFactory()->withScheme('');
 
-        $this->assertAttributeEquals('', 'scheme', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('scheme');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Uri scheme must be one of: "", "https", "http"
-     */
     public function testWithSchemeInvalid()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Uri scheme must be one of: "", "https", "http"');
         $this->uriFactory()->withScheme('ftp');
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Uri scheme must be a string
-     */
     public function testWithSchemeInvalidType()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Uri scheme must be a string');
         $this->uriFactory()->withScheme([]);
     }
 
@@ -180,24 +195,60 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withUserInfo('bob', 'pass');
 
-        $this->assertAttributeEquals('bob', 'user', $uri);
-        $this->assertAttributeEquals('pass', 'password', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('user');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('bob', $value);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('password');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('pass', $value);
     }
 
     public function testWithUserInfoEncodesCorrectly()
     {
         $uri = $this->uriFactory()->withUserInfo('bob@example.com', 'pass:word');
 
-        $this->assertAttributeEquals('bob%40example.com', 'user', $uri);
-        $this->assertAttributeEquals('pass%3Aword', 'password', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('user');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('bob%40example.com', $value);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('password');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('pass%3Aword', $value);
     }
 
     public function testWithUserInfoRemovesPassword()
     {
         $uri = $this->uriFactory()->withUserInfo('bob');
 
-        $this->assertAttributeEquals('bob', 'user', $uri);
-        $this->assertAttributeEquals('', 'password', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('user');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('bob', $value);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('password');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
     public function testWithUserInfoRemovesInfo()
@@ -205,8 +256,20 @@ class UriTest extends PHPUnit\Framework\TestCase
         $uri = $this->uriFactory()->withUserInfo('bob', 'password');
 
         $uri = $uri->withUserInfo('');
-        $this->assertAttributeEquals('', 'user', $uri);
-        $this->assertAttributeEquals('', 'password', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('user');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('password');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
 
@@ -219,7 +282,13 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withHost('slimframework.com');
 
-        $this->assertAttributeEquals('slimframework.com', 'host', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('host');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('slimframework.com', $value);
     }
 
     public function testGetPortWithSchemeAndNonDefaultPort()
@@ -256,29 +325,37 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withPort(8000);
 
-        $this->assertAttributeEquals(8000, 'port', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('port');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(8000, $value);
     }
 
     public function testWithPortNull()
     {
         $uri = $this->uriFactory()->withPort(null);
 
-        $this->assertAttributeEquals(null, 'port', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('port');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals(null, $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithPortInvalidInt()
     {
+        $this->expectException('InvalidArgumentException');
         $this->uriFactory()->withPort(70000);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testWithPortInvalidString()
     {
+        $this->expectException('InvalidArgumentException');
         $this->uriFactory()->withPort('Foo');
     }
 
@@ -291,15 +368,19 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withBasePath('/base');
 
-        $this->assertAttributeEquals('/base', 'basePath', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('basePath');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/base', $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Uri path must be a string
-     */
     public function testWithBasePathInvalidType()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Uri path must be a string');
         $this->uriFactory()->withBasePath(['foo']);
     }
 
@@ -307,14 +388,26 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withBasePath('base');
 
-        $this->assertAttributeEquals('/base', 'basePath', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('basePath');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/base', $value);
     }
 
     public function testWithBasePathIgnoresSlash()
     {
         $uri = $this->uriFactory()->withBasePath('/');
 
-        $this->assertAttributeEquals('', 'basePath', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('basePath');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
     public function testGetPath()
@@ -326,43 +419,71 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withPath('/new');
 
-        $this->assertAttributeEquals('/new', 'path', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('path');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/new', $value);
     }
 
     public function testWithPathWithoutPrefix()
     {
         $uri = $this->uriFactory()->withPath('new');
 
-        $this->assertAttributeEquals('new', 'path', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('path');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('new', $value);
     }
 
     public function testWithPathEmptyValue()
     {
         $uri = $this->uriFactory()->withPath('');
 
-        $this->assertAttributeEquals('', 'path', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('path');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
     public function testWithPathUrlEncodesInput()
     {
         $uri = $this->uriFactory()->withPath('/includes?/new');
 
-        $this->assertAttributeEquals('/includes%3F/new', 'path', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('path');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/includes%3F/new', $value);
     }
 
     public function testWithPathDoesNotDoubleEncodeInput()
     {
         $uri = $this->uriFactory()->withPath('/include%25s/new');
 
-        $this->assertAttributeEquals('/include%25s/new', 'path', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('path');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/include%25s/new', $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Uri path must be a string
-     */
     public function testWithPathInvalidType()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Uri path must be a string');
         $this->uriFactory()->withPath(['foo']);
     }
 
@@ -375,36 +496,58 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withQuery('xyz=123');
 
-        $this->assertAttributeEquals('xyz=123', 'query', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('query');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('xyz=123', $value);
     }
 
     public function testWithQueryRemovesPrefix()
     {
         $uri = $this->uriFactory()->withQuery('?xyz=123');
 
-        $this->assertAttributeEquals('xyz=123', 'query', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('query');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('xyz=123', $value);
     }
 
     public function testWithQueryEmpty()
     {
         $uri = $this->uriFactory()->withQuery('');
 
-        $this->assertAttributeEquals('', 'query', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('query');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
     public function testFilterQuery()
     {
         $uri = $this->uriFactory()->withQuery('?foobar=%match');
 
-        $this->assertAttributeEquals('foobar=%25match', 'query', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('query');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('foobar=%25match', $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Uri query must be a string
-     */
     public function testWithQueryInvalidType()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Uri query must be a string');
         $this->uriFactory()->withQuery(['foo']);
     }
 
@@ -417,29 +560,45 @@ class UriTest extends PHPUnit\Framework\TestCase
     {
         $uri = $this->uriFactory()->withFragment('other-fragment');
 
-        $this->assertAttributeEquals('other-fragment', 'fragment', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('fragment');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('other-fragment', $value);
     }
 
     public function testWithFragmentRemovesPrefix()
     {
         $uri = $this->uriFactory()->withFragment('#other-fragment');
 
-        $this->assertAttributeEquals('other-fragment', 'fragment', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('fragment');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('other-fragment', $value);
     }
 
     public function testWithFragmentEmpty()
     {
         $uri = $this->uriFactory()->withFragment('');
 
-        $this->assertAttributeEquals('', 'fragment', $uri);
+        $reflector = new ReflectionObject($uri);
+        $attribute = $reflector->getProperty('fragment');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($uri);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('', $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Uri fragment must be a string
-     */
     public function testWithFragmentInvalidType()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Uri fragment must be a string');
         $this->uriFactory()->withFragment(['foo']);
     }
 
@@ -480,12 +639,10 @@ class UriTest extends PHPUnit\Framework\TestCase
         $this->assertEquals('abc=123', $uri->getQuery());
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Uri must be a string
-     */
     public function testCreateFromStringWithInvalidType()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Uri must be a string');
         Uri::createFromString(['https://example.com:8080/foo/bar?abc=123']);
     }
 
diff --git a/tests/MiddlewareAwareTest.php b/tests/MiddlewareAwareTest.php
index 70721ce..c034c8d 100644
--- a/tests/MiddlewareAwareTest.php
+++ b/tests/MiddlewareAwareTest.php
@@ -101,11 +101,9 @@ class MiddlewareAwareTest extends PHPUnit\Framework\TestCase
         $this->assertEquals('In2In1CenterOut1Out2', (string)$res->getBody());
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testMiddlewareBadReturnValue()
     {
+        $this->expectException('RuntimeException');
         // Build middleware stack
         $stack = new Stackable;
         $stack->add(function ($req, $res, $next) {
diff --git a/tests/RouteTest.php b/tests/RouteTest.php
index c894b2a..bda29d6 100644
--- a/tests/RouteTest.php
+++ b/tests/RouteTest.php
@@ -9,6 +9,7 @@ namespace Slim\Tests;
 
 use Exception;
 use PHPUnit;
+use ReflectionObject;
 use Slim\Container;
 use Slim\DeferredCallable;
 use Slim\Http\Body;
@@ -44,9 +45,27 @@ class RouteTest extends PHPUnit\Framework\TestCase
         };
         $route = new Route($methods, $pattern, $callable);
 
-        $this->assertAttributeEquals($methods, 'methods', $route);
-        $this->assertAttributeEquals($pattern, 'pattern', $route);
-        $this->assertAttributeEquals($callable, 'callable', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('methods');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals($methods, $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals($pattern, $value);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('callable');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals($callable, $value);
     }
 
     public function testGetMethodsReturnsArrayWhenContructedWithString()
@@ -72,7 +91,7 @@ class RouteTest extends PHPUnit\Framework\TestCase
     {
         $callable = $this->routeFactory()->getCallable();
 
-        $this->assertInternalType('callable', $callable);
+        $this->assertIsCallable($callable);
     }
 
     public function testArgumentSetting()
@@ -298,11 +317,9 @@ class RouteTest extends PHPUnit\Framework\TestCase
         $this->assertEquals('foo', (string)$response->getBody());
     }
 
-    /**
-     * @expectedException Exception
-     */
     public function testInvokeWithException()
     {
+        $this->expectException('Exception');
         $callable = function ($req, $res, $args) {
             throw new Exception();
         };
diff --git a/tests/RouterTest.php b/tests/RouterTest.php
index 8234166..6dcd196 100644
--- a/tests/RouterTest.php
+++ b/tests/RouterTest.php
@@ -10,6 +10,7 @@ namespace Slim\Tests;
 use InvalidArgumentException;
 use PHPUnit;
 use ReflectionClass;
+use ReflectionObject;
 use RuntimeException;
 use Slim\Http\Uri;
 use Slim\Router;
@@ -48,7 +49,13 @@ class RouterTest extends PHPUnit\Framework\TestCase
         $route = $this->router->map($methods, $pattern, $callable);
 
         $this->assertInstanceOf('\Slim\Interfaces\RouteInterface', $route);
-        $this->assertAttributeContains($route, 'routes', $this->router);
+        $reflector = new ReflectionObject($this->router);
+        $attribute = $reflector->getProperty('routes');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($this->router);
+        $attribute->setAccessible(false);
+
+        $this->assertContains($route, $value);
     }
 
     public function testMapPrependsGroupPattern()
@@ -64,15 +71,19 @@ class RouterTest extends PHPUnit\Framework\TestCase
         $route = $this->router->map($methods, $pattern, $callable);
         $this->router->popGroup();
 
-        $this->assertAttributeEquals('/prefix/hello/{first}/{last}', 'pattern', $route);
+        $reflector = new ReflectionObject($route);
+        $attribute = $reflector->getProperty('pattern');
+        $attribute->setAccessible(true);
+        $value = $attribute->getValue($route);
+        $attribute->setAccessible(false);
+
+        $this->assertEquals('/prefix/hello/{first}/{last}', $value);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     * @expectedExceptionMessage Route pattern must be a string
-     */
     public function testMapWithInvalidPatternType()
     {
+        $this->expectException('InvalidArgumentException');
+        $this->expectExceptionMessage('Route pattern must be a string');
         $methods = ['GET'];
         $pattern = ['foo'];
         $callable = function ($request, $response, $args) {
@@ -196,11 +207,9 @@ class RouterTest extends PHPUnit\Framework\TestCase
         );
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testPathForWithMissingSegmentData()
     {
+        $this->expectException('InvalidArgumentException');
         $methods = ['GET'];
         $pattern = '/hello/{first}/{last}';
         $callable = function ($request, $response, $args) {
@@ -212,11 +221,9 @@ class RouterTest extends PHPUnit\Framework\TestCase
         $this->router->pathFor('foo', ['last' => 'lockhart']);
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testPathForRouteNotExists()
     {
+        $this->expectException('RuntimeException');
         $methods = ['GET'];
         $pattern = '/hello/{first}/{last}';
         $callable = function ($request, $response, $args) {
@@ -228,11 +235,9 @@ class RouterTest extends PHPUnit\Framework\TestCase
         $this->router->pathFor('bar', ['first' => 'josh', 'last' => 'lockhart']);
     }
 
-    /**
-     * @expectedException InvalidArgumentException
-     */
     public function testSettingInvalidBasePath()
     {
+        $this->expectException('InvalidArgumentException');
         $this->router->setBasePath(['invalid']);
     }
 
@@ -256,11 +261,9 @@ class RouterTest extends PHPUnit\Framework\TestCase
         $this->assertInstanceOf('\FastRoute\Dispatcher', $prop->getValue($this->router));
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testRemoveRoute()
     {
+        $this->expectException('RuntimeException');
         $methods = ['GET'];
         $callable = function ($request, $response, $args) {
             echo sprintf('Hello ignore me');
@@ -312,11 +315,9 @@ class RouterTest extends PHPUnit\Framework\TestCase
         $this->router->getNamedRoute($routeToRemove->getName());
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testRouteRemovalNotExists()
     {
+        $this->expectException('RuntimeException');
         $this->router->setBasePath('/base/path');
         $this->router->removeNamedRoute('non-existing-route-name');
     }
@@ -442,11 +443,9 @@ class RouterTest extends PHPUnit\Framework\TestCase
         $this->assertSame($dispatcher2, $dispatcher);
     }
 
-    /**
-     * @expectedException RuntimeException
-     */
     public function testLookupRouteThrowsExceptionIfRouteNotFound()
     {
+        $this->expectException('RuntimeException');
         $this->router->lookupRoute("thisIsMissing");
     }
 
