AppserverIo\Appserver\ServletEngine\Http\Request::hasParameter PHP Method

hasParameter() public method

Queries whether the request contains a parameter or not.
public hasParameter ( string $name ) : boolean
$name string The name of the param we're query for
return boolean TRUE if the parameter is available, else FALSE
    public function hasParameter($name)
    {
        return $this->getHttpRequest()->hasParam($name);
    }

Usage Example

Beispiel #1
0
 /**
  * Tests has non existing parameter on HTTP request instance.
  *
  * @return void
  */
 public function testHasParameterWhenNonExists()
 {
     // initialize the mock HTTP request
     $mockRequest = $this->getMock('AppserverIo\\Http\\HttpRequest');
     $mockRequest->expects($this->any())->method('hasParam')->will($this->returnValue(false));
     // inject the mock HTTP request
     $this->request->injectHttpRequest($mockRequest);
     // check for an non existing parameter
     $this->assertFalse($this->request->hasParameter('unknown'));
 }