Skip to content

Commit c8f8501

Browse files
committed
Fixed #4
Changed setPluginsDir to addPluginsDir. Setting ‘pluginsDir’ was removing the default Smarty plugins directory.
1 parent 66f4d28 commit c8f8501

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Smarty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct($paths, $settings = [])
5555
}
5656

5757
if (isset($settings['pluginsDir'])) {
58-
$this->smarty->setPluginsDir($settings['pluginsDir']);
58+
$this->smarty->addPluginsDir($settings['pluginsDir']);
5959
}
6060
}
6161

tests/SmartyTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public function setUp()
1919
->getMock();
2020

2121
$this->view = new Smarty(dirname(__FILE__) . '/templates', [
22-
'compileDir' => dirname(__FILE__) . '/templates_c'
22+
'compileDir' => dirname(__FILE__) . '/templates_c',
23+
'pluginsDir' => './test'
2324
]);
2425

2526
$this->view->addSlimPlugins($mockRouter, 'base_url_test');
@@ -65,4 +66,9 @@ public function testPlugin()
6566

6667
$this->assertEquals("<p>Plugin return: base_url_test.</p>\n", $output);
6768
}
69+
70+
public function testPluginDirs()
71+
{
72+
$this->assertGreaterThanOrEqual(2, count($this->view->getSmarty()->getPluginsDir()));
73+
}
6874
}

0 commit comments

Comments
 (0)