Test Failed
Push — master ( c1559b...0edaee )
by Mauro
02:36
created

LeadDataTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testMissingRequiredValues() 0 7 1
A testGettersAndSetters() 0 14 1
A missingRequiredValuesDataProvider() 0 9 1
1
<?php
2
3
namespace Zephia\PilotApiClient\Tests;
4
5
use Zephia\PilotApiClient\Exception\InvalidArgumentException;
6
use Zephia\PilotApiClient\Model\LeadData;
7
8
class LeadDataTest extends \PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @dataProvider      missingRequiredValuesDataProvider
12
     * @expectedException InvalidArgumentException
13
     */
14
    public function testMissingRequiredValues($data, $missing_value)
15
    {
16
        $this->expectExceptionMessage(
17
            'Missing required value: ' . $missing_value . '.'
18
        );
19
        new LeadData($data);
20
    }
21
22
    public function testGettersAndSetters()
23
    {
24
        $lead_data = new LeadData([
25
            'firstname' => 'Test',
26
            'contact_type_id' => 1,
27
            'business_type_id' => 1,
28
            'suborigin_id' => "FFFF0000",
29
        ]);
30
31
        $this->assertEquals('Test', $lead_data->getFirstname());
32
        $this->assertEquals(1, $lead_data->getContactTypeId());
33
        $this->assertEquals(1, $lead_data->getBusinessTypeId());
34
        $this->assertEquals('FFFF0000', $lead_data->getSuboriginId());
35
    }
36
37
    public function missingRequiredValuesDataProvider()
38
    {
39
        return [
40
            [[], 'firstname'],
41
            [['firstname' => 'Test'], 'contact_type_id'],
42
            [['firstname' => 'Test', 'contact_type_id' => 1], 'business_type_id'],
43
            [['firstname' => 'Test', 'contact_type_id' => 1, 'business_type_id' => 1], 'suborigin_id'],
44
        ];
45
    }
46
}