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

ManyToOneDataLoaderTest::testGet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 0
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