You are here

public function LogsTest::testLogSearchAndGetById in Auth0 Single Sign On 8.2

Test a general search.

Return value

void

File

vendor/auth0/auth0-php/tests/API/Management/LogsTest.php, line 53

Class

LogsTest
Class LogsTest. Tests the Auth0\SDK\API\Management\Logs class.

Namespace

Auth0\Tests\API

Code

public function testLogSearchAndGetById() {
  $search_results = self::$api
    ->search([
    'fields' => '_id,log_id,date',
    'include_fields' => true,
  ]);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertNotEmpty($search_results);
  $this
    ->assertNotEmpty($search_results[0]['_id']);
  $this
    ->assertNotEmpty($search_results[0]['log_id']);
  $this
    ->assertNotEmpty($search_results[0]['date']);
  $this
    ->assertCount(3, $search_results[0]);

  // Test getting a single log result with a valid ID from above.
  $one_log = self::$api
    ->get($search_results[0]['log_id']);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertNotEmpty($one_log);
  $this
    ->assertEquals($search_results[0]['log_id'], $one_log['log_id']);
}