Skip to content

Commit

Permalink
update test, add clearCache method test
Browse files Browse the repository at this point in the history
  • Loading branch information
wazsmwazsm committed Jul 22, 2018
1 parent 5c1c443 commit a818238
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/Http/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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/');
Expand Down

0 comments on commit a818238

Please sign in to comment.