This repository was archived by the owner on Feb 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +55
-2
lines changed
tests/src/classes/crm/company Expand file tree Collapse file tree 2 files changed +55
-2
lines changed Original file line number Diff line number Diff line change @@ -63,8 +63,10 @@ public function update($bitrix24CompanyId, $fields = array())
6363 {
6464 $ fullResult = $ this ->client ->call (
6565 'crm.company.update ' ,
66- array ('id ' => $ bitrix24CompanyId ),
67- array ('fields ' => $ fields )
66+ array (
67+ 'id ' => $ bitrix24CompanyId ,
68+ 'fields ' => $ fields ,
69+ )
6870 );
6971 return $ fullResult ;
7072 }
Original file line number Diff line number Diff line change 1+ <?php
2+ /*
3+ * This file is part of the bitrix24-php-sdk package.
4+ *
5+ * © Mesilov Maxim <mesilov.maxim@gmail.com>
6+ *
7+ * For the full copyright and license information, please view the LICENSE
8+ * file that was distributed with this source code.
9+ */
10+ namespace Bitrix24 \CRM ;
11+
12+ use Bitrix24 \CRM \Company ;
13+ use Bitrix24 \Contracts \iBitrix24 ;
14+
15+
16+ /**
17+ * @package Bitrix24
18+ */
19+ class CompanyTest extends \PHPUnit_Framework_TestCase
20+ {
21+ public function testUpdateCallsClientWithIdAndFields ()
22+ {
23+ $ testId = \md5 (\time ());
24+ $ testField = \md5 ($ testId );
25+ $ testFields = [
26+ $ testField => \md5 ($ testField ),
27+ ];
28+
29+ //silly mocking in PHPUnit 4.8
30+ $ methods = array ();
31+ $ ref = new \ReflectionClass ('Bitrix24 \\Contracts \\iBitrix24 ' );
32+ foreach ($ ref ->getMethods () as $ method ) {
33+ $ methods [] = $ method ->getName ();
34+ }
35+ $ client = $ this ->getMockBuilder ('Bitrix24 \\Contracts \\iBitrix24 ' )
36+ ->setMethods ($ methods )
37+ ->getMock ();
38+ $ client ->expects ($ this ->once ())
39+ ->method ('call ' )
40+ ->with (
41+ 'crm.company.update ' ,
42+ array (
43+ 'id ' => $ testId ,
44+ 'fields ' => $ testFields ,
45+ )
46+ );
47+
48+ $ company = new Company ($ client );
49+ $ company ->update ($ testId , $ testFields );
50+ }
51+ }
You can’t perform that action at this time.
0 commit comments