Skip to content

Commit 31eef1e

Browse files
yndu13JacksonTian
authored andcommitted
Support PHP versions: From 5.5 up to 8.1
1 parent 9876ba7 commit 31eef1e

File tree

181 files changed

+11425
-269
lines changed

Some content is hidden

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

181 files changed

+11425
-269
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: HighVersion CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- uses: actions/setup-node@v1
22+
with:
23+
node-version: 10.x
24+
25+
- name: Install Proxy
26+
run: npm install o_o -g --registry=https://registry.npm.taobao.org
27+
28+
- name: Start Proxy
29+
run: o_o &
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php-versions }}
35+
extensions: mbstring, intl
36+
ini-values: post_max_size=256M, max_execution_time=180
37+
coverage: xdebug
38+
tools: php-cs-fixer, phpunit
39+
40+
- name: Validate composer.json and composer.lock
41+
run: composer validate
42+
43+
- name: Install dependencies
44+
run: composer install --prefer-dist --no-progress --no-suggest
45+
46+
- name: Run test case
47+
run: composer test4HighVersion
48+
env:
49+
REGION_ID: ${{ secrets.REGION_ID }}
50+
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
51+
ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }}
52+
PRIVATE_KEY_LINE_1: ${{ secrets.PRIVATE_KEY_LINE_1 }}
53+
PUBLIC_KEY_ID: ${{ secrets.PUBLIC_KEY_ID }}
54+
IMAGE_SEARCH_ACCESS_KEY_ID: ${{ secrets.IMAGE_SEARCH_ACCESS_KEY_ID }}
55+
IMAGE_SEARCH_ACCESS_KEY_SECRET: ${{ secrets.IMAGE_SEARCH_ACCESS_KEY_SECRET }}
56+
IMAGE_SEARCH_INSTANCE_NAME: ${{ secrets.IMAGE_SEARCH_INSTANCE_NAME }}
57+
58+
- name: CodeCov
59+
run: bash <(curl -s https://codecov.io/bash)

.github/workflows/ci.yml renamed to .github/workflows/ci_lower_than_php7.2.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: LowVersion CI
22

33
on:
44
push:
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
15+
php-versions: ['5.6', '7.0', '7.1']
1616

1717
steps:
1818
- name: Checkout
@@ -44,13 +44,16 @@ jobs:
4444
run: composer install --prefer-dist --no-progress --no-suggest
4545

4646
- name: Run test case
47-
run: test -z $ACCESS_KEY_ID -a -z $ACCESS_KEY_SECRET || composer test
47+
run: composer test4LowVersion
4848
env:
4949
REGION_ID: ${{ secrets.REGION_ID }}
5050
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
5151
ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }}
5252
PRIVATE_KEY_LINE_1: ${{ secrets.PRIVATE_KEY_LINE_1 }}
5353
PUBLIC_KEY_ID: ${{ secrets.PUBLIC_KEY_ID }}
54+
IMAGE_SEARCH_ACCESS_KEY_ID: ${{ secrets.IMAGE_SEARCH_ACCESS_KEY_ID }}
55+
IMAGE_SEARCH_ACCESS_KEY_SECRET: ${{ secrets.IMAGE_SEARCH_ACCESS_KEY_SECRET }}
56+
IMAGE_SEARCH_INSTANCE_NAME: ${{ secrets.IMAGE_SEARCH_INSTANCE_NAME }}
5457

5558
- name: CodeCov
5659
run: bash <(curl -s https://codecov.io/bash)

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ php:
99
- 7.2
1010
- 7.3
1111
- 7.4
12+
- 8.0
13+
- 8.1
1214
- hhvm-3.24
1315
- nightly
1416
env:

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ install:
2929
- echo extension=php_sockets.dll >> C:\tools\phpci\php\php.ini
3030
- echo extension=php_curl.dll >> C:\tools\phpci\php\php.ini
3131
- cd %APPVEYOR_BUILD_FOLDER%
32+
- composer config --no-plugins allow-plugins.dealerdirect/phpcodesniffer-composer-installer false
3233
- composer install --prefer-dist --no-progress
3334
# Install Proxy
3435
- npm install o_o -g
3536

3637
test_script:
3738
# Start Proxy
38-
- ps: o_o &
39+
- ps: Start-Process -FilePath "o_o" -NoNewWindow
3940
# Test
4041
- cd %APPVEYOR_BUILD_FOLDER%
4142
- vendor\bin\phpunit --colors=always

composer.json

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@
3535
"ext-simplexml": "*",
3636
"ext-xmlwriter": "*",
3737
"guzzlehttp/guzzle": "^6.3|^7.0",
38-
"danielstjules/stringy": "^3.1",
3938
"mtdowling/jmespath.php": "^2.5",
40-
"adbario/php-dot-notation": "^2.2",
39+
"adbario/php-dot-notation": "^2.4.1",
4140
"clagiordano/weblibs-configmanager": "^1.0"
4241
},
4342
"require-dev": {
@@ -49,7 +48,7 @@
4948
"drupal/coder": "^8.3",
5049
"symfony/dotenv": "^3.4",
5150
"league/climate": "^3.2.4",
52-
"phpunit/phpunit": "^5.7.27|^6.1",
51+
"phpunit/phpunit": "^5.7|^6.6|^7.5|^8.5|^9.5",
5352
"monolog/monolog": "^1.24",
5453
"composer/composer": "^1.8",
5554
"mikey179/vfsstream": "^1.6",
@@ -73,7 +72,10 @@
7372
},
7473
"config": {
7574
"preferred-install": "dist",
76-
"optimize-autoloader": true
75+
"optimize-autoloader": true,
76+
"allow-plugins": {
77+
"dealerdirect/phpcodesniffer-composer-installer": true
78+
}
7779
},
7880
"minimum-stability": "dev",
7981
"prefer-stable": true,
@@ -95,13 +97,29 @@
9597
"test": [
9698
"phpunit --colors=always"
9799
],
98-
"unit": [
100+
"test4HighVersion": [
101+
"@clearCache",
102+
"phpunit --testsuite=Test4HighVersion --colors=always"
103+
],
104+
"test4LowVersion": [
105+
"@clearCache",
106+
"phpunit --testsuite=Test4LowVersion --colors=always"
107+
],
108+
"unit4HighVersion": [
109+
"@clearCache",
110+
"phpunit --testsuite=Unit4HighVersion --colors=always"
111+
],
112+
"unit4LowVersion": [
113+
"@clearCache",
114+
"phpunit --testsuite=Unit4LowVersion --colors=always"
115+
],
116+
"feature4HighVersion": [
99117
"@clearCache",
100-
"phpunit --testsuite=Unit --colors=always"
118+
"phpunit --testsuite=Feature4HighVersion --colors=always"
101119
],
102-
"feature": [
120+
"feature4LowVersion": [
103121
"@clearCache",
104-
"phpunit --testsuite=Feature --colors=always"
122+
"phpunit --testsuite=Feature4LowVersion --colors=always"
105123
],
106124
"coverage": "open cache/coverage/index.html",
107125
"clearCache": "rm -rf cache/*",

phpunit.xml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,32 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
logIncompleteSkipped="true"
1211
testSuiteLoaderFile="phpunit/src/Runner/StandardTestSuiteLoader.php">
1312

1413
<testsuites>
1514
<testsuite name="All">
1615
<directory>tests</directory>
1716
</testsuite>
18-
<testsuite name="Unit">
19-
<directory suffix="Test.php">./tests/Unit</directory>
17+
<testsuite name="Test4HighVersion">
18+
<directory>./tests/HigherthanorEqualtoVersion7_2</directory>
19+
</testsuite>
20+
<testsuite name="Test4LowVersion">
21+
<directory>./tests/LowerthanVersion7_2</directory>
22+
</testsuite>
23+
<testsuite name="Unit4HighVersion">
24+
<directory suffix="Test.php">./tests/HigherthanorEqualtoVersion7_2/Unit</directory>
25+
</testsuite>
26+
27+
<testsuite name="Feature4HighVersion">
28+
<directory suffix="Test.php">./tests/HigherthanorEqualtoVersion7_2/Feature</directory>
29+
</testsuite>
30+
31+
<testsuite name="Unit4LowVersion">
32+
<directory suffix="Test.php">./tests/LowerthanVersion7_2/Unit</directory>
2033
</testsuite>
2134

22-
<testsuite name="Feature">
23-
<directory suffix="Test.php">./tests/Feature</directory>
35+
<testsuite name="Feature4LowVersion">
36+
<directory suffix="Test.php">./tests/LowerthanVersion7_2/Feature</directory>
2437
</testsuite>
2538
</testsuites>
2639

src/Credentials/Providers/EcsRamRoleProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace AlibabaCloud\Client\Credentials\Providers;
44

55
use Exception;
6-
use Stringy\Stringy;
6+
use AlibabaCloud\Client\Support\Stringy;
77
use AlibabaCloud\Client\SDK;
88
use AlibabaCloud\Client\Result\Result;
99
use Psr\Http\Message\ResponseInterface;
@@ -112,7 +112,7 @@ public function getResponse()
112112
try {
113113
return RpcRequest::createClient()->request('GET', $url, $options);
114114
} catch (GuzzleException $exception) {
115-
if (Stringy::create($exception->getMessage())->contains('timed')) {
115+
if (Stringy::contains($exception->getMessage(), 'timed')) {
116116
$message = 'Timeout or instance does not belong to Alibaba Cloud';
117117
} else {
118118
$message = $exception->getMessage();

src/Exception/ServerException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace AlibabaCloud\Client\Exception;
44

5-
use Stringy\Stringy;
5+
use AlibabaCloud\Client\Support\Stringy;
66
use RuntimeException;
77
use AlibabaCloud\Client\SDK;
88
use AlibabaCloud\Client\Result\Result;
@@ -83,7 +83,7 @@ private function resolvePropertiesByReturn()
8383
private function distinguishSignatureErrors()
8484
{
8585
if ($this->result->getRequest()
86-
&& Stringy::create($this->errorMessage)->contains($this->result->getRequest()->stringToSign())) {
86+
&& Stringy::contains($this->errorMessage, $this->result->getRequest()->stringToSign())) {
8787
$this->errorCode = 'InvalidAccessKeySecret';
8888
$this->errorMessage = 'Specified Access Key Secret is not valid.';
8989
}

src/Functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace AlibabaCloud\Client;
44

55
use Closure;
6-
use Stringy\Stringy;
6+
use AlibabaCloud\Client\Support\Stringy;
77
use League\CLImate\CLImate;
88
use AlibabaCloud\Client\Exception\ClientException;
99

@@ -60,7 +60,7 @@ function inOpenBasedir($filename, $throwException = false)
6060
function inDir($filename, array $dirs)
6161
{
6262
foreach ($dirs as $dir) {
63-
if (!Stringy::create($dir)->endsWith(DIRECTORY_SEPARATOR)) {
63+
if (!Stringy::endsWith($dir, DIRECTORY_SEPARATOR)) {
6464
$dir .= DIRECTORY_SEPARATOR;
6565
}
6666

src/Log/LogFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ class LogFormatter
3737
*/
3838
public function __construct($template)
3939
{
40-
parent::__construct($template);
40+
// parent::__construct($template);
4141
self::$logStartTime = microtime(true);
4242
$this->template = $template;
4343
$timezone = new DateTimeZone(date_default_timezone_get() ?: 'UTC');
4444
if (PHP_VERSION_ID < 70100) {
4545
self::$ts = DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), $timezone);
4646
} else {
47-
self::$ts = new DateTime(null, $timezone);
47+
self::$ts = new DateTime('now', $timezone);
4848
}
4949
}
5050

0 commit comments

Comments
 (0)