Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jan 25, 2024
1 parent 860b504 commit 786b2bc
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/TestCase/Database/Log/DebugLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,50 @@ public function testLog()
$this->assertSame(20.0, $this->logger->totalTime());
}

/**
* Test logs being stored.
*
* @return void
*/
public function testLogElastic()
{
$query = [

Check failure on line 76 in tests/TestCase/Database/Log/DebugLogTest.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Unused variable $query.

Check failure on line 76 in tests/TestCase/Database/Log/DebugLogTest.php

View workflow job for this annotation

GitHub Actions / cs-stan / Coding Standard & Static Analysis

Unused variable $query.
];

$this->assertCount(0, $this->logger->queries());

$this->logger->log(LogLevel::DEBUG, 'title:Good', [
'query' => 'title:Good',
'request' => [
'method' => 'GET',
'path' => '/articles/_search',
'data' => '',
],
'response' => [
'took' => 10,
'hits' => [
'total' => 15,
],
],
]);
$this->assertCount(1, $this->logger->queries());
$this->assertEquals(10, $this->logger->totalTime());

$this->logger->log(LogLevel::DEBUG, 'title:Best', [
'query' => 'title:Best',
'request' => [
'method' => 'GET',
'path' => '/articles/_search',
'data' => '',
],
'response' => [
'lol' => 'nope',
],
]);
$this->assertCount(2, $this->logger->queries());
$this->assertEquals(10, $this->logger->totalTime());
}

/**
* Test log ignores schema reflection
*
Expand Down

0 comments on commit 786b2bc

Please sign in to comment.