-
Notifications
You must be signed in to change notification settings - Fork 178
/
ClockworkLoggerTest.php
34 lines (27 loc) · 1.05 KB
/
ClockworkLoggerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
use Clockwork\Clockwork;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManagerInterface;
use LaravelDoctrine\ORM\Loggers\ClockworkLogger;
use Mockery as m;
class ClockworkLoggerTest extends PHPUnit_Framework_TestCase
{
public function test_can_register()
{
$clockwork = m::mock(Clockwork::class);
$em = m::mock(EntityManagerInterface::class);
$configuration = m::mock(Configuration::class);
$connection = m::mock(Connection::class);
$driver = m::mock(Driver::class);
$em->shouldReceive('getConnection')->andReturn($connection);
$connection->shouldReceive('getDriver')->andReturn($driver);
$driver->shouldReceive('getName')->andReturn('mysql');
$configuration->shouldReceive('setSQLLogger')
->once();
$clockwork->shouldReceive('addDataSource')->once();
$logger = new ClockworkLogger($clockwork);
$logger->register($em, $configuration);
}
}