@@ -70,6 +70,15 @@ function destination() {
70
70
$ this ->viewPath = 'posts ' ;
71
71
$ this ->render ('index ' );
72
72
}
73
+ /**
74
+ * test method for ajax redirection + parameter parsing
75
+ *
76
+ * @return void
77
+ */
78
+ function param_method ($ one = null , $ two = null ) {
79
+ echo "one: $ one two: $ two " ;
80
+ $ this ->autoRender = false ;
81
+ }
73
82
}
74
83
/**
75
84
* RequestHandlerTestDisabledController class
@@ -541,5 +550,35 @@ function testAjaxRedirectAsRequestAction() {
541
550
Configure::write ('viewPaths ' , $ _paths );
542
551
unset($ _SERVER ['HTTP_X_REQUESTED_WITH ' ]);
543
552
}
553
+
554
+ /**
555
+ * test that the beforeRedirect callback properly converts
556
+ * array urls into their correct string ones, and adds base => false so
557
+ * the correct urls are generated.
558
+ *
559
+ * @link http://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/tickets/276
560
+ * @return void
561
+ */
562
+ function testBeforeRedirectCallbackWithArrayUrl () {
563
+ $ _SERVER ['HTTP_X_REQUESTED_WITH ' ] = 'XMLHttpRequest ' ;
564
+ App::build (array (
565
+ 'views ' => array (TEST_CAKE_CORE_INCLUDE_PATH . 'tests ' . DS . 'test_app ' . DS . 'views ' . DS )
566
+ ), true );
567
+ Router::setRequestInfo (array (
568
+ array ('plugin ' => null , 'controller ' => 'accounts ' , 'action ' => 'index ' , 'pass ' => array (), 'named ' => array (), 'form ' => array (), 'url ' => array ('url ' => 'accounts/ ' ), 'bare ' => 0 ),
569
+ array ('base ' => '/officespace ' , 'here ' => '/officespace/accounts/ ' , 'webroot ' => '/officespace/ ' )
570
+ ));
571
+
572
+ $ RequestHandler =& new NoStopRequestHandler ();
573
+
574
+ ob_start ();
575
+ $ RequestHandler ->beforeRedirect (
576
+ $ this ->Controller ,
577
+ array ('controller ' => 'request_handler_test ' , 'action ' => 'param_method ' , 'first ' , 'second ' )
578
+ );
579
+ $ result = ob_get_clean ();
580
+ $ this ->assertEqual ($ result , 'one: first two: second ' );
581
+ App::build ();
582
+ }
544
583
}
545
584
?>
0 commit comments