forked from laruence/yaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
067.phpt
67 lines (62 loc) · 1.46 KB
/
067.phpt
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--TEST--
Check actions map with defined action class
--SKIPIF--
<?php if (!extension_loaded("yaf")) print "skip"; ?>
--INI--
yaf.use_spl_autoload=0
yaf.lowcase_path=0
yaf.use_namespace=0
--FILE--
<?php
require "build.inc";
startup();
$config = array(
"application" => array(
"directory" => APPLICATION_PATH,
),
);
file_put_contents(APPLICATION_PATH . "/controllers/Index.php", <<<PHP
<?php
class IndexController extends Yaf_Controller_Abstract {
public \$actions = array(
"sub" => "actions/sub.php",
);
public function indexAction() {
var_dump(\$this->forward('sub'));
}
}
PHP
);
file_put_contents(APPLICATION_PATH . "/actions/sub.php", <<<PHP
<?php
class SubAction extends Yaf_Action_Abstract {
public function execute() {
var_dump(\$this->getModuleName());
var_dump(\$this->getControllerName());
}
}
PHP
);
file_put_contents(APPLICATION_PATH . "/views/index/index.phtml", "indexAction" . PHP_EOL);
file_put_contents(APPLICATION_PATH . "/views/index/sub.phtml", "subAction" . PHP_EOL);
$app = new Yaf_Application($config);
$request = new Yaf_Request_Simple();
$app->getDispatcher()->dispatch($request);
$new_request = new Yaf_Request_Simple();
$new_request->setActionName('sub');
$app->getDispatcher()->dispatch($new_request);
?>
--CLEAN--
<?php
require "build.inc";
shutdown();
?>
--EXPECTF--
bool(true)
string(5) "Index"
string(5) "Index"
indexAction
subAction
string(5) "Index"
string(5) "Index"
subAction