-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serialize boolean query string params as strings (#273)
Signed-off-by: Kim Pepper <[email protected]>
- Loading branch information
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenSearch\Tests; | ||
|
||
use GuzzleHttp\Psr7\HttpFactory; | ||
use OpenSearch\RequestFactory; | ||
use OpenSearch\Serializers\SerializerInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Tests the request factory. | ||
* | ||
* @coversDefaultClass \OpenSearch\RequestFactory | ||
*/ | ||
class RequestFactoryTest extends TestCase | ||
{ | ||
public function testBoolean(): void | ||
{ | ||
$httpFactory = new HttpFactory(); | ||
$serializer = $this->createMock(SerializerInterface::class); | ||
|
||
$factory = new RequestFactory($httpFactory, $httpFactory, $httpFactory, $serializer); | ||
|
||
$params = ['foo' => true, 'bar' => false]; | ||
$request = $factory->createRequest('GET', 'http://localhost:9200/_search', $params); | ||
|
||
$this->assertEquals('bar=false&foo=true', $request->getUri()->getQuery()); | ||
} | ||
} |