You are here

public function ConnectionsTestMocked::testThatConnectionsGetAllIncludesFields in Auth0 Single Sign On 8.2

Test a getAll request with included fields.

Return value

void

Throws

\Exception Unsuccessful HTTP call.

File

vendor/auth0/auth0-php/tests/API/Management/ConnectionsMockedTest.php, line 101

Class

ConnectionsTestMocked
Class ConnectionsTestMocked.

Namespace

Auth0\Tests\API\Management

Code

public function testThatConnectionsGetAllIncludesFields() {
  $api = new MockManagementApi([
    new Response(200, self::$headers),
    new Response(200, self::$headers),
  ]);
  $strategy = null;
  $fields = [
    'id',
    'name',
  ];
  $api
    ->call()
    ->connections()
    ->getAll($strategy, $fields);
  $this
    ->assertEquals('GET', $api
    ->getHistoryMethod());
  $this
    ->assertStringStartsWith('https://api.test.local/api/v2/connections', $api
    ->getHistoryUrl());
  $this
    ->assertContains('fields=' . implode(',', $fields), $api
    ->getHistoryQuery());
  $this
    ->assertNotContains('include_fields=true', $api
    ->getHistoryQuery());

  // Test an explicit true for includeFields.
  $include_fields = true;
  $api
    ->call()
    ->connections()
    ->getAll($strategy, $fields, $include_fields);
  $this
    ->assertContains('include_fields=true', $api
    ->getHistoryQuery());
}