RefactorPriorityQueryUnitTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute_should_limit_the_query_if_its_given() 0 9 1
A dataProviderFor_execute_should_limit_the_query_if_its_given() 0 7 1
1
<?php
2
3
namespace Hgraca\Phorensic\Test\Analyser\Query;
4
5
use Hgraca\Phorensic\Analyser\Query\RefactorPriorityQuery;
6
use Hgraca\Phorensic\SharedKernel\Port\Database\DatabaseClientInterface;
7
use Mockery;
8
use PHPUnit_Framework_TestCase;
9
10
final class RefactorPriorityQueryUnitTest extends PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @test
14
     *
15
     * @small
16
     *
17
     * @dataProvider dataProviderFor_execute_should_limit_the_query_if_its_given
18
     */
19
    public function execute_should_limit_the_query_if_its_given(string $limit = null, string $expectedSQL)
20
    {
21
        $dbClientMock = Mockery::mock(DatabaseClientInterface::class);
22
        $dbClientMock->shouldReceive('executeQuery')->once()->with($expectedSQL);
23
24
        $refactorPriorityQuery = new RefactorPriorityQuery($dbClientMock);
25
26
        $refactorPriorityQuery->execute($limit);
27
    }
28
29
    public function dataProviderFor_execute_should_limit_the_query_if_its_given(): array
30
    {
31
        return [
32
            [$limit = 30, RefactorPriorityQuery::SQL . " LIMIT $limit"],
33
            [null, RefactorPriorityQuery::SQL],
34
        ];
35
    }
36
}
37