@@ -76,78 +76,6 @@ function testFullBaseURL() {
76
76
$ this ->assertPattern ('/^http(s)?:\/\// ' , Router::url (null , true ));
77
77
}
78
78
79
- /**
80
- * testRouteWriting method
81
- *
82
- * @access public
83
- * @return void
84
- */
85
- function testRouteWriting () {
86
- return false ;
87
-
88
- Router::connect ('/ ' );
89
- Router::parse ('/ ' );
90
- $ this ->assertEqual ($ this ->router ->routes [0 ][0 ], '/ ' );
91
- $ this ->assertEqual ($ this ->router ->routes [0 ][1 ], '/^[\/]*$/ ' );
92
- $ this ->assertEqual ($ this ->router ->routes [0 ][2 ], array ());
93
-
94
- Router::reload ();
95
- Router::connect ('/ ' , array ('controller ' => 'testing ' ));
96
- Router::parse ('/ ' );
97
- $ this ->assertTrue (is_array ($ this ->router ->routes [0 ][3 ]) && !empty ($ this ->router ->routes [0 ][3 ]));
98
- $ this ->assertEqual ($ this ->router ->routes [0 ][3 ]['controller ' ], 'testing ' );
99
- $ this ->assertEqual ($ this ->router ->routes [0 ][3 ]['action ' ], 'index ' );
100
- $ this ->assertEqual (count ($ this ->router ->routes [0 ][3 ]), 3 );
101
-
102
- $ this ->router ->routes = array ();
103
- Router::connect ('/:controller ' , array ('controller ' => 'testing2 ' ));
104
- Router::parse ('/testing2 ' );
105
- $ this ->assertTrue (is_array ($ this ->router ->routes [0 ][3 ]) && !empty ($ this ->router ->routes [0 ][3 ]), '/ ' );
106
- $ this ->assertEqual ($ this ->router ->routes [0 ][3 ]['controller ' ], 'testing2 ' );
107
- $ this ->assertEqual ($ this ->router ->routes [0 ][3 ]['action ' ], 'index ' );
108
- $ this ->assertEqual (count ($ this ->router ->routes [0 ][3 ]), 3 );
109
-
110
- $ this ->router ->routes = array ();
111
- Router::connect ('/:controller/:action ' , array ('controller ' => 'testing3 ' ));
112
- Router::parse ('/testing3/index ' );
113
- $ this ->assertEqual ($ this ->router ->routes [0 ][0 ], '/:controller/:action ' );
114
- $ this ->assertEqual ($ this ->router ->routes [0 ][1 ], '#^(?:/([^\/]+))?(?:/([^\/]+))?[\/]*$# ' );
115
- $ this ->assertEqual ($ this ->router ->routes [0 ][2 ], array ('controller ' , 'action ' ));
116
- $ this ->assertEqual ($ this ->router ->routes [0 ][3 ], array ('controller ' => 'testing3 ' , 'action ' => 'index ' , 'plugin ' => null ));
117
-
118
- $ this ->router ->routes = array ();
119
- Router::connect ('/:controller/:action/:id ' , array ('controller ' => 'testing4 ' , 'id ' => null ), array ('id ' => $ this ->router ->__named ['ID ' ]));
120
- Router::parse ('/testing4/view/5 ' );
121
- $ this ->assertEqual ($ this ->router ->routes [0 ][0 ], '/:controller/:action/:id ' );
122
- $ this ->assertEqual ($ this ->router ->routes [0 ][1 ], '#^(?:/([^\/]+))?(?:/([^\/]+))?(?:/([0-9]+)?)?[\/]*$# ' );
123
- $ this ->assertEqual ($ this ->router ->routes [0 ][2 ], array ('controller ' , 'action ' , 'id ' ));
124
-
125
- $ this ->router ->routes = array ();
126
- Router::connect ('/:controller/:action/:id ' , array ('controller ' => 'testing4 ' ), array ('id ' => $ this ->router ->__named ['ID ' ]));
127
- Router::parse ('/testing4/view/5 ' );
128
- $ this ->assertEqual ($ this ->router ->routes [0 ][1 ], '#^(?:/([^\/]+))?(?:/([^\/]+))?(?:/([0-9]+))[\/]*$# ' );
129
-
130
- $ this ->router ->routes = array ();
131
- Router::connect ('/posts/foo:id ' );
132
- Router::parse ('/posts/foo5 ' );
133
- $ this ->assertEqual ($ this ->router ->routes [0 ][2 ], array ('id ' ));
134
- $ this ->assertEqual ($ this ->router ->routes [0 ][1 ], '#^/posts(?:/foo([^\/]+))?[\/]*$# ' );
135
-
136
- foreach (array (': ' , '@ ' , '; ' , '$ ' , '- ' ) as $ delim ) {
137
- $ this ->router ->routes = array ();
138
- Router::connect ('/posts/:id ' .$ delim .':title ' );
139
- Router::parse ('/posts/5 ' . $ delim . 'foo ' );
140
- $ this ->assertEqual ($ this ->router ->routes [0 ][2 ], array ('id ' , 'title ' ));
141
- $ this ->assertEqual ($ this ->router ->routes [0 ][1 ], '#^/posts(?:/([^\/]+))?(?: ' .preg_quote ($ delim , '# ' ).'([^\/]+))?[\/]*$# ' );
142
- }
143
-
144
- $ this ->router ->routes = array ();
145
- Router::connect ('/posts/:id::title/:year ' );
146
- Router::parse ('/posts/5:foo:2007 ' );
147
- $ this ->assertEqual ($ this ->router ->routes [0 ][2 ], array ('id ' , 'title ' , 'year ' ));
148
- $ this ->assertEqual ($ this ->router ->routes [0 ][1 ], '#^/posts(?:/([^\/]+))?(?: \\:([^\/]+))?(?:/([^\/]+))?[\/]*$# ' );
149
- }
150
-
151
79
/**
152
80
* testRouteDefaultParams method
153
81
*
0 commit comments