Test Failed
Branch master (9acec7)
by Agel_Nash
02:25
created

apiAbstract   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A mockMODxAPI() 0 17 1
A mockModUsers() 0 5 1
A setUp() 0 4 1
1
<?php namespace DocLister\Tests\MODxAPI;
2
3
use DocLister\Tests\ModxAbstract;
4
5
abstract class apiAbstract extends ModxAbstract
6
{
7
    /** @var \MODxAPI */
8
    protected $api = null;
9
10
    public function setUp()
11
    {
12
        parent::setUp();
13
        $this->api = $this->mockMODxAPI();
14
    }
15
16
    protected function mockMODxAPI()
17
    {
18
        /** @var \MODxAPI|\PHPUnit_Framework_MockObject_MockObject $api */
19
        $api = $this->getMockForAbstractClass('MODxAPI', array($this->modx));
20
        $api->expects($this->any())
21
            ->method('edit')
22
            ->will($this->returnValue($api));
23
24
        $api->expects($this->any())
25
            ->method('save')
26
            ->will($this->returnValue($api->getID())); //$this->id || false
27
28
        $api->expects($this->any())
29
            ->method('delete')
30
            ->will($this->returnValue(true));
31
32
        return $api;
33
    }
34
35
    protected function mockModUsers()
36
    {
37
        $obj = $this->getMock('modUsers', null, array($this->modx));
38
39
        return $obj;
40
    }
41
}