Skip to content

Commit

Permalink
add test for Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaicher committed Sep 22, 2023
1 parent 7f67ece commit c7d7991
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/LoggerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Nelmio\SolariumBundle\Tests;

use Nelmio\SolariumBundle\Logger;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Solarium\Core\Client\Endpoint;
use Solarium\Core\Client\Request;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Stopwatch\Stopwatch;

class LoggerTest extends TestCase
{
public function testLog()
{
$logger = new Logger();
$logger->setLogger(new NullLogger());
$logger->setStopwatch(new Stopwatch());

$logger->log(new Request(), null, $this->createMock(Endpoint::class), 0);
$logger->collect(new SymfonyRequest(), new Response());

$this->assertSame(1, $logger->getQueryCount());
$this->assertCount(1, $logger->getQueries());
}
}

0 comments on commit c7d7991

Please sign in to comment.