Pluf Framework

Pluf Framework Commit Details


Date:2009-07-09 08:47:41 (15 years 5 months ago)
Author:Loic d'Anterroches
Branch:develop, master
Commit:bd0b8707a8fe410b322b1613940b691ff38bd9bb
Parents: 955e2dd713ad17a8d00f18660fc024360d213c28
Message:Added more dispatcher tests.

Changes:

File differences

src/Pluf/Tests/Dispatch/Dispatcher.php
4545
4646
4747
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
4868
4969
5070
......
7898
7999
80100
81
82
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
83128
84129
85130
131
132
86133
134
135
87136
88137
89138
......
91140
92141
93142
143
144
145
146
94147
95148
96149
return true;
}
function hello1()
{
return 1;
}
function hello2()
{
return 2;
}
function hello3()
{
return 3;
}
function hello4()
{
return 4;
}
function testSimple()
{
$GLOBALS['_PX_views'] = array(
'model' => 'Pluf_Tests_Dispatch_Dispatcher',
'method' => 'hello'
)
)
));
),
),
array(
'regex' => '#^/hello1/#',
'base' => '',
'sub' => array(
array(
'regex' => '#^world/$#',
'base' => '',
'model' => 'Pluf_Tests_Dispatch_Dispatcher',
'method' => 'hello1'
)
),
),
array(
'regex' => '#^/hello2/#',
'base' => '',
'sub' => array(
array(
'regex' => '#^world/$#',
'base' => '',
'model' => 'Pluf_Tests_Dispatch_Dispatcher',
'method' => 'hello2'
)
),
),
);
$req1 = (object) array('query' => '/hello/world/'); // match
$req2 = (object) array('query' => '/hello/world'); // match second pass
$req3 = (object) array('query' => '/hello/you/'); // no match
$h1 = (object) array('query' => '/hello1/world/'); // match
$h2 = (object) array('query' => '/hello2/world/'); // match
$this->assertIdentical(true, Pluf_Dispatcher::match($req1));
$this->assertIdentical(1, Pluf_Dispatcher::match($h1));
$this->assertIdentical(2, Pluf_Dispatcher::match($h2));
$this->assertIsA(Pluf_Dispatcher::match($req2),
'Pluf_HTTP_Response_Redirect');
$this->assertIsA(Pluf_Dispatcher::match($req3),
Pluf::loadFunction('Pluf_HTTP_URL_reverse');
$this->assertEqual('/hello/world/',
Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello'));
$this->assertEqual('/hello1/world/',
Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello1'));
$this->assertEqual('/hello2/world/',
Pluf_HTTP_URL_reverse('Pluf_Tests_Dispatch_Dispatcher::hello2'));
}

Archive Download the corresponding diff file

Branches

Tags

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