Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit e80603b

Browse files
authored
Merge pull request #257 from mesilov/dev
Dev
2 parents 6b6392b + 228f7f4 commit e80603b

File tree

88 files changed

+4088
-535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+4088
-535
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Integration tests"
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'dev'
8+
- '2.x'
9+
paths:
10+
- 'src/**'
11+
- 'tests/**'
12+
13+
env:
14+
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
15+
BITRIX24_PHP_SDK_PLAYGROUND_WEBHOOK: ${{ secrets.BITRIX24_PHP_SDK_PLAYGROUND_WEBHOOK }}
16+
jobs:
17+
tests:
18+
name: "Integration tests"
19+
20+
runs-on: ubuntu-latest
21+
22+
strategy:
23+
matrix:
24+
php-version:
25+
- "7.4"
26+
dependencies: [ highest ]
27+
28+
steps:
29+
- name: "Checkout"
30+
uses: "actions/checkout@v2"
31+
32+
- name: "Install PHP"
33+
uses: "shivammathur/setup-php@v2"
34+
with:
35+
coverage: "none"
36+
php-version: "${{ matrix.php-version }}"
37+
38+
- name: "Install dependencies"
39+
run: |
40+
composer update ${{ env.COMPOSER_FLAGS }}
41+
42+
- name: "run unit tests"
43+
run: "composer phpunit-run-integration-tests"

.github/workflows/phpstan.yml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,39 @@ on:
55
name: PHPStan checks
66

77
jobs:
8-
phpstan:
9-
name: PHPStan
8+
static-analysis:
9+
name: "PHPStan"
10+
runs-on: "ubuntu-latest"
1011

11-
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php-version:
16+
- "7.4"
17+
- "8.0"
18+
dependencies:
19+
- "lowest"
20+
- "highest"
1221

1322
steps:
1423
- name: "Checkout"
15-
uses: actions/checkout@v2
24+
uses: "actions/checkout@v2"
1625

17-
- name: PHPStan
18-
uses: docker://oskarstark/phpstan-ga
26+
- name: "Install PHP"
27+
uses: "shivammathur/setup-php@v2"
1928
with:
20-
args: analyse
29+
coverage: "none"
30+
php-version: "${{ matrix.php-version }}"
31+
extensions: mbstring
32+
tools: composer:v2
33+
34+
- name: "Install lowest dependencies"
35+
if: ${{ matrix.dependencies == 'lowest' }}
36+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
37+
38+
- name: "Install highest dependencies"
39+
if: ${{ matrix.dependencies == 'highest' }}
40+
run: "composer update --no-interaction --no-progress --no-suggest"
41+
42+
- name: "PHPStan"
43+
run: "composer phpstan-analyse"

.github/workflows/phpunit.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,5 @@ jobs:
3333
run: |
3434
composer update ${{ env.COMPOSER_FLAGS }}
3535
36-
- name: "Run tests"
37-
run: "composer exec phpunit -- --verbose"
38-
39-
- name: Run test suite
40-
run: composer run-script unit-tests
36+
- name: "run unit tests"
37+
run: "composer phpunit-run-unit-tests"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ composer.lock
55
.phpunit.result.cache
66
tools/.env.local
77
tools/logs
8-
examples/logs
8+
examples/logs
9+
.env.local

CHANGELOG.md

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,68 @@
11
# bitrix24-php-sdk change log
22

3-
## 2.0-alpha.3(14.11.2021)
3+
## 2.0-alpha.6 — 20.01.2021
4+
5+
### Added
6+
7+
* add «fast» batch-query without counting elements in result
8+
recordset [Добавить поддержку выгрузки большого количества данных без подсчёта элементов (-1](https://github.com/mesilov/bitrix24-php-sdk/issues/248)
9+
* add method `Core\Batch::deleteEntityItems` for delete items in batch mode and integration test
10+
* add integration test for read strategy `FilterWithBatchWithoutCountOrderTest`
11+
* add type check in method `Core\Batch::deleteEntityItems` - only integer id allowed
12+
* add interface `Core\Contracts\DeletedItemResultInterface`
13+
* add in scope «CRM» `Services\CRM\Deal\Service\Batch::delete` batch delete deals
14+
* add `symfony/stopwatch` component for integration tests
15+
* add `/Infrastructure/HttpClient/TransportLayer/NetworkTimingsParser` for parse `curl_info` network data structures for debug logs
16+
in `Bitrix24\SDK\Core\Response::__destruct()`
17+
* add `/Infrastructure/HttpClient/TransportLayer/ResponseInfoParser` for parse `bitrix24_rest_api` timing info for debug logs
18+
in `Bitrix24\SDK\Core\Response::__destruct()`
19+
* add `Bitrix24\SDK\Core\BulkItemsReader` for data-intensive applications for bulk export data from Bitrix24, read strategies located in
20+
folder `ReadStrategies`, in services read model **must** use most effective read strategy.
21+
22+
### Changed
23+
24+
* switch `symfony/http-client` to `5.4.*` version requirement.
25+
* switch `symfony/http-client-contracts` to `^2.5` version requirement.
26+
* switch `symfony/event-dispatcher` to `5.4.*` version requirement.
27+
* switch `ramsey/uuid` to `^4.2.3` version requirement.
28+
29+
## 2.0-alpha.5 – 28.11.2021
30+
31+
### Added
32+
33+
* add method `countByFilter` for all related services, see
34+
issue [Добавить для всех сущностей метод подсчёта количества элементов по фильтру #228](https://github.com/mesilov/bitrix24-php-sdk/issues/228)
35+
* add in scope «CRM» Userfield service and integration test
36+
* add in scope «CRM» ContactUserfield service and integration test, see
37+
issue [Добавить сервис по работе с юзерфилдами контакта #231](https://github.com/mesilov/bitrix24-php-sdk/issues/231)
38+
* add method getUserfieldByFieldName for `ContactItemResult`
39+
* add in scope «CRM» DealUserfield service and integration test, see
40+
issue [Добавить сервис по работе с юзерфилдами cделки #232](https://github.com/mesilov/bitrix24-php-sdk/issues/232)
41+
* add method getUserfieldByFieldName for `DealItemResult`
42+
* add exception `UserfieldNotFoundException`
43+
44+
### Removed
45+
46+
* remove all `0.*` and `1.*` code from `2.*` branch
47+
48+
### Changed
49+
50+
* update type definition for `ContactItemResult`, now return types will be cast to real types: DateTimeInterface, int, boolean etc
51+
52+
## 2.0-alpha.4 – 25.11.2021
53+
54+
### Changed
55+
56+
* switch `symfony/http-client` to `5.3` version requirement.
57+
* switch `symfony/http-client-contracts` to `^2.4` version requirement.
58+
* switch `symfony/event-dispatcher` to `5.3.*` version requirement.
59+
* switch `ramsey/uuid` to `^4.0` version requirement.
60+
61+
### Fixed
62+
63+
* issue [Несовместимость с Laravel 8 #224](https://github.com/mesilov/bitrix24-php-sdk/issues/224)
64+
65+
## 2.0-alpha.3 – 14.11.2021
466

567
* add php8 version support
668
* change in scope «CRM» Product service and integration tests
@@ -11,7 +73,7 @@
1173
* bump phpunit version
1274
* bump phpstan version
1375

14-
## 2.0-alpha.2 (31.01.2021)
76+
## 2.0-alpha.2 31.01.2021
1577

1678
* remove Travis CI and migrate to Github Actions
1779
* add unit-tests in independent github action
@@ -26,7 +88,7 @@
2688
* add in scope «IM» IM service and integration test
2789
* add in default scope «Main» default service
2890

29-
## 2.0-alpha.1 (11.07.2020)
91+
## 2.0-alpha.1 11.07.2020
3092

3193
* remove all v1 code
3294
* migrate to Symfony HttpClient
@@ -35,6 +97,7 @@
3597
* add Events support
3698

3799
## 0.1.0 (14.11.2021)
100+
38101
branch version 1.x – bugfix and security releases only
39102

40103
## 0.7.0 (11.07.2020)

README.md

Lines changed: 105 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,71 @@
1-
bitrix24-php-sdk [![Build Status](https://travis-ci.org/mesilov/bitrix24-php-sdk.svg?branch=master)](https://travis-ci.org/mesilov/bitrix24-php-sdk)
1+
bitrix24-php-sdk – Bitrix24 REST API PHP SDK
22
================
33
[![License](https://poser.pugx.org/mesilov/bitrix24-php-sdk/license.svg)](https://packagist.org/packages/mesilov/bitrix24-php-sdk) [![Total Downloads](https://poser.pugx.org/mesilov/bitrix24-php-sdk/downloads.svg)](https://packagist.org/packages/mesilov/bitrix24-php-sdk)
4+
[![Latest Stable Version](https://img.shields.io/packagist/v/mesilov/bitrix24-php-sdk.svg)](https://packagist.org/packages/mesilov/bitrix24-php-sdk)
45

56
A powerful PHP library for the Bitrix24 REST API
67

7-
[Bitrix24 API documentation - Russian](http://dev.1c-bitrix.ru/rest_help/)<br />
8-
[Bitrix24 API documentation - English](https://training.bitrix24.com/rest_help/)<br />
9-
[Register new Bitrix24 account](https://www.bitrix24.ru/create.php?p=255670)<br />
8+
### Build status
109

11-
### SDK 2.0 core features
10+
[![phpstan check](https://github.com/mesilov/bitrix24-php-sdk/actions/workflows/phpstan.yml/badge.svg)](https://github.com/mesilov/bitrix24-php-sdk/actions/workflows/phpstan.yml)
11+
[![phpunit unit-tests status](https://github.com/mesilov/bitrix24-php-sdk/actions/workflows/phpunit.yml/badge.svg)](https://github.com/mesilov/bitrix24-php-sdk/actions/workflows/phpunit.yml)
1212

13-
Bitrix24 auth features
13+
### BITRIX24-PHP-SDK Documentation
1414

15-
- ~~work with auth tokens~~
16-
- ~~work with incoming webhooks~~
17-
18-
add low-level tools to devs:
15+
- [Russian](/docs/RU/documentation.md)
16+
- [English](/docs/EN/documentation.md)
1917

20-
- ~~2.1 events (token expired, domain url changed)~~
21-
- 2.2 rate-limiter - wait for symfony/symfony#37471
22-
- 2.3 RetryHttpClient - symfony/symfony#38182
18+
### BITRIX24-PHP-SDK ✨FEATURES✨
2319

24-
API - level features
20+
Support both auth modes:
2521

26-
- ~~3.1 auto renew access tokens~~
27-
- 3.2 batch queries (work in progress)
28-
- ~~3.2.1 read~~
29-
- ~~3.2.2 write~~
30-
- 3.2.3 read + write
31-
- 3.2.4 read without count flag
32-
- 3.3 list queries with «start=-1» support
33-
- 3.4 offline queues
34-
- 3.5 add change domain URL support
22+
- [x] work with auth tokens for Bitrix24 applications in marketplace
23+
- [x] work with incoming webhooks for simple integration projects for current portal
3524

36-
Core DTO
25+
Low-level tools to devs:
3726

38-
- ~~Response~~
39-
- ~~Scope~~
40-
- ~~Time~~
41-
- ~~OAuthToken~~
42-
- ~~ApplicationProfile~~
43-
- ~~Pagination~~
27+
- Domain core events:
28+
- [x] Access Token expired
29+
- [ ] Bitrix24 portal domain url changed
30+
- [ ] Rate-limit strategy
31+
- [ ] Retry strategy for safe methods
4432

45-
### SDK Documentation
33+
API - level features
4634

47-
- [Russian](/docs/RU/documentation.md)
48-
- [English](/docs/EN/documentation.md)
35+
- [x] Auto renew access tokens
36+
- [ ] List queries with «start=-1» support
37+
- [ ] offline queues
38+
39+
Performance improvements 🚀
40+
41+
- Batch queries implemented with [PHP Generators](https://www.php.net/manual/en/language.generators.overview.php) – constant low memory and
42+
low CPI usage
43+
- [x] batch read data from bitrix24
44+
- [x] batch write data to bitrix24
45+
- [ ] write and read in one batch package
46+
- [ ] composite batch queries to many entities (work in progress)
47+
- [ ] read without count flag
48+
49+
### Development principles
50+
51+
- Good developer experience
52+
- auto-completion of methods at the IDE
53+
- typed method call signatures
54+
- typed results of method calls
55+
- helpers for typical operations
56+
- Good documentation
57+
- documentation on the operation of a specific method containing a link to the official documentation
58+
- documentation for working with the SDK
59+
- Performance first:
60+
- minimal impact on client code
61+
- ability to work with large amounts of data with constant memory consumption
62+
- efficient operation of the API using butch requests
63+
- Modern technology stack
64+
- based on [Symfony HttpClient](https://symfony.com/doc/current/http_client.html)
65+
- actual PHP versions language features
66+
- Reliable:
67+
- test coverage: unit, integration, contract
68+
- typical examples typical for different modes of operation and they are optimized for memory \ performance
4969

5070
### Architecture
5171

@@ -95,10 +115,51 @@ Add `"mesilov/bitrix24-php-sdk": "2.x"` to `composer.json` of your application.
95115

96116
### Tests
97117

98-
SDK test locate in folder `tests` and we have two test types
118+
Tests locate in folder `tests` and we have two test types
119+
120+
#### Unit tests
121+
122+
**Fast**, in-memory tests without a network I\O For run unit tests you must call in command line
123+
124+
```shell
125+
composer phpunit-run-unit-test
126+
```
127+
128+
#### Integration tests
129+
130+
**Slow** tests with full lifecycle with your **test** Bitrix24 portal via webhook.
131+
132+
❗️Do not run integration tests with production portals ❗️
99133

100-
- Unit: **fast**, in-memory tests without a network I\O
101-
- Integration: **slow** tests with full lifecycle with test Bitrix24 portal via webhook
134+
For run integration test you must:
135+
136+
1. Create [new Bitrix24 portal](https://www.bitrix24.ru/create.php?p=255670) for development tests
137+
2. Go to left menu, click «Sitemap»
138+
3. Find menu item «Developer resources»
139+
4. Click on menu item «Other»
140+
5. Click on menu item «Inbound webhook»
141+
6. Assign all permisions with webhook and click «save» button
142+
7. Create file `/tests/.env.local` with same settings, see comments in `/tests/.env` file.
143+
144+
```yaml
145+
APP_ENV=dev
146+
BITRIX24_WEBHOOK=https:// your portal webhook url
147+
INTEGRATION_TEST_LOG_LEVEL=500
148+
```
149+
150+
8. call in command line
151+
152+
```shell
153+
composer composer phpunit-run-integration-tests
154+
```
155+
156+
#### PHP Static Analysis Tool – phpstan
157+
158+
Call in command line
159+
160+
```shell
161+
composer phpstan-analyse
162+
```
102163

103164
### Submitting bugs and feature requests
104165

@@ -119,6 +180,14 @@ email: <mesilov.maxim@gmail.com>
119180

120181
### Sponsors
121182

183+
### Documentation
184+
185+
[Bitrix24 API documentation - Russian](http://dev.1c-bitrix.ru/rest_help/)
186+
187+
[Bitrix24 API documentation - English](https://training.bitrix24.com/rest_help/)
188+
189+
[Register new Bitrix24 account](https://www.bitrix24.ru/create.php?p=255670)
190+
122191
## Русский
123192

124193
### Принципы по которым ведётся разработка

0 commit comments

Comments
 (0)