2021-07-07 13:14:06 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class RetailcrmToolsTest extends RetailcrmTestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @dataProvider equalCustomerAddresses
|
|
|
|
*/
|
|
|
|
public function testIsEqualCustomerAddress($address1, $address2, $result)
|
|
|
|
{
|
|
|
|
$this->assertEquals($result, RetailcrmTools::isEqualCustomerAddress($address1, $address2));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function equalCustomerAddresses()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'Equal addresses' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
true,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'Changed phone' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '222'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
false,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'Changed index' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '222',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
false,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'Reduced address' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
false,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'Expanded address' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
false,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'Reduced phone' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
|
|
|
['number' => '222'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
false,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'Expanded phone' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
|
|
|
['number' => '222'],
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
false,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'Replaced field' => [
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'text' => 'Address line 1 (client Address 2)',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'phones' => [
|
2021-11-03 16:19:39 +07:00
|
|
|
['number' => '111'],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
'address' => [
|
|
|
|
'index' => '398055',
|
|
|
|
'city' => 'Order City here',
|
|
|
|
'region' => 'Region',
|
2021-11-03 16:19:39 +07:00
|
|
|
],
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
2021-11-03 16:19:39 +07:00
|
|
|
false,
|
2021-07-07 13:14:06 +03:00
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
2021-11-03 16:19:39 +07:00
|
|
|
}
|