Пример #1
0
 /**
  * @covers \vsc\presentation\requests\RawHttpRequest::hasRawVar()
  * @covers \vsc\presentation\requests\RawHttpRequest::hasVar()
  * @covers \vsc\presentation\requests\RawHttpRequest::constructRawVars()
  */
 public function testHasVarJsonData()
 {
     $o = new PopulatedRawRequest();
     $testVal = array();
     $testVal['ana'] = 'mere';
     $testVal['gigel'] = 'pere';
     $testVal['random'] = uniqid('test:');
     $o->setContentType('application/json');
     $o->constructRawVars(json_encode($testVal));
     $this->assertTrue($o->hasRawVar('ana'));
     $this->assertTrue($o->hasVar('ana'));
     $this->assertTrue($o->hasRawVar('gigel'));
     $this->assertTrue($o->hasVar('gigel'));
     $this->assertTrue($o->hasRawVar('random'));
     $this->assertTrue($o->hasVar('random'));
     $testVal = new \stdClass();
     $testVal->ana = 'mere';
     $testVal->gigel = 'pere';
     $testVal->random = uniqid('test:');
     $o->setContentType('application/json');
     $o->constructRawVars(json_encode($testVal));
     $this->assertTrue($o->hasRawVar('ana'));
     $this->assertTrue($o->hasVar('ana'));
     $this->assertTrue($o->hasRawVar('gigel'));
     $this->assertTrue($o->hasVar('gigel'));
     $this->assertTrue($o->hasRawVar('random'));
     $this->assertTrue($o->hasVar('random'));
 }
Пример #2
0
 /**
  * @covers \vsc\presentation\requests\RawHttpRequest::getRawVar()
  * @covers \vsc\presentation\requests\RawHttpRequest::constructRawVars()
  */
 public function testGetRawVarsJsonData()
 {
     $o = new PopulatedRawRequest();
     $testVal = array();
     $testVal['ana'] = 'mere';
     $testVal['gigel'] = 'pere';
     $testVal['random'] = uniqid('test:');
     $o->setContentType('application/json');
     $o->constructRawVars(json_encode($testVal));
     $aRawVars = $o->getRawVars();
     $this->assertEquals($testVal, $aRawVars);
     $this->assertEquals($testVal['ana'], $aRawVars['ana']);
     $this->assertEquals($testVal['gigel'], $aRawVars['gigel']);
     $this->assertEquals($testVal['random'], $aRawVars['random']);
 }