Skip to content

Commit 6a5d4b6

Browse files
Merge pull request #37 from martin-helmich/feature/support-phpunit9
Add support for PHPUnit 9
2 parents cda22a9 + 7457071 commit 6a5d4b6

File tree

6 files changed

+203
-206
lines changed

6 files changed

+203
-206
lines changed

.github/workflows/php.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ jobs:
77
strategy:
88
matrix:
99
php: ['7.2', '7.3', '7.4']
10-
phpunit: ['6.0', '7.0', '8.0']
10+
phpunit: ['6.0', '7.0', '8.0', '9.0']
11+
exclude:
12+
- php: '7.2'
13+
phpunit: '9.0'
1114
runs-on: ubuntu-latest
1215

1316
steps:

composer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,19 @@
1313
"php": ">=7.1.0,<8.0",
1414
"ext-mongodb": "*",
1515
"mongodb/mongodb": "^1.0",
16-
"phpunit/phpunit": ">=6.0,<9.0"
16+
"phpunit/phpunit": ">=6.0,<10.0",
17+
"ext-json": "*"
1718
},
1819
"autoload": {
1920
"psr-4": {
2021
"Helmich\\MongoMock\\": "src"
2122
}
2223
},
2324
"autoload-dev": {
24-
"files": [
25-
"vendor/phpunit/phpunit/src/Framework/Assert/Functions.php"
26-
],
2725
"psr-4": {
2826
"Helmich\\MongoMock\\Tests\\": "tests"
2927
}
3028
},
31-
"require-dev": {
32-
"codeclimate/php-test-reporter": "^0.3.0 || ^0.4.0"
33-
},
3429
"scripts": {
3530
"test": [
3631
"phpunit"

src/Assert/HasDocumentConstraint.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class HasDocumentConstraint extends Constraint
1515

1616
public function __construct($filter)
1717
{
18-
parent::__construct();
1918
$this->filter = $filter;
2019
}
2120

src/Assert/IndexWasCreatedConstraint.php

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

55
use Helmich\MongoMock\Log\Index;
66
use Helmich\MongoMock\MockCollection;
7+
use PHPUnit\Framework\Assert;
78
use PHPUnit\Framework\Constraint\Constraint;
89

910
class IndexWasCreatedConstraint extends Constraint
@@ -20,7 +21,6 @@ class IndexWasCreatedConstraint extends Constraint
2021

2122
public function __construct($key, $options = [])
2223
{
23-
parent::__construct();
2424
$this->key = $key;
2525
$this->options = $options;
2626
}
@@ -31,7 +31,7 @@ protected function matches($other): bool
3131
return false;
3232
}
3333

34-
$constraint = \PHPUnit_Framework_Assert::equalTo(new Index($this->key, $this->options));
34+
$constraint = Assert::equalTo(new Index($this->key, $this->options));
3535

3636
foreach ($other->indices as $index) {
3737
if ($constraint->evaluate($index, '', true)) {

src/Assert/QueryWasExecutedConstraint.php

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

55
use Helmich\MongoMock\Log\Query;
66
use Helmich\MongoMock\MockCollection;
7+
use PHPUnit\Framework\Assert;
78
use PHPUnit\Framework\Constraint\Constraint;
89

910
class QueryWasExecutedConstraint extends Constraint
@@ -17,7 +18,6 @@ class QueryWasExecutedConstraint extends Constraint
1718

1819
public function __construct($filter, $options = [])
1920
{
20-
parent::__construct();
2121
$this->filter = $filter;
2222
$this->options = $options;
2323
}
@@ -28,7 +28,7 @@ protected function matches($other): bool
2828
return false;
2929
}
3030

31-
$constraint = \PHPUnit_Framework_Assert::equalTo(new Query($this->filter, $this->options));
31+
$constraint = Assert::equalTo(new Query($this->filter, $this->options));
3232

3333
foreach ($other->queries as $query) {
3434
if ($constraint->evaluate($query, '', true)) {

0 commit comments

Comments
 (0)