Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows testing #16

Merged
merged 1 commit into from
Sep 22, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ try {

?>
--EXPECTF--
string(21) "Baidu:Sina:Wb:Inf:123"
string(21) "Baidu%cSina%cWb%cInf%c123"
bool(true)

Warning: Yaf_Loader::autoload(): Failed opening script %sBaidu%cName.php: No such file or directory in %s
Expand Down
16 changes: 10 additions & 6 deletions tests/028.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ Bug segfault while call exit in a view template
yaf.library="/php/global/dir"
--FILE--
<?php
require "build.inc";
startup();

$view = new Yaf_View_Simple(dirname(__FILE__));

$view->assign("name", "laruence");
$tpl = dirname(__FILE__) . '/foo.phtml';
function cleartpl() {
global $tpl;
@unlink($tpl);
}
register_shutdown_function("cleartpl");
$tpl = APPLICATION_PATH . '/tpls/foo.phtml';

file_put_contents($tpl, <<<HTML
okey
Expand All @@ -23,5 +21,11 @@ HTML
);
echo $view->render($tpl);
?>
--CLEAN--
<?php
/* unlink foo2.phtml permission denied */
require "build.inc";
shutdown();
?>
--EXPECTF--
okey
18 changes: 11 additions & 7 deletions tests/038.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ log_errors=0
display_errors=1
--FILE--
<?php
require "build.inc";
startup();

$view = new Yaf_View_Simple(dirname(__FILE__));

$view->assign("name", "laruence");
$tpl = dirname(__FILE__) . '/foo.phtml';
function cleartpl() {
global $tpl;
@unlink($tpl);
}
register_shutdown_function("cleartpl");
$tpl = APPLICATION_PATH . '/tpls/foo.phtml';

file_put_contents($tpl, <<<HTML
file_put_contents($tpl, <<<HTML
<?php
if ((x) { //syntax errors
}
Expand All @@ -28,5 +26,11 @@ HTML

echo $view->render($tpl);
?>
--CLEAN--
<?php
/* unlink foo2.phtml permission denied */
require "build.inc";
shutdown();
?>
--EXPECTF--
Parse error: syntax error, unexpected '{' in %sfoo.phtml on line %d
24 changes: 13 additions & 11 deletions tests/039.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,23 @@ log_errors=0
display_errors=1
--FILE--
<?php
$view = new Yaf_View_Simple(dirname(__FILE__));
require "build.inc";
startup();

$view = new Yaf_View_Simple(DIR_ROOT);
$view->assign("name", "laruence");
$tpl = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'foo.phtml';
$tpl2 = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'foo2.phtml';
function cleartpl() {
global $tpl, $tpl2;
unlink($tpl);
unlink($tpl2);
}
register_shutdown_function("cleartpl");
$tpl = APPLICATION_PATH . '/tpls/foo.phtml';
$tpl2 = APPLICATION_PATH . '/tpls/foo2.phtml';

file_put_contents($tpl, <<<HTML
<?php
<?php
echo \$this->render(\$tpl);
?>
HTML
);

file_put_contents($tpl2, <<<HTML
<?php
<?php
if ((1) { //syntax error
}
?>
Expand All @@ -37,5 +33,11 @@ HTML

echo $view->render($tpl, array('tpl' => $tpl2));
?>
--CLEAN--
<?php
/* unlink foo2.phtml permission denied */
require "build.inc";
shutdown();
?>
--EXPECTF--
Parse error: syntax error, unexpected '{' in %sfoo2.phtml on line %d
24 changes: 15 additions & 9 deletions tests/048.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ yaf.use_spl_autoload=0
yaf.lowcase_path=0

--FILE--
<?php
<?php
require "build.inc";
define("APPLICATION_PATH", dirname(__FILE__));
startup(APPLICATION_PATH . '/application');
startup();

$config = array(
"application" => array(
"directory" => APPLICATION_PATH . "/application/",
"directory" => APPLICATION_PATH,
"dispatcher" => array (
"catchException" => true,
),
Expand All @@ -22,7 +22,7 @@ $config = array(
),
);

file_put_contents(APPLICATION_PATH . "/application/controllers/Error.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/controllers/Error.php", <<<PHP
<?php
class ErrorController extends Yaf_Controller_Abstract {
public function errorAction(\$exception) {
Expand All @@ -33,7 +33,7 @@ file_put_contents(APPLICATION_PATH . "/application/controllers/Error.php", <<<PH
PHP
);

file_put_contents(APPLICATION_PATH . "/application/Bootstrap.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/Bootstrap.php", <<<PHP
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
public function _initConfig(Yaf_Dispatcher \$dispatcher) {
Expand All @@ -46,7 +46,7 @@ file_put_contents(APPLICATION_PATH . "/application/Bootstrap.php", <<<PHP
PHP
);

file_put_contents(APPLICATION_PATH . "/application/plugins/Test.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/plugins/Test.php", <<<PHP
<?php
class TestPlugin extends Yaf_Plugin_Abstract {
public function routerStartup(Yaf_Request_Abstract \$request, Yaf_Response_Abstract \$response) {
Expand Down Expand Up @@ -74,7 +74,7 @@ PHP

$value = NULL;

file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/controllers/Index.php", <<<PHP
<?php
class IndexController extends Yaf_Controller_Abstract {
public function init() {
Expand All @@ -90,12 +90,18 @@ file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PH
PHP
);

file_put_contents(APPLICATION_PATH . "/application/views/index/index.phtml",
file_put_contents(APPLICATION_PATH . "/views/index/index.phtml",
"<?php var_dump('view'); \$ref = \"changed\"; ?>");

$app = new Yaf_Application($config);
$app->bootstrap()->run();

?>
--CLEAN--
<?php
/* unlink foo2.phtml permission denied */
require "build.inc";
shutdown();
?>
--EXPECTF--
string(13) "routerStartup"
Expand Down
27 changes: 17 additions & 10 deletions tests/049.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ yaf.lowcase_path=0
--FILE--
<?php
require "build.inc";
define("APPLICATION_PATH", dirname(__FILE__));
startup(APPLICATION_PATH . '/application');
startup();

$config = array(
"application" => array(
"directory" => APPLICATION_PATH . "/application/",
"directory" => APPLICATION_PATH,
"dispatcher" => array (
"catchException" => true,
),
Expand All @@ -22,7 +22,7 @@ $config = array(
),
);

file_put_contents(APPLICATION_PATH . "/application/controllers/Error.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/controllers/Error.php", <<<PHP
<?php
class ErrorController extends Yaf_Controller_Abstract {
public function errorAction(\$exception) {
Expand All @@ -32,7 +32,7 @@ file_put_contents(APPLICATION_PATH . "/application/controllers/Error.php", <<<PH
PHP
);

file_put_contents(APPLICATION_PATH . "/application/Bootstrap.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/Bootstrap.php", <<<PHP
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
public function _initConfig(Yaf_Dispatcher \$dispatcher) {
Expand All @@ -48,7 +48,7 @@ file_put_contents(APPLICATION_PATH . "/application/Bootstrap.php", <<<PHP
PHP
);

file_put_contents(APPLICATION_PATH . "/application/plugins/Test.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/plugins/Test.php", <<<PHP
<?php
class TestPlugin extends Yaf_Plugin_Abstract {
public function routerStartup(Yaf_Request_Abstract \$request, Yaf_Response_Abstract \$response) {
Expand All @@ -73,7 +73,7 @@ file_put_contents(APPLICATION_PATH . "/application/plugins/Test.php", <<<PHP
PHP
);

file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/controllers/Index.php", <<<PHP
<?php
class IndexController extends Yaf_Controller_Abstract {
public function init() {
Expand All @@ -86,15 +86,22 @@ file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PH
PHP
);

file_put_contents(APPLICATION_PATH . "/application/views/index/index.phtml",
file_put_contents(APPLICATION_PATH . "/views/index/index.phtml",
"<?php throw new Exception('view exception'); ?>");
mkdir(APPLICATION_PATH . "/application/views/error/");
file_put_contents(APPLICATION_PATH . "/application/views/error/error.phtml",

mkdir(APPLICATION_PATH . "/views/error/");
file_put_contents(APPLICATION_PATH . "/views/error/error.phtml",
"catched: <?=\$msg?>");

$app = new Yaf_Application($config);
$app->bootstrap()->run();
?>
--CLEAN--
<?php
/* unlink foo2.phtml permission denied */
require "build.inc";
shutdown();
?>
--EXPECTF--
string(13) "routerStartup"
string(14) "routerShutdown"
Expand Down
18 changes: 12 additions & 6 deletions tests/050.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ yaf.lowcase_path=0
--FILE--
<?php
require "build.inc";
define("APPLICATION_PATH", dirname(__FILE__));
startup(APPLICATION_PATH . '/application');
startup();

$config = array(
"application" => array(
"directory" => APPLICATION_PATH . "/application/",
"directory" => APPLICATION_PATH,
),
);

file_put_contents(APPLICATION_PATH . "/application/Bootstrap.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/Bootstrap.php", <<<PHP
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
public function _initReturn(Yaf_Dispatcher \$dispatcher) {
Expand All @@ -27,7 +27,7 @@ file_put_contents(APPLICATION_PATH . "/application/Bootstrap.php", <<<PHP
PHP
);

file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/controllers/Index.php", <<<PHP
<?php
class IndexController extends Yaf_Controller_Abstract {
public function indexAction() {
Expand All @@ -36,13 +36,19 @@ file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PH
PHP
);

file_put_contents(APPLICATION_PATH . "/application/views/index/index.phtml", "view");
file_put_contents(APPLICATION_PATH . "/views/index/index.phtml", "view");

$app = new Yaf_Application($config);
$response = $app->bootstrap()->run();
var_dump("-------");
echo $response;
?>
--CLEAN--
<?php
/* unlink foo2.phtml permission denied */
require "build.inc";
shutdown();
?>
--EXPECTF--
string(7) "-------"
view
21 changes: 13 additions & 8 deletions tests/053.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ yaf.lowcase_path=0
--FILE--
<?php
require "build.inc";
startup();

define("APPLICATION_PATH", dirname(__FILE__));
startup(APPLICATION_PATH . '/application');
$config = array(
"application" => array(
"directory" => APPLICATION_PATH . "/application/",
"directory" => APPLICATION_PATH,
),
);

Expand All @@ -26,18 +25,18 @@ class SimpleView extends Yaf_View_Simple {
}
}

$tpl_dir = APPLICATION_PATH . "/application/views";
file_put_contents(APPLICATION_PATH . "/application/Bootstrap.php", <<<PHP
$tpl_dir = APPLICATION_PATH . "/views";
file_put_contents(APPLICATION_PATH . "/Bootstrap.php", <<<PHP
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
public function _initView(Yaf_Dispatcher \$dispatcher) {
\$dispatcher->setView(new SimpleView("{$tpl_dir}"));
\$dispatcher->setView(new SimpleView('{$tpl_dir}'));
}
}
PHP
);

file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PHP
file_put_contents(APPLICATION_PATH . "/controllers/Index.php", <<<PHP
<?php
class IndexController extends Yaf_Controller_Abstract {
public function indexAction() {
Expand All @@ -47,11 +46,17 @@ file_put_contents(APPLICATION_PATH . "/application/controllers/Index.php", <<<PH
PHP
);

file_put_contents(APPLICATION_PATH . "/application/views/index/index.phtml", "<?=\$name?>");
file_put_contents($tpl_dir . "/index/index.phtml", "<?=\$name?>");

$app = new Yaf_Application($config);
$response = $app->bootstrap()->run();
echo $response;
?>
--CLEAN--
<?php
/* unlink foo2.phtml permission denied */
require "build.inc";
shutdown();
?>
--EXPECTF--
custom view
Loading