Skip to content

Commit

Permalink
formatted code
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalkbrenner committed Jan 3, 2024
1 parent e5b9251 commit 9df8626
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Option `buildAll` for Suggesters
- NoResponseRequest Plugin

### Fixed
- PHP 8.2 deprecations for Solarium\QueryType\Server\Collections results

Expand Down
4 changes: 2 additions & 2 deletions src/Component/ComponentTraits/SuggesterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function getReload(): ?bool
*/
public function setBuildAll(bool $buildAll): SuggesterInterface
{
return $this->setOption('buildAll', $buildAll);
return $this->setOption('buildAll', $buildAll);
}

/**
Expand All @@ -155,6 +155,6 @@ public function setBuildAll(bool $buildAll): SuggesterInterface
*/
public function getBuildAll(): ?bool
{
return $this->getOption('buildAll');
return $this->getOption('buildAll');
}
}
16 changes: 8 additions & 8 deletions src/Plugin/NoResponseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,16 @@ public function preExecuteRequest($event): self
*/
public function postExecuteRequest($event): self
{
if ($this->client->getAdapter() instanceof TimeoutAwareInterface) {
// Restore the previous timeout.
$this->client->getAdapter()->setTimeout($this->getTimeout());
}
if ($this->client->getAdapter() instanceof TimeoutAwareInterface) {
// Restore the previous timeout.
$this->client->getAdapter()->setTimeout($this->getTimeout());
}

if ($this->client->getAdapter() instanceof Curl) {
$this->client->getAdapter()->setOption('return_transfer', true);
}
if ($this->client->getAdapter() instanceof Curl) {
$this->client->getAdapter()->setOption('return_transfer', true);
}

return $this;
return $this;
}

/**
Expand Down
5 changes: 2 additions & 3 deletions tests/Plugin/NoResponseRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Solarium\Core\Event\PostExecuteRequest;
use Solarium\Core\Event\PreExecuteRequest as PreExecuteRequestEvent;
use Solarium\Plugin\NoResponseRequest;
use Solarium\Plugin\PostBigRequest;
use Solarium\QueryType\Select\Query\Query;
use Solarium\Tests\Integration\TestClientFactory;

Expand Down Expand Up @@ -98,13 +97,13 @@ public function testExecuteRequest()
$this->assertSame($requestInput->getQueryString(), $requestOutput->getRawData());
$this->assertSame('', $requestOutput->getQueryString());
$this->assertSame(TimeoutAwareInterface::MINIMUM_TIMEOUT, $this->client->getAdapter()->getTimeout());
$this->assertSame(false, $this->client->getAdapter()->getOption('return_transfer'));
$this->assertFalse($this->client->getAdapter()->getOption('return_transfer'));

$event = new PostExecuteRequest($requestOutput, $endpoint, new Response('response'));
$this->plugin->preExecuteRequest($event);

$this->assertSame(TimeoutAwareInterface::DEFAULT_TIMEOUT, $this->client->getAdapter()->getTimeout());
$this->assertSame(true, $this->client->getAdapter()->getOption('return_transfer'));
$this->assertTrue($this->client->getAdapter()->getOption('return_transfer'));
}

public function testPluginIntegration()
Expand Down

0 comments on commit 9df8626

Please sign in to comment.