You are here

public function RequestBuilderTest::testThatBooleanFormParamsAreAdded in Auth0 Single Sign On 8.2

File

vendor/auth0/auth0-php/tests/API/Helpers/RequestBuilderTest.php, line 83

Class

RequestBuilderTest
Class RequestBuilderTest Tests the Auth0\SDK\API\Helpers\RequestBuilder class.

Namespace

Auth0\Tests\API

Code

public function testThatBooleanFormParamsAreAdded() {
  $history = [];
  $mock = new MockHandler([
    new Response(200),
    new Response(200),
  ]);
  $handler = HandlerStack::create($mock);
  $handler
    ->push(Middleware::history($history));
  $builder = new RequestBuilder([
    'domain' => 'api.test.local',
    'method' => 'post',
    'returnType' => 'object',
    'guzzleOptions' => [
      'handler' => $handler,
    ],
  ]);
  $builder
    ->addFormParam('test', true);
  $builder
    ->call();
  $this
    ->assertEquals('test=true', $history[0]['request']
    ->getBody());
  $builder
    ->addFormParam('test', false);
  $builder
    ->call();
  $this
    ->assertEquals('test=false', $history[1]['request']
    ->getBody());
}