예제 #1
0
 public function testFetchParams()
 {
     $_GET['foo'] = 'bar';
     $ff = new FortissimoHarness(self::config);
     $ff->setParams(array('foo' => 'bar'), 'get');
     $bar = $ff->fetchParam('get:foo');
     $this->assertEquals('bar', $bar, 'GET test');
     $bar = $ff->fetchParam('g:foo');
     $this->assertEquals('bar', $bar, 'GET test');
     $bar = $ff->fetchParam('GET:foo');
     $this->assertEquals('bar', $bar, 'GET test');
     $ff->setParams(array('foo' => 'bar'), 'post');
     $bar = $ff->fetchParam('post:foo');
     $this->assertEquals('bar', $bar, 'POST test');
     $ff->setParams(array('foo' => 'bar'), 'cookie');
     $bar = $ff->fetchParam('cookie:foo');
     $this->assertEquals('bar', $bar, 'Cookie test');
     $ff->setParams(array('foo2' => 'bar2'), 'get');
     $bar = $ff->fetchParam('request:foo2');
     $this->assertEquals('bar2', $bar, 'Reqest test');
     $ff->setParams(array('foo3' => 'bar2'), 'post');
     $bar = $ff->fetchParam('request:foo3');
     $this->assertEquals('bar2', $bar, 'Reqest test');
     $bar = $ff->fetchParam('request:noSuchThing');
     $this->assertNull($bar, 'Test miss');
     $bar = $ff->fetchParam('get:noSuchThing');
     $this->assertNull($bar, 'Test miss');
 }