Lines Matching refs:INPUT

44         $INPUT    = new Input();
48 $this->assertNotSame('foobar', $INPUT->str('zstring'));
49 $this->assertSame('foobar', $INPUT->filter()->str('zstring'));
50 $this->assertSame('bar', $INPUT->filter($filter)->str('foo'));
51 $this->assertSame('bar', $INPUT->filter()->str('znull', 'bar', true));
52 … $this->assertNotSame('foobar', $INPUT->str('zstring')); // make sure original input is unmodified
54 $this->assertNotSame('foobar', $INPUT->get->str('zstring'));
55 $this->assertSame('foobar', $INPUT->get->filter()->str('zstring'));
56 $this->assertSame('bar', $INPUT->get->filter($filter)->str('foo'));
57 $this->assertSame('bar', $INPUT->get->filter()->str('znull', 'bar', true));
58 …$this->assertNotSame('foobar', $INPUT->get->str('zstring')); // make sure original input is unmodi…
60 $this->assertNotSame(4242, $INPUT->int('zint'));
61 $this->assertSame(4242, $INPUT->filter()->int('zint'));
62 $this->assertSame(42, $INPUT->filter($filter)->int('zintbaz'));
63 $this->assertSame(42, $INPUT->filter()->str('znull', 42, true));
65 $this->assertSame(true, $INPUT->bool('znull'));
66 $this->assertSame(false, $INPUT->filter()->bool('znull'));
68 $this->assertSame('foobar', $INPUT->filter()->valid('zstring', array('foobar', 'bang')));
77 $INPUT = new Input();
79 $this->assertSame('foo', $INPUT->str('string'));
80 $this->assertSame('', $INPUT->str('none'));
81 $this->assertSame('', $INPUT->str('empty'));
82 $this->assertSame('foo', $INPUT->str('none', 'foo'));
83 $this->assertSame('', $INPUT->str('empty', 'foo'));
84 $this->assertSame('foo', $INPUT->str('empty', 'foo', true));
86 $this->assertSame(false, $INPUT->str('get', false));
87 $this->assertSame(false, $INPUT->str('post', false));
89 $this->assertSame('foo', $INPUT->post->str('string'));
90 $this->assertSame('', $INPUT->post->str('none'));
91 $this->assertSame('', $INPUT->post->str('empty'));
92 $this->assertSame('foo', $INPUT->post->str('none', 'foo'));
93 $this->assertSame('', $INPUT->post->str('empty', 'foo'));
94 $this->assertSame('foo', $INPUT->post->str('empty', 'foo', true));
96 $this->assertSame(false, $INPUT->post->str('get', false));
97 $this->assertSame('1', $INPUT->post->str('post', false));
99 $this->assertSame('foo', $INPUT->get->str('string'));
100 $this->assertSame('', $INPUT->get->str('none'));
101 $this->assertSame('', $INPUT->get->str('empty'));
102 $this->assertSame('foo', $INPUT->get->str('none', 'foo'));
103 $this->assertSame('', $INPUT->get->str('empty', 'foo'));
104 $this->assertSame('foo', $INPUT->get->str('empty', 'foo', true));
106 $this->assertSame(false, $INPUT->get->str('post', false));
107 $this->assertSame('1', $INPUT->get->str('get', false));
109 $this->assertSame('', $INPUT->str('array'));
118 $INPUT = new Input();
120 $this->assertSame(17, $INPUT->int('int'));
121 $this->assertSame(0, $INPUT->int('none'));
122 $this->assertSame(0, $INPUT->int('empty'));
123 $this->assertSame(42, $INPUT->int('none', 42));
124 $this->assertSame(0, $INPUT->int('zero', 42));
125 $this->assertSame(42, $INPUT->int('zero', 42, true));
127 $this->assertSame(false, $INPUT->int('get', false));
128 $this->assertSame(false, $INPUT->int('post', false));
130 $this->assertSame(17, $INPUT->post->int('int'));
131 $this->assertSame(0, $INPUT->post->int('none'));
132 $this->assertSame(0, $INPUT->post->int('empty'));
133 $this->assertSame(42, $INPUT->post->int('none', 42));
134 $this->assertSame(0, $INPUT->post->int('zero', 42));
135 $this->assertSame(42, $INPUT->post->int('zero', 42, true));
137 $this->assertSame(false, $INPUT->post->int('get', false));
138 $this->assertSame(1, $INPUT->post->int('post', false));
140 $this->assertSame(17, $INPUT->post->int('int'));
141 $this->assertSame(0, $INPUT->post->int('none'));
142 $this->assertSame(0, $INPUT->post->int('empty'));
143 $this->assertSame(42, $INPUT->post->int('none', 42));
144 $this->assertSame(0, $INPUT->post->int('zero', 42));
145 $this->assertSame(42, $INPUT->post->int('zero', 42, true));
147 $this->assertSame(false, $INPUT->get->int('post', false));
148 $this->assertSame(1, $INPUT->get->int('get', false));
150 $this->assertSame(0, $INPUT->int('array'));
152 $this->assertSame(0, $INPUT->int('zero', -1));
153 $this->assertSame(-1, $INPUT->int('empty', -1));
154 $this->assertSame(-1, $INPUT->int('zero', -1, true));
155 $this->assertSame(-1, $INPUT->int('empty', -1, true));
164 $INPUT = new Input();
166 $this->assertSame(array('foo', 'bar'), $INPUT->arr('array'));
167 $this->assertSame(array(), $INPUT->arr('none'));
168 $this->assertSame(array(), $INPUT->arr('empty'));
169 $this->assertSame(array(1, 2), $INPUT->arr('none', array(1, 2)));
170 $this->assertSame(array(), $INPUT->arr('emptya', array(1, 2)));
171 $this->assertSame(array(1, 2), $INPUT->arr('emptya', array(1, 2), true));
173 $this->assertSame(false, $INPUT->arr('get', false));
174 $this->assertSame(false, $INPUT->arr('post', false));
176 $this->assertSame(array('foo', 'bar'), $INPUT->post->arr('array'));
177 $this->assertSame(array(), $INPUT->post->arr('none'));
178 $this->assertSame(array(), $INPUT->post->arr('empty'));
179 $this->assertSame(array(1, 2), $INPUT->post->arr('none', array(1, 2)));
180 $this->assertSame(array(), $INPUT->post->arr('emptya', array(1, 2)));
181 $this->assertSame(array(1, 2), $INPUT->post->arr('emptya', array(1, 2), true));
183 $this->assertSame(false, $INPUT->post->arr('get', false));
184 $this->assertSame(array(1, 2), $INPUT->post->arr('post', false));
186 $this->assertSame(array('foo', 'bar'), $INPUT->get->arr('array'));
187 $this->assertSame(array(), $INPUT->get->arr('none'));
188 $this->assertSame(array(), $INPUT->get->arr('empty'));
189 $this->assertSame(array(1, 2), $INPUT->get->arr('none', array(1, 2)));
190 $this->assertSame(array(), $INPUT->get->arr('emptya', array(1, 2)));
191 $this->assertSame(array(1, 2), $INPUT->get->arr('emptya', array(1, 2), true));
193 $this->assertSame(array(1, 2), $INPUT->get->arr('get', false));
194 $this->assertSame(false, $INPUT->get->arr('post', false));
203 $INPUT = new Input();
205 $this->assertSame(true, $INPUT->bool('one'));
206 $this->assertSame(false, $INPUT->bool('zero'));
208 $this->assertSame(false, $INPUT->bool('get'));
209 $this->assertSame(false, $INPUT->bool('post'));
211 $this->assertSame(true, $INPUT->post->bool('one'));
212 $this->assertSame(false, $INPUT->post->bool('zero'));
214 $this->assertSame(false, $INPUT->post->bool('get'));
215 $this->assertSame(true, $INPUT->post->bool('post'));
217 $this->assertSame(false, $INPUT->bool('zero', -1));
218 $this->assertSame(-1, $INPUT->bool('empty', -1));
219 $this->assertSame(-1, $INPUT->bool('zero', -1, true));
220 $this->assertSame(-1, $INPUT->bool('empty', -1, true));
227 $INPUT = new Input();
229 $INPUT->remove('string');
234 $INPUT->post->remove('int');
244 $INPUT = new Input();
246 $INPUT->set('test','foo');
251 $INPUT->get->set('test2','foo');
261 $INPUT = new Input();
263 $test = &$INPUT->ref('string');
273 $INPUT = new Input();
276 $this->assertSame(null, $INPUT->valid('nope', $valids));
277 $this->assertSame('bang', $INPUT->valid('nope', $valids, 'bang'));
278 $this->assertSame(17, $INPUT->valid('int', $valids));
279 $this->assertSame('foo', $INPUT->valid('string', $valids));
280 $this->assertSame(null, $INPUT->valid('array', $valids));
283 $this->assertSame(true, $INPUT->valid('string', $valids));
284 $this->assertSame(true, $INPUT->valid('one', $valids));
285 $this->assertSame(null, $INPUT->valid('zero', $valids));
292 $INPUT = new Input();
294 $this->assertEquals('save', $INPUT->extract('do')->str('do'));
295 $this->assertEquals('', $INPUT->extract('emptya')->str('emptya'));
296 $this->assertEquals('foo', $INPUT->extract('string')->str('string'));
297 $this->assertEquals('foo', $INPUT->extract('array')->str('array'));
299 $this->assertEquals('save', $INPUT->post->extract('do')->str('do'));
300 $this->assertEquals('', $INPUT->post->extract('emptya')->str('emptya'));
301 $this->assertEquals('foo', $INPUT->post->extract('string')->str('string'));
302 $this->assertEquals('foo', $INPUT->post->extract('array')->str('array'));