Skip to content
This repository was archived by the owner on Jun 21, 2024. It is now read-only.

Commit 7fa53ec

Browse files
committed
* Добавлена поддержка Bitrix v22.600.
* Добавлена поддержка PHP 8.0, 8.1 и 8.2.
1 parent ca434bf commit 7fa53ec

4 files changed

Lines changed: 36 additions & 15 deletions

File tree

.github/workflows/php-unit.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,25 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
PHP: ["7.1", "7.2", "7.3", "7.4"]
9-
Bitrix: ["18.5", "19.0", "20.0", "20.5", "21.400"]
8+
PHP: ["7.3", "7.4", "8.0", "8.1", "8.2"]
9+
Bitrix: ["18.5", "19.0", "20.0", "20.5", "21.400", "22.600"]
1010
exclude:
11-
- { PHP: "7.1", Bitrix: "21.400" }
12-
- { PHP: "7.2", Bitrix: "21.400" }
11+
- { PHP: "7.3", Bitrix: "22.600" }
12+
- { PHP: "8.0", Bitrix: "18.5" }
13+
- { PHP: "8.0", Bitrix: "19.0" }
14+
- { PHP: "8.0", Bitrix: "20.0" }
15+
- { PHP: "8.0", Bitrix: "20.5" }
16+
- { PHP: "8.0", Bitrix: "21.400" }
17+
- { PHP: "8.1", Bitrix: "18.5" }
18+
- { PHP: "8.1", Bitrix: "19.0" }
19+
- { PHP: "8.1", Bitrix: "20.0" }
20+
- { PHP: "8.1", Bitrix: "20.5" }
21+
- { PHP: "8.1", Bitrix: "21.400" }
22+
- { PHP: "8.2", Bitrix: "18.5" }
23+
- { PHP: "8.2", Bitrix: "19.0" }
24+
- { PHP: "8.2", Bitrix: "20.0" }
25+
- { PHP: "8.2", Bitrix: "20.5" }
26+
- { PHP: "8.2", Bitrix: "21.400" }
1327
container:
1428
image: webdevops/php-dev:${{ matrix.PHP }}
1529
env:
@@ -61,6 +75,7 @@ jobs:
6175
- name: Run PHPUnit tests
6276
run: XDEBUG_MODE=coverage vendor/bin/phpunit --whitelist src/ --coverage-text --coverage-clover clover.xml
6377
- name: Push data to https://scrutinizer-ci.com
78+
if: matrix.PHP == '7.4' && matrix.Bitrix == '21.400'
6479
run: |
6580
wget -nv https://scrutinizer-ci.com/ocular.phar
6681
php ocular.phar code-coverage:upload --format=php-clover clover.xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor/
22
composer.lock
33
/coverage/
4+
/.phpunit.result.cache

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
},
1717
"require": {
18-
"php": ">=7.1",
18+
"php": ">=7.2",
1919
"ext-json": "*",
2020
"elasticsearch/elasticsearch": "^7.1"
2121
},
@@ -25,8 +25,8 @@
2525
}
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "^7.5",
28+
"phpunit/phpunit": "^9.6",
2929
"symfony/var-dumper": "^4.3",
30-
"sheerockoff/bitrix-ci": "18.5"
30+
"sheerockoff/bitrix-ci": "21.400"
3131
}
3232
}

tests/IndexerTest.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@
2929

3030
class IndexerTest extends TestCase
3131
{
32-
public static function setUpBeforeClass()
32+
public static function setUpBeforeClass(): void
3333
{
3434
global $APPLICATION;
3535

3636
self::tearDownAfterClass();
3737

38+
$elements = CIBlockElement::GetList(['ID' => 'ASC']);
39+
while ($element = $elements->Fetch()) {
40+
CIBlockElement::Delete($element['ID']);
41+
}
42+
3843
$cIBlockType = new CIBlockType();
3944
$isTypeAdded = $cIBlockType->Add([
4045
'ID' => 'elastic_test',
@@ -138,7 +143,7 @@ public static function setUpBeforeClass()
138143
'TITLE' => 'Основной склад',
139144
'XML_ID' => 'MAIN',
140145
'ACTIVE' => 'Y',
141-
'ADDRESS' => '',
146+
'ADDRESS' => 'Липецк',
142147
'DESCRIPTION' => ''
143148
]);
144149

@@ -148,7 +153,7 @@ public static function setUpBeforeClass()
148153
'TITLE' => 'Запасной склад',
149154
'XML_ID' => 'SECONDARY',
150155
'ACTIVE' => 'Y',
151-
'ADDRESS' => '',
156+
'ADDRESS' => 'Тамбов',
152157
'DESCRIPTION' => ''
153158
]);
154159

@@ -287,7 +292,7 @@ public static function setUpBeforeClass()
287292
fclose($csv);
288293
}
289294

290-
public static function tearDownAfterClass()
295+
public static function tearDownAfterClass(): void
291296
{
292297
CIBlockType::Delete('elastic_test');
293298

@@ -728,15 +733,15 @@ public function testCanSearch(array $stack = [])
728733
];
729734

730735
foreach ($filters as $filter) {
731-
$response = $indexer->search('test_products', $filter);
736+
$response = $indexer->search('test_products', $filter, ['ID' => 'ASC'], ['size' => 20]);
732737
$this->assertNotEmpty($response['hits']['hits'], 'No elasticsearch hits for ' . json_encode($filter));
733738

734739
$elasticIds = array_map(function ($hit) {
735740
return (int)$hit['_source']['ID'];
736741
}, $response['hits']['hits']);
737742

738743
$elements = [];
739-
$rs = CIBlockElement::GetList(null, $filter);
744+
$rs = CIBlockElement::GetList(['ID' => 'ASC'], $filter);
740745
while ($element = $rs->GetNextElement()) {
741746
$elements[] = $element;
742747
}
@@ -749,8 +754,8 @@ public function testCanSearch(array $stack = [])
749754
}, $elements);
750755

751756
$this->assertSame(
752-
array_slice(sort($bitrixIds), 0, 10),
753-
array_slice(sort($elasticIds), 0, 10)
757+
array_slice($bitrixIds, 0, 20),
758+
array_slice($elasticIds, 0, 20)
754759
);
755760
}
756761

0 commit comments

Comments
 (0)