Completed
Push — master ( 0edaee...7079ed )
by Mauro
04:30
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
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
            'phone' => '123456',
27
            'contact_type_id' => 1,
28
            'business_type_id' => 1,
29
            'suborigin_id' => "FFFF0000",
30
        ]);
31
32
        $this->assertEquals('Test', $lead_data->getFirstname());
33
        $this->assertEquals(1, $lead_data->getContactTypeId());
34
        $this->assertEquals(1, $lead_data->getBusinessTypeId());
35
        $this->assertEquals('FFFF0000', $lead_data->getSuboriginId());
36
    }
37
38
    public function missingRequiredValuesDataProvider()
39
    {
40
        return [
41
            [[], 'firstname'],
42
            [['firstname' => 'Test'], 'phone'],
43
            [['firstname' => 'Test', 'phone' => '123456'], 'contact_type_id'],
44
            [['firstname' => 'Test', 'phone' => '123456', 'contact_type_id' => 1], 'business_type_id'],
45
            [['firstname' => 'Test', 'phone' => '123456', 'contact_type_id' => 1, 'business_type_id' => 1], 'suborigin_id'],
46
        ];
47
    }
48
}