Passed
Pull Request — master (#172)
by David
02:56
created

ManyToOneDataLoaderTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 6
c 1
b 0
f 0
dl 0
loc 10
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGet() 0 8 1
1
<?php
2
3
namespace TheCodingMachine\TDBM\QueryFactory\SmartEagerLoad;
4
5
use Doctrine\DBAL\Connection;
6
use PHPUnit\Framework\TestCase;
7
use TheCodingMachine\TDBM\TDBMException;
8
9
class ManyToOneDataLoaderTest extends TestCase
10
{
11
    public function testGet()
12
    {
13
        $connection = $this->createMock(Connection::class);
14
        $connection->method('fetchAll')->willReturn([]);
0 ignored issues
show
Bug introduced by
The method method() does not exist on PHPUnit\Framework\MockObject\MockObject. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        $connection->/** @scrutinizer ignore-call */ 
15
                     method('fetchAll')->willReturn([]);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
15
        $dataLoader = new ManyToOneDataLoader($connection, 'SELECT * FROM users', 'id');
16
17
        $this->expectException(TDBMException::class);
18
        $dataLoader->get('42');
19
    }
20
}
21