_plugin = new Solarium_Plugin_PostBigRequest(); $this->_client = new Solarium_Client(); $this->_query = $this->_client->createSelect(); } public function testSetAndGetMaxQueryStringLength() { $this->_plugin->setMaxQueryStringLength(512); $this->assertEquals(512, $this->_plugin->getMaxQueryStringLength()); } public function testPostCreateRequest() { // create a very long query $fq = ''; for($i=1; $i<=1000; $i++) { $fq .= ' OR price:'.$i; } $fq = substr($fq, 4); $this->_query->createFilterQuery('fq')->setQuery($fq); $requestOutput = $this->_client->createRequest($this->_query); $requestInput = clone $requestOutput; $this->_plugin->postCreateRequest($this->_query, $requestOutput); $this->assertEquals(Solarium_Client_Request::METHOD_GET, $requestInput->getMethod()); $this->assertEquals(Solarium_Client_Request::METHOD_POST, $requestOutput->getMethod()); $this->assertEquals($requestInput->getQueryString(), $requestOutput->getRawData()); $this->assertEquals('', $requestOutput->getQueryString()); } public function testPostCreateRequestUnalteredSmallRequest() { $requestOutput = $this->_client->createRequest($this->_query); $requestInput = clone $requestOutput; $this->_plugin->postCreateRequest($this->_query, $requestOutput); $this->assertEquals($requestInput, $requestOutput); } public function testPostCreateRequestUnalteredPostRequest() { $query = $this->_client->createUpdate(); $query->addDeleteById(1); $requestOutput = $this->_client->createRequest($query); $requestInput = clone $requestOutput; $this->_plugin->postCreateRequest($query, $requestOutput); $this->assertEquals($requestInput, $requestOutput); } }