public function testGetVars() { $o = new PopulatedRequest(); $ExistingTaintedVars = array('module' => 'test', 'cucu' => 'mucu', 'height' => 143); $ExistingGetVars = array('cucu' => 'pasare', 'ana' => 'are', 'mere' => '', 'test' => 123); $ExistingPostVars = array('postone' => 'are', 'ana' => ''); $ExistingCookieVars = array('user' => 'asddsasdad234'); $ExistingVars = array(); $VarOrder = $o->getVarOrder(); foreach ($VarOrder as $sMethod) { switch ($sMethod) { case 'S': break; case 'C': $ExistingVars = array_merge($ExistingVars, $ExistingCookieVars); break; case 'P': $ExistingVars = array_merge($ExistingVars, $ExistingPostVars); break; case 'G': $ExistingVars = array_merge($ExistingVars, $ExistingGetVars); break; } } $this->assertEquals(array_merge($ExistingTaintedVars, $ExistingVars), $o->getVars()); }
public function testGetVarOrder() { $o = new PopulatedRequest(); $sOrder = ini_get('variables_order'); for ($i = 0; $i < 4; $i++) { // reversing the order $VarOrder[$i] = substr($sOrder, $i, 1); } $this->assertSame($VarOrder, $o->getVarOrder()); }