forked from mautic/mautic
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CompanyModelTest.php
56 lines (48 loc) · 1.46 KB
/
CompanyModelTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/*
* @copyright 2017 Mautic Contributors. All rights reserved
* @author Mautic, Inc.
*
* @link https://mautic.org
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
namespace Mautic\LeadBundle\Tests\Model;
use Mautic\LeadBundle\Entity\Company;
use Mautic\LeadBundle\Model\CompanyModel;
class CompanyModelTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox Ensure that an array value is flattened before saving
*
* @covers \Mautic\CoreBundle\Helper\AbstractFormFieldHelper::parseList
*/
public function testArrayValueIsFlattenedBeforeSave()
{
/** @var CompanyModel $companyModel */
$companyModel = $this->getMockBuilder(CompanyModel::class)
->disableOriginalConstructor()
->onlyMethods([])
->getMock();
$company = new Company();
$company->setFields(
[
'core' => [
'multiselect' => [
'type' => 'multiselect',
'alias' => 'multiselect',
'value' => 'abc|123',
],
],
]
);
$companyModel->setFieldValues($company, ['multiselect' => ['abc', 'def']]);
$updatedFields = $company->getUpdatedFields();
$this->assertEquals(
[
'multiselect' => 'abc|def',
],
$updatedFields
);
}
}