1 | <?php |
||
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 | } |