pluf2

pluf2 Commit Details


Date:2009-07-09 09:18:57 (15 years 5 months ago)
Author:Loic d'Anterroches
Branch:master
Commit:bb66724b9b2fb9bfce7f93f49a1584b8db67a5e5
Parents: 6a7e3377862544cba835654d3f3992cf86b830be
Message:Added a bit more tests.

Changes:

File differences

src/Pluf/Tests/Dispatch/Dispatcher.php
8989
9090
9191
92
93
94
95
96
97
9298
9399
94100
......
97103
98104
99105
100
106
107
108
109
110
111
112
113
101114
102115
103116
......
130143
131144
132145
146
147
133148
134149
135150
151
152
136153
137154
138155
......
144161
145162
146163
164
165
166
167
147168
148169
149170
{
$GLOBALS['_PX_views'] = array(
array(
'regex' => '#^/hello/$#',
'base' => '',
'model' => 'Pluf_Tests_Dispatch_Dispatcher',
'method' => 'hello3'
),
array(
'regex' => '#^/hello/#',
'base' => '',
'sub' => array(
'base' => '',
'model' => 'Pluf_Tests_Dispatch_Dispatcher',
'method' => 'hello'
)
),
array(
'regex' => '#^hello/$#',
'base' => '',
'model' => 'Pluf_Tests_Dispatch_Dispatcher',
'method' => 'hello4'
),
),
),
array(
$req3 = (object) array('query' => '/hello/you/'); // no match
$h1 = (object) array('query' => '/hello1/world/'); // match
$h2 = (object) array('query' => '/hello2/world/'); // match
$h3 = (object) array('query' => '/hello/'); // match
$h4 = (object) array('query' => '/hello/hello/'); // match
$this->assertIdentical(true, Pluf_Dispatcher::match($req1));
$this->assertIdentical(1, Pluf_Dispatcher::match($h1));
$this->assertIdentical(2, Pluf_Dispatcher::match($h2));
$this->assertIdentical(3, Pluf_Dispatcher::match($h3));
$this->assertIdentical(4, Pluf_Dispatcher::match($h4));
$this->assertIsA(Pluf_Dispatcher::match($req2),
'Pluf_HTTP_Response_Redirect');
$this->assertIsA(Pluf_Dispatcher::match($req3),
Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello1'));
$this->assertEqual('/hello2/world/',
Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello2'));
$this->assertEqual('/hello/',
Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello3'));
$this->assertEqual('/hello/hello/',
Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello4'));
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06715s using 13 queries.