/
test.php
49 lines (43 loc) · 1.03 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
PMVC\Load::plug();
PMVC\addPlugInFolders(['../']);
class View_config_helperTest extends PHPUnit_Framework_TestCase
{
private $_plug = 'view_config_helper';
function setup()
{
$view = \PMVC\plug('view_fake',array(
_CLASS=>'FakeTemplate'
));
PMVC\option('set',_VIEW_ENGINE,'fake');
}
function testPlugin()
{
ob_start();
print_r(PMVC\plug($this->_plug));
$output = ob_get_contents();
ob_end_clean();
$this->assertContains($this->_plug,$output);
}
function testCallback()
{
$p = \PMVC\plug($this->_plug, [
'callback'=>function(&$config){
$config['test'] = 'test';
}
]);
$p->onWillProcessHeader(new FakeSubject());
$view = \PMVC\plug('view');
$this->assertEquals($view->get('test'), 'test');
}
}
class FakeSubject
{
function detach()
{
}
}
class FakeTemplate extends \PMVC\PlugIn\view\ViewEngine
{
public function process() { }
}