/** * Returns the query string parsed as an array * * @return array */ public function getGet() { // Lazy instantiation if (!isset($this->get)) { $parser = new \r8\QueryParser(); $data = $parser->parse($this->server['QUERY_STRING']); $this->get = new \r8\Input\Reference($data); } return $this->get; }
public function testParse_filters() { $keyFilter = $this->getMock('r8\\iface\\Filter', array('filter')); $keyFilter->expects($this->once())->method('filter')->with($this->equalTo('key[sub]'))->will($this->returnValue('newKey')); $valFilter = $this->getMock('r8\\iface\\Filter', array('filter')); $valFilter->expects($this->once())->method('filter')->with($this->equalTo('value'))->will($this->returnValue('newVal')); $parser = new \r8\QueryParser(); $parser->setKeyFilter($keyFilter); $parser->setValueFilter($valFilter); $this->assertSame(array("newKey" => "newVal"), $parser->parse("key[sub]=value")); }