Passed
Pull Request — master (#9)
by Quang
02:16
created

ServiceTest::testGetProcessor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\Lumen\GraphQL\Tests;
4
5
use Digia\Lumen\GraphQL\Execution\Processor;
6
use Digia\Lumen\GraphQL\GraphQLService;
7
use Youshido\GraphQL\Schema\Schema;
8
use \Illuminate\Cache\Repository;
9
10
class ServiceTest extends TestCase
11
{
12
    /**
13
     * @var GraphQLService
14
     */
15
    protected $service;
16
17
    /**
18
     * @var Repository
19
     */
20
    protected $cache;
21
22
    /**
23
     * @var Processor
24
     */
25
    protected $processor;
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function setUp()
31
    {
32
        $this->cache = $this->getMockBuilder(\Illuminate\Cache\Repository::class)
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(Il...onstructor()->getMock() of type PHPUnit_Framework_MockObject_MockObject is incompatible with the declared type Illuminate\Cache\Repository of property $cache.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
33
                             ->disableOriginalConstructor()
34
                             ->getMock();
35
36
        $this->processor = new Processor(new Schema());
37
        $this->service = new GraphQLService($this->processor, $this->cache);
38
    }
39
40
41
    public function testGetProcessor()
42
    {
43
        $this->cache->expects($this->any())
44
                     ->method('get')
45
                     ->with(GraphQLService::PROCESSOR_CACHE_KEY)
46
                     ->willReturn($this->processor);
47
48
        $this->assertEquals($this->processor, $this->service->getProcessor());
49
    }
50
51
}
52