You are here

public function RulesTest::testGetWithFields in Auth0 Single Sign On 8.2

Test that get methods respect fields.

Return value

void

Throws

CoreException Thrown when there is a problem with parameters passed to the method.

\Exception Thrown by the HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/tests/API/Management/RulesTest.php, line 106

Class

RulesTest
Class RulesTest.

Namespace

Auth0\Tests\API\Management

Code

public function testGetWithFields() {
  $api = new Management(self::$env['API_TOKEN'], self::$env['DOMAIN']);
  $fields = [
    'id',
    'name',
  ];
  $fields_results = $api
    ->rules()
    ->getAll(null, $fields, true);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertNotEmpty($fields_results);
  $this
    ->assertCount(count($fields), $fields_results[0]);
  $get_rule_id = $fields_results[0]['id'];
  $fields_result = $api
    ->rules()
    ->get($get_rule_id, $fields, true);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertNotEmpty($fields_result);
  $this
    ->assertCount(count($fields), $fields_result);
}