|
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
|
|
|
} |