1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-15 11:04:18 +02:00

Performance: Reduced e107::getFolder() usage from 2500+ to less than 30.

This commit is contained in:
Cameron
2020-12-21 06:41:45 -08:00
parent 539c3f1a67
commit 78665cd56d
2 changed files with 62 additions and 32 deletions

View File

@@ -505,10 +505,30 @@ while($row = $sql->fetch())
*/
public function testReplaceConstants()
{
$actual = $this->tp->replaceConstants('{e_BASE}news','abs');
$tests = array(
0 => array(
'path' => '{e_BASE}news',
'type' => 'abs',
'match' => e_HTTP,
),
1 => array(
'path' => '{e_BASE}news.php',
'type' => 'full',
'match' => 'https://localhost/e107/news.php',
),
2 => array(
'path' => '{e_PLUGIN}news/index.php',
'type' => null,
'match' => 'e107_plugins/news/index.php',
),
);
$this->assertStringContainsString(e_HTTP,$actual);
foreach($tests as $var)
{
$actual = $this->tp->replaceConstants($var['path'],$var['type']);
$this->assertStringContainsString($var['match'], $actual);
}
}
/*