예제 #1
0
 public function testUniversalParamsWithFilter()
 {
     // Test data
     $params_get = array('page' => 2, 'per_page' => 10, 'num' => 1, 5 => 'ok', 'empty' => null, 'blank' => '');
     $params_post = array('first_name' => 'Trevor', 'last_name' => 'Suarez', 'num' => 2, 3 => 'hmm', 4 => 'thing');
     $cookies = array('user' => 'Rican7', 'PHPSESSID' => 'randomstring', 'num' => 3, 4 => 'dog');
     // Create our filter and expected results
     $filter = array('page', 'user', 'num', 'this-key-never-showed-up-anywhere');
     $expected = array('page' => 2, 'user' => 'Rican7', 'num' => 3, 'this-key-never-showed-up-anywhere' => null);
     // Create the request
     $request = new Request($params_get, $params_post, $cookies);
     $this->assertSame($expected, $request->params($filter));
 }