1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* integer_net Magento Module |
4
|
|
|
* |
5
|
|
|
* @category IntegerNet |
6
|
|
|
* @package IntegerNet_Anonymizer |
7
|
|
|
* @copyright Copyright (c) 2015 integer_net GmbH (http://www.integer-net.de/) |
8
|
|
|
* @author Fabian Schmengler <[email protected]> |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @group IntegerNet_Anonymizer |
13
|
|
|
*/ |
14
|
|
|
class IntegerNet_Anonymizer_Test_Model_Bridge_Entity_Customer |
15
|
|
|
extends IntegerNet_Anonymizer_Test_Model_Bridge_Entity_Abstract |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @param $customerId |
19
|
|
|
* @test |
20
|
|
|
* @dataProvider dataProvider |
21
|
|
|
* @dataProviderFile testCustomerBridge.yaml |
22
|
|
|
* @loadExpectation bridge.yaml |
23
|
|
|
* @loadFixture customers.yaml |
24
|
|
|
*/ |
25
|
|
|
public function testGetValues($customerId) |
26
|
|
|
{ |
27
|
|
|
/** @var IntegerNet_Anonymizer_Model_Bridge_Entity_Customer $bridge */ |
28
|
|
|
$bridge = Mage::getModel('integernet_anonymizer/bridge_entity_customer'); |
29
|
|
|
/** @var Mage_Customer_Model_Customer $customer */ |
30
|
|
|
$customer = $this->_loadEntityByCollection('entity_id', $customerId, $bridge); |
31
|
|
|
$expected = $this->expected('customer_%d', $customerId); |
32
|
|
|
|
33
|
|
|
$this->_testGetValues($bridge, $customer, $expected); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param $customerId |
38
|
|
|
* @test |
39
|
|
|
* @dataProvider dataProvider |
40
|
|
|
* @dataProviderFile testCustomerBridge.yaml |
41
|
|
|
* @loadFixture customers.yaml |
42
|
|
|
*/ |
43
|
|
|
public function testUpdateValues($customerId) |
44
|
|
|
{ |
45
|
|
|
static $changedEmail = '[email protected]', |
46
|
|
|
$changedMiddlename = 'trouble'; |
47
|
|
|
|
48
|
|
|
/** @var IntegerNet_Anonymizer_Model_Bridge_Entity_Customer $bridge */ |
49
|
|
|
$bridge = Mage::getModel('integernet_anonymizer/bridge_entity_customer'); |
50
|
|
|
|
51
|
|
|
$bridge->setRawData(array( |
52
|
|
|
'entity_id' => $customerId, |
53
|
|
|
'email' => $changedEmail, |
54
|
|
|
'middlename' => $changedMiddlename |
55
|
|
|
)); |
56
|
|
|
|
57
|
|
|
$this->_updateValues($bridge); |
58
|
|
|
|
59
|
|
|
$customer = Mage::getModel('customer/customer')->load($customerId); |
60
|
|
|
$this->assertEquals($changedMiddlename, $customer->getMiddlename()); |
61
|
|
|
$this->assertEquals($changedEmail, $customer->getEmail()); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
} |