diff --git a/tests/Http/RouteTest.php b/tests/Http/RouteTest.php index cf1e79e..acdd6f6 100644 --- a/tests/Http/RouteTest.php +++ b/tests/Http/RouteTest.php @@ -31,6 +31,16 @@ public static function getVariableRouteCache() return self::$_variable_route_cache; } + public static function setVariableRouteCache($arr) + { + self::$_variable_route_cache = $arr; + } + + public static function clearVariableRouteCache() + { + self::_clearVariableRouteCache(); + } + public static function getVariableReplacement() { return self::$_variable_replacement; @@ -622,6 +632,37 @@ public function testVariableCache() $this->assertEquals(8, $result); } + public function testClearVariableRouteCache() + { + // data not out of range + $route_cache = []; + + for ($i=0; $i < 65535; $i++) { + $route_cache[$i] = 1; + } + + RouteFake::setVariableRouteCache($route_cache); + RouteFake::clearVariableRouteCache(); + + $route_cache = RouteFake::getVariableRouteCache(); + + $this->assertEquals(65535, count($route_cache)); + + // data out of range + $route_cache = []; + + for ($i=0; $i < 65536; $i++) { + $route_cache[$i] = 1; + } + + RouteFake::setVariableRouteCache($route_cache); + RouteFake::clearVariableRouteCache(); + + $route_cache = RouteFake::getVariableRouteCache(); + + $this->assertEquals(0, count($route_cache)); + } + public function testGetRedirectUrl() { Config::set('app.base_url', 'http://test.com/');