Completed
Pull Request — master (#38)
by
unknown
01:07
created

FinalizeTest::provider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Communibase;
4
5
/**
6
 * @package Communibase
7
 * @author Kingsquare ([email protected])
8
 * @copyright Copyright (c) Kingsquare BV (http://www.kingsquare.nl)
9
 */
10
class FinalizeTest extends \PHPUnit_Framework_TestCase
11
{
12
    /**
13
     * @return array
14
     */
15
    public function provider()
16
    {
17
        return [
18
            ['Person', true],
19
            ['Invoice', false],
20
        ];
21
    }
22
23
    /**
24
     * @dataProvider provider
25
     *
26
     * @param string $entityType
27
     * @param string $expectException
28
     *
29
     * @throws Exception
30
     */
31
    public function testFinalizeCallIsPossibleForInvoiceOnly($entityType, $expectException)
32
    {
33
        /** @var Connector $stub */
34
        $stub = $this->getMockBuilder(Connector::class)
35
            ->setMethods(['doPost'])
36
            ->disableOriginalConstructor()
37
            ->getMock();
38
39
        if ($expectException) {
40
            $this->setExpectedException(Exception::class, 'Cannot call finalize on Person');
41
        }
42
43
        $stub->finalize($entityType, 'id');
44
    }
45
}
46