You are here

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

File

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

Class

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

Namespace

Auth0\Tests\API

Code

public function testParams() {
  $builder = self::getUrlBuilder('/api');

  // Adding a parameter array should be reflected in the RequestBuilder object.
  $builder
    ->withParams([
    [
      'key' => 'param1',
      'value' => 'value4',
    ],
    [
      'key' => 'param3',
      'value' => 'value3',
    ],
  ]);
  $this
    ->assertEquals('?param1=value4&param3=value3', $builder
    ->getParams());

  // Adding a parameter dictionary should be reflected in the RequestBuilder object.
  $builder
    ->withDictParams([
    'param4' => 'value4',
    'param2' => 'value5',
  ]);
  $this
    ->assertEquals('?param1=value4&param3=value3&param4=value4&param2=value5', $builder
    ->getParams());
}