File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
tests/src/classes/crm/company Expand file tree Collapse file tree 1 file changed +50
-0
lines changed 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 <[email protected] > 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+ * @package Bitrix24
17+ */
18+ class CompanyTest extends \PHPUnit_Framework_TestCase
19+ {
20+ public function testUpdateCallsClientWithIdAndFields ()
21+ {
22+ $ testId = \md5 (\time ());
23+ $ testField = \md5 ($ testId );
24+ $ testFields = [
25+ $ testField => \md5 ($ testField ),
26+ ];
27+
28+ //silly mocking in PHPUnit 4.8
29+ $ methods = array ();
30+ $ ref = new \ReflectionClass (iBitrix24::class);
31+ foreach ($ ref ->getMethods () as $ method ) {
32+ $ methods [] = $ method ->getName ();
33+ }
34+ $ client = $ this ->getMockBuilder (iBitrix24::class)
35+ ->setMethods ($ methods )
36+ ->getMock ();
37+ $ client ->expects ($ this ->once ())
38+ ->method ('call ' )
39+ ->with (
40+ 'crm.company.update ' ,
41+ array (
42+ 'id ' => $ testId ,
43+ 'fields ' => $ testFields ,
44+ )
45+ );
46+
47+ $ company = new Company ($ client );
48+ $ company ->update ($ testId , $ testFields );
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments