Phalcon\Test\Unit\Http\RequestTest::testRequestGetValueByUsingSeveralMethods PHP Method

testRequestGetValueByUsingSeveralMethods() public method

    public function testRequestGetValueByUsingSeveralMethods()
    {
        $request = $this->getRequestObject();
        $_REQUEST = $_GET = $_POST = ['string' => 'hello', 'array' => ['string' => 'world']];
        // get
        $this->assertEquals('hello', $request->get('string', 'string'));
        $this->assertEquals('hello', $request->get('string', 'string', null, true, true));
        $this->assertEquals(['string' => 'world'], $request->get('array', 'string'));
        $this->assertEquals(null, $request->get('array', 'string', null, true, true));
        // getQuery
        $this->assertEquals('hello', $request->getQuery('string', 'string'));
        $this->assertEquals('hello', $request->getQuery('string', 'string', null, true, true));
        $this->assertEquals(['string' => 'world'], $request->getQuery('array', 'string'));
        $this->assertEquals(null, $request->getQuery('array', 'string', null, true, true));
        // getPost
        $this->assertEquals('hello', $request->getPost('string', 'string'));
        $this->assertEquals('hello', $request->getPost('string', 'string', null, true, true));
        $this->assertEquals(['string' => 'world'], $request->getPost('array', 'string'));
        $this->assertEquals(null, $request->getPost('array', 'string', null, true, true));
    }