RouteTest.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Rest
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /** Test helper */
  23. require_once dirname(__FILE__) . '/../../TestHelper.php';
  24. require_once "PHPUnit/Framework/TestCase.php";
  25. require_once "PHPUnit/Framework/TestSuite.php";
  26. /** Zend_Rest_Route */
  27. require_once 'Zend/Rest/Route.php';
  28. /** Zend_Controller_Front */
  29. require_once 'Zend/Controller/Front.php';
  30. /** Zend_Controller_Request_HttpTestCase */
  31. require_once 'Zend/Controller/Request/HttpTestCase.php';
  32. // Call Zend_Rest_RouteTest::main() if this source file is executed directly.
  33. if (!defined("PHPUnit_MAIN_METHOD")) {
  34. define("PHPUnit_MAIN_METHOD", "Zend_Rest_RouteTest::main");
  35. }
  36. /**
  37. * @category Zend
  38. * @package Zend_Rest
  39. * @subpackage UnitTests
  40. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  41. * @license http://framework.zend.com/license/new-bsd New BSD License
  42. * @group Zend_Rest
  43. */
  44. class Zend_Rest_RouteTest extends PHPUnit_Framework_TestCase
  45. {
  46. protected $_front;
  47. protected $_request;
  48. protected $_dispatcher;
  49. /**
  50. * Runs the test methods of this class.
  51. *
  52. * @access public
  53. * @static
  54. */
  55. public static function main()
  56. {
  57. require_once "PHPUnit/TextUI/TestRunner.php";
  58. $suite = new PHPUnit_Framework_TestSuite("Zend_Rest_RouteTest");
  59. $result = PHPUnit_TextUI_TestRunner::run($suite);
  60. }
  61. public function setUp()
  62. {
  63. $this->_front = Zend_Controller_Front::getInstance();
  64. $this->_front->resetInstance();
  65. $this->_front->setParam('noErrorHandler', true)
  66. ->setParam('noViewRenderer', true);
  67. $this->_dispatcher = $this->_front->getDispatcher();
  68. $this->_dispatcher->setControllerDirectory(array(
  69. 'default' => dirname(__FILE__) . DIRECTORY_SEPARATOR .
  70. '..' . DIRECTORY_SEPARATOR .
  71. 'Controller' . DIRECTORY_SEPARATOR .
  72. '_files',
  73. 'mod' => dirname(__FILE__) . DIRECTORY_SEPARATOR .
  74. '..' . DIRECTORY_SEPARATOR .
  75. 'Controller' . DIRECTORY_SEPARATOR .
  76. '_files' . DIRECTORY_SEPARATOR .
  77. 'Admin',
  78. ));
  79. }
  80. public function test_getVersion()
  81. {
  82. $route = new Zend_Rest_Route($this->_front);
  83. $this->assertEquals(2, $route->getVersion());
  84. }
  85. public function test_getInstance_fromINIConfig()
  86. {
  87. require_once('Zend/Config/Ini.php');
  88. $config = new Zend_Config_Ini(dirname(__FILE__) . '/../Controller/_files/routes.ini', 'testing');
  89. require_once('Zend/Controller/Router/Rewrite.php');
  90. $router = new Zend_Controller_Router_Rewrite();
  91. $router->addConfig($config, 'routes');
  92. $route = $router->getRoute('rest');
  93. $this->assertType('Zend_Rest_Route', $route);
  94. $this->assertEquals('object', $route->getDefault('controller'));
  95. $request = $this->_buildRequest('GET', '/mod/project');
  96. $values = $this->_invokeRouteMatch($request, array(), $route);
  97. $this->assertEquals('mod', $values['module']);
  98. $this->assertEquals('project', $values['controller']);
  99. $this->assertEquals('index', $values['action']);
  100. $request = $this->_buildRequest('POST', '/mod/user');
  101. $values = $this->_invokeRouteMatch($request, array(), $route);
  102. $this->assertEquals('mod', $values['module']);
  103. $this->assertEquals('user', $values['controller']);
  104. $this->assertEquals('post', $values['action']);
  105. $request = $this->_buildRequest('GET', '/other');
  106. $values = $this->_invokeRouteMatch($request, array(), $route);
  107. $this->assertFalse($values);
  108. }
  109. public function test_RESTfulApp_defaults()
  110. {
  111. $request = $this->_buildRequest('GET', '/');
  112. $values = $this->_invokeRouteMatch($request);
  113. $this->assertType('array', $values);
  114. $this->assertTrue(isset($values['module']));
  115. $this->assertEquals('default', $values['module']);
  116. $this->assertEquals('index', $values['controller']);
  117. $this->assertEquals('index', $values['action']);
  118. }
  119. /*
  120. * @group ZF-7437
  121. */
  122. public function test_RESTfulApp_GET_user_defaults()
  123. {
  124. $request = $this->_buildRequest('GET', '/user');
  125. $values = $this->_invokeRouteMatch($request);
  126. $this->assertType('array', $values);
  127. $this->assertTrue(isset($values['module']));
  128. $this->assertEquals('default', $values['module']);
  129. $this->assertEquals('user', $values['controller']);
  130. $this->assertEquals('index', $values['action']);
  131. }
  132. public function test_RESTfulApp_GET_user_index()
  133. {
  134. $request = $this->_buildRequest('GET', '/user/index');
  135. $values = $this->_invokeRouteMatch($request);
  136. $this->assertType('array', $values);
  137. $this->assertTrue(isset($values['module']));
  138. $this->assertEquals('default', $values['module']);
  139. $this->assertEquals('user', $values['controller']);
  140. $this->assertEquals('index', $values['action']);
  141. }
  142. public function test_RESTfulApp_GET_user_index_withParams()
  143. {
  144. $request = $this->_buildRequest('GET', '/user/index/changedSince/123456789/status/active');
  145. $values = $this->_invokeRouteMatch($request);
  146. $this->assertType('array', $values);
  147. $this->assertTrue(isset($values['module']));
  148. $this->assertEquals('default', $values['module']);
  149. $this->assertEquals('user', $values['controller']);
  150. $this->assertEquals('index', $values['action']);
  151. $this->assertEquals(123456789, $values['changedSince']);
  152. $this->assertEquals('active', $values['status']);
  153. }
  154. public function test_RESTfulApp_GET_user_index_withQueryParams()
  155. {
  156. $request = $this->_buildRequest('GET', '/user/?changedSince=123456789&status=active');
  157. $values = $this->_invokeRouteMatch($request);
  158. $this->assertType('array', $values);
  159. $this->assertTrue(isset($values['module']));
  160. $this->assertEquals('default', $values['module']);
  161. $this->assertEquals('user', $values['controller']);
  162. $this->assertEquals('index', $values['action']);
  163. $this->assertEquals(123456789, $values['changedSince']);
  164. $this->assertEquals('active', $values['status']);
  165. }
  166. public function test_RESTfulApp_GET_project_byIdentifier()
  167. {
  168. $request = $this->_buildRequest('GET', '/project/zendframework');
  169. $values = $this->_invokeRouteMatch($request);
  170. $this->assertType('array', $values);
  171. $this->assertTrue(isset($values['module']));
  172. $this->assertEquals('default', $values['module']);
  173. $this->assertEquals('project', $values['controller']);
  174. $this->assertEquals('get', $values['action']);
  175. $this->assertEquals('zendframework', $values['id']);
  176. }
  177. public function test_RESTfulApp_GET_project_byIdQueryParam()
  178. {
  179. $request = $this->_buildRequest('GET', '/project/?id=zendframework');
  180. $values = $this->_invokeRouteMatch($request);
  181. $this->assertType('array', $values);
  182. $this->assertTrue(isset($values['module']));
  183. $this->assertEquals('default', $values['module']);
  184. $this->assertEquals('project', $values['controller']);
  185. $this->assertEquals('get', $values['action']);
  186. $this->assertEquals('zendframework', $values['id']);
  187. }
  188. public function test_RESTfulApp_GET_project_byIdentifier_urlencoded()
  189. {
  190. $request = $this->_buildRequest('GET', '/project/zend+framework');
  191. $values = $this->_invokeRouteMatch($request);
  192. $this->assertType('array', $values);
  193. $this->assertTrue(isset($values['module']));
  194. $this->assertEquals('default', $values['module']);
  195. $this->assertEquals('project', $values['controller']);
  196. $this->assertEquals('get', $values['action']);
  197. $this->assertEquals('zend framework', $values['id']);
  198. }
  199. public function test_RESTfulApp_GET_project_edit()
  200. {
  201. $request = $this->_buildRequest('GET', '/project/zendframework/edit');
  202. $values = $this->_invokeRouteMatch($request);
  203. $this->assertType('array', $values);
  204. $this->assertTrue(isset($values['module']));
  205. $this->assertEquals('default', $values['module']);
  206. $this->assertEquals('project', $values['controller']);
  207. $this->assertEquals('edit', $values['action']);
  208. $this->assertEquals('zendframework', $values['id']);
  209. }
  210. public function test_RESTfulApp_PUT_user_byIdentifier()
  211. {
  212. $request = $this->_buildRequest('PUT', '/mod/user/lcrouch');
  213. $values = $this->_invokeRouteMatch($request);
  214. $this->assertType('array', $values);
  215. $this->assertTrue(isset($values['module']));
  216. $this->assertEquals('mod', $values['module']);
  217. $this->assertEquals('user', $values['controller']);
  218. $this->assertEquals('put', $values['action']);
  219. $this->assertEquals('lcrouch', $values['id']);
  220. }
  221. public function test_RESTfulApp_POST_user()
  222. {
  223. $request = $this->_buildRequest('POST', '/mod/user');
  224. $values = $this->_invokeRouteMatch($request);
  225. $this->assertType('array', $values);
  226. $this->assertTrue(isset($values['module']));
  227. $this->assertEquals('mod', $values['module']);
  228. $this->assertEquals('user', $values['controller']);
  229. $this->assertEquals('post', $values['action']);
  230. }
  231. public function test_RESTfulApp_DELETE_user_byIdentifier()
  232. {
  233. $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch');
  234. $values = $this->_invokeRouteMatch($request);
  235. $this->assertType('array', $values);
  236. $this->assertTrue(isset($values['module']));
  237. $this->assertEquals('mod', $values['module']);
  238. $this->assertEquals('user', $values['controller']);
  239. $this->assertEquals('delete', $values['action']);
  240. $this->assertEquals('lcrouch', $values['id']);
  241. }
  242. public function test_RESTfulApp_POST_user_with_identifier_doesPUT()
  243. {
  244. $request = $this->_buildRequest('POST', '/mod/user/lcrouch');
  245. $values = $this->_invokeRouteMatch($request);
  246. $this->assertType('array', $values);
  247. $this->assertTrue(isset($values['module']));
  248. $this->assertEquals('mod', $values['module']);
  249. $this->assertEquals('user', $values['controller']);
  250. $this->assertEquals('put', $values['action']);
  251. $this->assertEquals('lcrouch', $values['id']);
  252. }
  253. public function test_RESTfulApp_overload_POST_with_method_param_PUT()
  254. {
  255. $request = $this->_buildRequest('POST', '/mod/user');
  256. $request->setParam('_method', 'PUT');
  257. $values = $this->_invokeRouteMatch($request);
  258. $this->assertType('array', $values);
  259. $this->assertTrue(isset($values['module']));
  260. $this->assertEquals('mod', $values['module']);
  261. $this->assertEquals('user', $values['controller']);
  262. $this->assertEquals('put', $values['action']);
  263. }
  264. public function test_RESTfulApp_overload_POST_with_http_header_DELETE()
  265. {
  266. $request = $this->_buildRequest('POST', '/mod/user/lcrouch');
  267. $request->setHeader('X-HTTP-Method-Override', 'DELETE');
  268. $values = $this->_invokeRouteMatch($request);
  269. $this->assertType('array', $values);
  270. $this->assertTrue(isset($values['module']));
  271. $this->assertEquals('mod', $values['module']);
  272. $this->assertEquals('user', $values['controller']);
  273. $this->assertEquals('delete', $values['action']);
  274. $this->assertEquals('lcrouch', $values['id']);
  275. }
  276. public function test_RESTfulApp_route_chaining()
  277. {
  278. $request = $this->_buildRequest('GET', '/api/user/lcrouch');
  279. $this->_front->setRequest($request);
  280. $router = $this->_front->getRouter();
  281. $router->removeDefaultRoutes();
  282. $nonRESTRoute = new Zend_Controller_Router_Route('api');
  283. $RESTRoute = new Zend_Rest_Route($this->_front);
  284. $router->addRoute("api", $nonRESTRoute->chain($RESTRoute));
  285. $routedRequest = $router->route($request);
  286. $this->assertEquals("default", $routedRequest->getParam("module"));
  287. $this->assertEquals("user", $routedRequest->getParam("controller"));
  288. $this->assertEquals("get", $routedRequest->getParam("action"));
  289. $this->assertEquals("lcrouch", $routedRequest->getParam("id"));
  290. }
  291. public function test_RESTfulModule_GET_user_index()
  292. {
  293. $request = $this->_buildRequest('GET', '/mod/user/index');
  294. $config = array('mod');
  295. $values = $this->_invokeRouteMatch($request, $config);
  296. $this->assertType('array', $values);
  297. $this->assertTrue(isset($values['module']));
  298. $this->assertEquals('mod', $values['module']);
  299. $this->assertEquals('user', $values['controller']);
  300. $this->assertEquals('index', $values['action']);
  301. }
  302. public function test_RESTfulModule_GET_user()
  303. {
  304. $request = $this->_buildRequest('GET', '/mod/user/1234');
  305. $config = array('mod');
  306. $values = $this->_invokeRouteMatch($request, $config);
  307. $this->assertType('array', $values);
  308. $this->assertTrue(isset($values['module']));
  309. $this->assertEquals('mod', $values['module']);
  310. $this->assertEquals('user', $values['controller']);
  311. $this->assertEquals('get', $values['action']);
  312. }
  313. public function test_RESTfulModule_POST_user()
  314. {
  315. $request = $this->_buildRequest('POST', '/mod/user');
  316. $config = array('mod');
  317. $values = $this->_invokeRouteMatch($request, $config);
  318. $this->assertType('array', $values);
  319. $this->assertTrue(isset($values['module']));
  320. $this->assertEquals('mod', $values['module']);
  321. $this->assertEquals('user', $values['controller']);
  322. $this->assertEquals('post', $values['action']);
  323. }
  324. public function test_RESTfulModule_POST_user_inNonRESTModule_returnsFalse()
  325. {
  326. $request = $this->_buildRequest('POST', '/default/user');
  327. $config = array('mod');
  328. $values = $this->_invokeRouteMatch($request, $config);
  329. $this->assertFalse($values);
  330. }
  331. public function test_RESTfulModule_PUT_user_byIdentifier()
  332. {
  333. $request = $this->_buildRequest('PUT', '/mod/user/lcrouch');
  334. $config = array('mod');
  335. $values = $this->_invokeRouteMatch($request, $config);
  336. $this->assertType('array', $values);
  337. $this->assertTrue(isset($values['module']));
  338. $this->assertEquals('mod', $values['module']);
  339. $this->assertEquals('user', $values['controller']);
  340. $this->assertEquals('put', $values['action']);
  341. $this->assertEquals('lcrouch', $values['id']);
  342. }
  343. public function test_RESTfulModule_DELETE_user_byIdentifier()
  344. {
  345. $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch');
  346. $config = array('mod');
  347. $values = $this->_invokeRouteMatch($request, $config);
  348. $this->assertType('array', $values);
  349. $this->assertTrue(isset($values['module']));
  350. $this->assertEquals('mod', $values['module']);
  351. $this->assertEquals('user', $values['controller']);
  352. $this->assertEquals('delete', $values['action']);
  353. $this->assertEquals('lcrouch', $values['id']);
  354. }
  355. public function test_RESTfulController_GET_user_index()
  356. {
  357. $request = $this->_buildRequest('GET', '/mod/user/index');
  358. $config = array('mod'=>array('user'));
  359. $values = $this->_invokeRouteMatch($request, $config);
  360. $this->assertType('array', $values);
  361. $this->assertTrue(isset($values['module']));
  362. $this->assertEquals('mod', $values['module']);
  363. $this->assertEquals('user', $values['controller']);
  364. $this->assertEquals('index', $values['action']);
  365. }
  366. public function test_RESTfulController_GET_default_controller_returns_false()
  367. {
  368. $request = $this->_buildRequest('GET', '/mod/index/index');
  369. $config = array('mod'=>array('user'));
  370. $values = $this->_invokeRouteMatch($request, $config);
  371. $this->assertFalse($values);
  372. }
  373. public function test_RESTfulController_GET_other_index_returns_false()
  374. {
  375. $request = $this->_buildRequest('GET', '/mod/project/index');
  376. $config = array('mod'=>array('user'));
  377. $values = $this->_invokeRouteMatch($request, $config);
  378. $this->assertFalse($values);
  379. }
  380. public function test_RESTfulController_GET_user()
  381. {
  382. $request = $this->_buildRequest('GET', '/mod/user/1234');
  383. $config = array('mod'=>array('user'));
  384. $values = $this->_invokeRouteMatch($request, $config);
  385. $this->assertType('array', $values);
  386. $this->assertTrue(isset($values['module']));
  387. $this->assertEquals('mod', $values['module']);
  388. $this->assertEquals('user', $values['controller']);
  389. $this->assertEquals('get', $values['action']);
  390. }
  391. public function test_RESTfulController_POST_user()
  392. {
  393. $request = $this->_buildRequest('POST', '/mod/user');
  394. $config = array('mod'=>array('user'));
  395. $values = $this->_invokeRouteMatch($request, $config);
  396. $this->assertType('array', $values);
  397. $this->assertTrue(isset($values['module']));
  398. $this->assertEquals('mod', $values['module']);
  399. $this->assertEquals('user', $values['controller']);
  400. $this->assertEquals('post', $values['action']);
  401. }
  402. public function test_RESTfulController_POST_user_inNonRESTModule_returnsFalse()
  403. {
  404. $request = $this->_buildRequest('POST', '/default/user');
  405. $config = array('mod'=>array('user'));
  406. $values = $this->_invokeRouteMatch($request, $config);
  407. $this->assertFalse($values);
  408. }
  409. public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_defaultControllerInURL_returnsFalse()
  410. {
  411. $request = $this->_buildRequest('POST', '/mod/index');
  412. $config = array('mod'=>array('user'));
  413. $values = $this->_invokeRouteMatch($request, $config);
  414. $this->assertFalse($values);
  415. }
  416. public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_noDefaultControllerInURL_returnsFalse()
  417. {
  418. $request = $this->_buildRequest('POST', '/mod');
  419. $config = array('mod'=>array('user'));
  420. $values = $this->_invokeRouteMatch($request, $config);
  421. $this->assertFalse($values);
  422. }
  423. public function test_RESTfulController_PUT_user_byIdentifier()
  424. {
  425. $request = $this->_buildRequest('PUT', '/mod/user/lcrouch');
  426. $config = array('mod'=>array('user'));
  427. $values = $this->_invokeRouteMatch($request, $config);
  428. $this->assertType('array', $values);
  429. $this->assertTrue(isset($values['module']));
  430. $this->assertEquals('mod', $values['module']);
  431. $this->assertEquals('user', $values['controller']);
  432. $this->assertEquals('put', $values['action']);
  433. $this->assertEquals('lcrouch', $values['id']);
  434. }
  435. public function test_RESTfulController_DELETE_user_byIdentifier()
  436. {
  437. $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch');
  438. $config = array('mod');
  439. $values = $this->_invokeRouteMatch($request, $config);
  440. $this->assertType('array', $values);
  441. $this->assertTrue(isset($values['module']));
  442. $this->assertEquals('mod', $values['module']);
  443. $this->assertEquals('user', $values['controller']);
  444. $this->assertEquals('delete', $values['action']);
  445. $this->assertEquals('lcrouch', $values['id']);
  446. }
  447. public function test_assemble_plain_ignores_action()
  448. {
  449. $route = new Zend_Rest_Route($this->_front, array(), array());
  450. $params = array('module'=>'mod', 'controller'=>'user', 'action'=>'get');
  451. $url = $route->assemble($params);
  452. $this->assertEquals('mod/user', $url);
  453. }
  454. public function test_assemble_id_after_controller()
  455. {
  456. $route = new Zend_Rest_Route($this->_front, array(), array());
  457. $params = array('module'=>'mod', 'controller'=>'user', 'id'=>'lcrouch');
  458. $url = $route->assemble($params);
  459. $this->assertEquals('mod/user/lcrouch', $url);
  460. }
  461. public function test_assemble_index_after_controller_with_params()
  462. {
  463. $route = new Zend_Rest_Route($this->_front, array(), array());
  464. $params = array('module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar');
  465. $url = $route->assemble($params);
  466. $this->assertEquals('mod/user/index/foo/bar', $url);
  467. }
  468. public function test_assemble_encode_param_values()
  469. {
  470. $route = new Zend_Rest_Route($this->_front, array(), array());
  471. $params = array('module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar is n!ice');
  472. $url = $route->assemble($params);
  473. $this->assertEquals('mod/user/index/foo/bar+is+n%21ice', $url);
  474. }
  475. public function test_assemble_does_NOT_encode_param_values()
  476. {
  477. $route = new Zend_Rest_Route($this->_front, array(), array());
  478. $params = array('module'=>'mod', 'controller'=>'user', 'index'=>true, 'foo'=>'bar is n!ice');
  479. $url = $route->assemble($params, false, false);
  480. $this->assertEquals('mod/user/index/foo/bar is n!ice', $url);
  481. }
  482. private function _buildRequest($method, $uri)
  483. {
  484. $request = new Zend_Controller_Request_HttpTestCase();
  485. $request->setMethod($method)->setRequestUri($uri);
  486. return $request;
  487. }
  488. private function _invokeRouteMatch($request, $config = array(), $route = null)
  489. {
  490. $this->_front->setRequest($request);
  491. if ($route == null)
  492. $route = new Zend_Rest_Route($this->_front, array(), $config);
  493. $values = $route->match($request);
  494. return $values;
  495. }
  496. }
  497. // Call Zend_Rest_RouteTest::main() if this source file is executed directly.
  498. if (PHPUnit_MAIN_METHOD == "Zend_Rest_RouteTest::main") {
  499. Zend_Rest_RouteTest::main();
  500. }