Example #1
0
 /**
  * Tests setting request data.
  *
  * @dataProvider setProvider
  * @covers empire\framework\request\Request::set#
  *
  * @param string $name the name of the GET/POST variable to get
  * @param string $method the method
  * @param string $type the data type
  * @param string $regex a regular expression
  * @param boolean $success whether the set operation should succeed
  */
 public function testSet($name, $value, $method, $type, $regex, $success)
 {
     $this->resetGetPost();
     $this->request->set($name, $value, $method, $type, $regex);
     switch ($method) {
         case INPUT_GET:
             $src =& $_GET;
             break;
         case INPUT_POST:
             $src =& $_POST;
             break;
     }
     if ($success) {
         $expected = $type === Request::TYPE_OBJECT ? base64_encode(serialize($value)) : $value;
         $this->assertSame($expected, $src[$name]);
     } else {
         $this->assertFalse(isset($src[$name]));
     }
 }