Skip to content

Commit 6eb468d

Browse files
authored
Merge pull request #23 from seregazhuk/update-deps
Update PHP version and dependencies
2 parents f82a634 + 966f20b commit 6eb468d

12 files changed

+46
-63
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build/
22
vendor/
33
composer.lock
4+
.phpunit.result.cache

.travis.yml

+2-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@ addons:
99

1010
jobs:
1111
include:
12-
- stage: "PHP7.2 - lowest"
13-
php: 7.2
14-
script:
15-
- composer update -n --prefer-dist --prefer-lowest --no-suggest
16-
- composer dump-autoload
17-
- composer ci:tests
18-
19-
- stage: "PHP7.3 - highest"
20-
php: 7.3
12+
- stage: "PHP8.0"
13+
php: 8.0
2114
script:
2215
- composer update -n --prefer-dist --no-suggest
2316
- composer dump-autoload

composer.json

+5-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=7.2",
20-
"react/promise": "^2.7",
21-
"phpunit/phpunit": "^8.2",
22-
"clue/block-react": "^1.3"
19+
"php": ">=8.0",
20+
"react/promise": "^2.8",
21+
"phpunit/phpunit": "^9.5",
22+
"phpunit/php-code-coverage": "^9.2",
23+
"clue/block-react": "^1.4"
2324
},
2425
"autoload": {
2526
"psr-4": {
@@ -31,9 +32,6 @@
3132
"seregazhuk\\React\\PromiseTesting\\tests\\": "tests/"
3233
}
3334
},
34-
"require-dev": {
35-
"codeclimate/php-test-reporter": "^0.4.4"
36-
},
3735
"scripts": {
3836
"ci:tests": "vendor/bin/phpunit tests"
3937
}

phpunit.xml

+16-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
>
12-
<testsuites>
13-
<testsuite name="ReactPHP Promise Testing Test Suite">
14-
<directory suffix=".php">./tests/</directory>
15-
</testsuite>
16-
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix=".php">./src/</directory>
20-
</whitelist>
21-
</filter>
22-
<logging>
23-
<log type="coverage-clover" target="./build/logs/clover.xml"/>
24-
<log type="coverage-html" target="./build/logs/report"
25-
lowUpperBound="50" highLowerBound="80"/>
26-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">./src/</directory>
6+
</include>
7+
<report>
8+
<clover outputFile="./build/logs/clover.xml"/>
9+
<html outputDirectory="./build/logs/report" lowUpperBound="50" highLowerBound="80"/>
10+
</report>
11+
</coverage>
12+
<testsuites>
13+
<testsuite name="ReactPHP Promise Testing Test Suite">
14+
<directory suffix=".php">./tests/</directory>
15+
</testsuite>
16+
</testsuites>
17+
<logging/>
2718
</phpunit>

src/AssertsPromise.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
trait AssertsPromise
1414
{
15-
protected $defaultWaitTimeout = 2;
15+
protected int $defaultWaitTimeout = 2;
1616

1717
private $loop;
1818

tests/AboutPromiseTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function predicate_function_reveals_what_is_true_about_promise(): void
3030

3131
$this->assertTrueAboutPromise($thd->promise(), 'is_string');
3232
} catch (Exception $exception) {
33-
$this->assertRegExp(
33+
$this->assertMatchesRegularExpression(
3434
'/Failed asserting that .+/',
3535
$exception->getMessage()
3636
);
@@ -59,7 +59,7 @@ public function predicate_function_reveals_what_is_false_about_promise(): void
5959

6060
$this->assertFalseAboutPromise($thd->promise(), 'is_int');
6161
} catch (Exception $exception) {
62-
$this->assertRegExp(
62+
$this->assertMatchesRegularExpression(
6363
'/Failed asserting that .+/',
6464
$exception->getMessage()
6565
);

tests/PromiseFulfillsTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function promise_fulfills(): void
1717
$deferred->reject();
1818
$this->assertPromiseFulfills($deferred->promise(), 1);
1919
} catch (Exception $exception) {
20-
$this->assertRegExp(
20+
$this->assertMatchesRegularExpression(
2121
'/Failed asserting that promise fulfills. Promise was rejected/',
2222
$exception->getMessage()
2323
);
@@ -39,12 +39,12 @@ public function it_fails_when_promise_doesnt_fulfill_in_a_specified_timeout(): v
3939

4040
$this->assertPromiseFulfills($promise, 1);
4141
} catch (Exception $exception) {
42-
$this->assertRegExp(
42+
$this->assertMatchesRegularExpression(
4343
'/Promise was cancelled due to timeout./',
4444
$exception->getMessage()
4545
);
4646

47-
$this->assertRegExp(
47+
$this->assertMatchesRegularExpression(
4848
'/Promise was cancelled due to timeout/',
4949
$exception->getMessage()
5050
);

tests/PromiseFulfillsWithInstanceOfTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public function promise_fulfills_with_a_value_of_a_specified_class(): void
1717
$deferred->resolve(new MyClass());
1818
$this->assertPromiseFulfillsWithInstanceOf($deferred->promise(), MyClass::class, 1);
1919
} catch (Exception $exception) {
20-
$this->assertRegExp(
20+
$this->assertMatchesRegularExpression(
2121
'/Failed asserting that promise fulfills with a value of class ' . preg_quote(MyClass::class, '/') .'/',
2222
$exception->getMessage()
2323
);
2424

25-
$this->assertRegExp(
25+
$this->assertMatchesRegularExpression(
2626
'/Failed asserting that .+ matches expected .+/',
2727
$exception->getMessage()
2828
);
@@ -38,12 +38,12 @@ public function it_fails_when_promise_rejects(): void
3838
$deferred->reject();
3939
$this->assertPromiseFulfillsWithInstanceOf($deferred->promise(), MyClass::class, 1);
4040
} catch (Exception $exception) {
41-
$this->assertRegExp(
41+
$this->assertMatchesRegularExpression(
4242
'/Failed asserting that promise fulfills with a value of class ' . preg_quote(MyClass::class, '/') .'/',
4343
$exception->getMessage()
4444
);
4545

46-
$this->assertRegExp(
46+
$this->assertMatchesRegularExpression(
4747
'/Promise was rejected/',
4848
$exception->getMessage()
4949
);
@@ -67,12 +67,12 @@ static function() use ($deferred){
6767

6868
$this->assertPromiseFulfillsWithInstanceOf($promise, MyClass::class, 1);
6969
} catch (Exception $exception) {
70-
$this->assertRegExp(
70+
$this->assertMatchesRegularExpression(
7171
'/Failed asserting that promise fulfills with a value of class ' . preg_quote(MyClass::class, '/') .'/',
7272
$exception->getMessage()
7373
);
7474

75-
$this->assertRegExp(
75+
$this->assertMatchesRegularExpression(
7676
'/Promise was cancelled due to timeout/',
7777
$exception->getMessage()
7878
);

tests/PromiseFulfillsWithTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public function promise_fulfills_with_a_specified_value(): void
1818
$deferred->resolve(1234);
1919
$this->assertPromiseFulfillsWith($deferred->promise(), 1);
2020
} catch (Exception $exception) {
21-
$this->assertRegExp(
21+
$this->assertMatchesRegularExpression(
2222
'/Failed asserting that promise fulfills with a specified value/',
2323
$exception->getMessage()
2424
);
2525

26-
$this->assertRegExp(
26+
$this->assertMatchesRegularExpression(
2727
'/Failed asserting that .+ matches expected .+/',
2828
$exception->getMessage()
2929
);
@@ -39,12 +39,12 @@ public function it_fails_when_promise_rejects(): void
3939
$deferred->reject();
4040
$this->assertPromiseFulfillsWith($deferred->promise(), 1);
4141
} catch (Exception $exception) {
42-
$this->assertRegExp(
42+
$this->assertMatchesRegularExpression(
4343
'/Failed asserting that promise fulfills with a specified value/',
4444
$exception->getMessage()
4545
);
4646

47-
$this->assertRegExp(
47+
$this->assertMatchesRegularExpression(
4848
'/Promise was rejected/',
4949
$exception->getMessage()
5050
);
@@ -68,12 +68,12 @@ static function () use ($deferred) {
6868

6969
$this->assertPromiseFulfillsWith($promise, 1, 1);
7070
} catch (Exception $exception) {
71-
$this->assertRegExp(
71+
$this->assertMatchesRegularExpression(
7272
'/Failed asserting that promise fulfills with a specified value/',
7373
$exception->getMessage()
7474
);
7575

76-
$this->assertRegExp(
76+
$this->assertMatchesRegularExpression(
7777
'/Promise was cancelled due to timeout/',
7878
$exception->getMessage()
7979
);

tests/PromiseRejectsTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function promise_rejects(): void
1616
$deferred->resolve();
1717
$this->assertPromiseRejects($deferred->promise());
1818
} catch (Exception $exception) {
19-
$this->assertRegExp(
19+
$this->assertMatchesRegularExpression(
2020
'/Failed asserting that promise rejects. Promise was fulfilled/',
2121
$exception->getMessage()
2222
);

tests/PromiseRejectsWithTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ public function promise_rejects_with_a_specified_reason(): void
1616
$deferred->reject(new \LogicException());
1717
$this->assertPromiseRejectsWith($deferred->promise(), \InvalidArgumentException::class);
1818
} catch (Exception $exception) {
19-
$this->assertRegExp('/Failed asserting that promise rejects with a specified reason/', $exception->getMessage());
20-
$this->assertRegExp(
19+
$this->assertMatchesRegularExpression('/Failed asserting that promise rejects with a specified reason/', $exception->getMessage());
20+
$this->assertMatchesRegularExpression(
2121
'/Failed asserting that LogicException Object .+ is an instance of class "InvalidArgumentException"/',
2222
$exception->getMessage()
2323
);

tests/WaitForPromiseToFulfillTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function promise_resolves(): void
1717
$deferred->reject(new Exception());
1818
$this->waitForPromiseToFulfill($deferred->promise());
1919
} catch (Exception $exception) {
20-
$this->assertRegExp(
20+
$this->assertMatchesRegularExpression(
2121
'/Failed to fulfill a promise. It was rejected with Exception/',
2222
$exception->getMessage()
2323
);

0 commit comments

Comments
 (0)