Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 385b5a2

Browse files
authored
Phpunit 8 (doctrine#8330)
* Revert to whitelist coverage requires PHPunit 9, and we don't have that yet. * Upgrade to PHPUnit 8 This unlocks PCOV usage for coverage * Upload coverage files to Codecov
1 parent fa6fe09 commit 385b5a2

374 files changed

Lines changed: 721 additions & 724 deletions

File tree

Some content is hidden

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

.github/workflows/continuous-integration.yml

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,22 @@ jobs:
5454
if: "${{ matrix.deps == 'low' }}"
5555

5656
- name: "Run PHPUnit"
57-
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml"
57+
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --coverage-clover=coverage-no-cache.xml"
5858
env:
5959
ENABLE_SECOND_LEVEL_CACHE: 0
6060

6161
- name: "Run PHPUnit with Second Level Cache"
62-
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --exclude-group performance,non-cacheable,locking_functional"
62+
run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-cache.xml"
6363
env:
6464
ENABLE_SECOND_LEVEL_CACHE: 1
6565

66+
- name: "Upload coverage file"
67+
uses: "actions/upload-artifact@v2"
68+
with:
69+
name: "phpunit-sqlite-${{ matrix.deps }}-${{ matrix.php-version }}-coverage"
70+
path: "coverage*.xml"
71+
72+
6673
phpunit-postgres:
6774
name: "PHPUnit with PostgreSQL"
6875
runs-on: "ubuntu-20.04"
@@ -112,7 +119,14 @@ jobs:
112119
run: "composer update --no-interaction --no-progress --no-suggest"
113120

114121
- name: "Run PHPUnit"
115-
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml"
122+
run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml"
123+
124+
- name: "Upload coverage file"
125+
uses: "actions/upload-artifact@v2"
126+
with:
127+
name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.php-version }}-coverage"
128+
path: "coverage.xml"
129+
116130

117131
phpunit-mariadb:
118132
name: "PHPUnit with MariaDB"
@@ -167,7 +181,14 @@ jobs:
167181
run: "composer update --no-interaction --no-progress --no-suggest"
168182

169183
- name: "Run PHPUnit"
170-
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml"
184+
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml"
185+
186+
- name: "Upload coverage file"
187+
uses: "actions/upload-artifact@v2"
188+
with:
189+
name: "${{ github.job }}-${{ matrix.mariadb-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-coverage"
190+
path: "coverage.xml"
191+
171192

172193
phpunit-mysql:
173194
name: "PHPUnit with MySQL"
@@ -222,11 +243,42 @@ jobs:
222243
run: "composer update --no-interaction --no-progress --no-suggest"
223244

224245
- name: "Run PHPUnit"
225-
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml"
246+
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage-no-cache.xml"
226247
env:
227248
ENABLE_SECOND_LEVEL_CACHE: 0
228249

229250
- name: "Run PHPUnit with Second Level Cache"
230-
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional"
251+
run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --exclude-group performance,non-cacheable,locking_functional --coverage-clover=coverage-no-cache.xml"
231252
env:
232253
ENABLE_SECOND_LEVEL_CACHE: 1
254+
255+
- name: "Upload coverage files"
256+
uses: "actions/upload-artifact@v2"
257+
with:
258+
name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.php-version }}-coverage"
259+
path: "coverage*.xml"
260+
261+
upload_coverage:
262+
name: "Upload coverage to Codecov"
263+
runs-on: "ubuntu-20.04"
264+
needs:
265+
- "phpunit-smoke-check"
266+
- "phpunit-postgres"
267+
- "phpunit-mariadb"
268+
- "phpunit-mysql"
269+
270+
steps:
271+
- name: "Checkout"
272+
uses: "actions/checkout@v2"
273+
with:
274+
fetch-depth: 2
275+
276+
- name: "Download coverage files"
277+
uses: "actions/download-artifact@v2"
278+
with:
279+
path: "reports"
280+
281+
- name: "Upload to Codecov"
282+
uses: "codecov/codecov-action@v1"
283+
with:
284+
directory: reports

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ vendor/
1515
/tests/Doctrine/Performance/history.db
1616
/.phpcs-cache
1717
composer.lock
18+
/.phpunit.result.cache

ci/github/phpunit/mysqli.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
</testsuite>
2525
</testsuites>
2626

27-
<coverage>
28-
<include>
27+
<filter>
28+
<whitelist>
2929
<directory suffix=".php">../../../lib/Doctrine</directory>
30-
</include>
31-
</coverage>
30+
</whitelist>
31+
</filter>
3232

3333
<groups>
3434
<exclude>

ci/github/phpunit/pdo_mysql.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
</testsuite>
2525
</testsuites>
2626

27-
<coverage>
28-
<include>
27+
<filter>
28+
<whitelist>
2929
<directory suffix=".php">../../../lib/Doctrine</directory>
30-
</include>
31-
</coverage>
30+
</whitelist>
31+
</filter>
32+
3233

3334
<groups>
3435
<exclude>

ci/github/phpunit/pdo_pgsql.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
</testsuite>
2525
</testsuites>
2626

27-
<coverage>
28-
<include>
27+
<filter>
28+
<whitelist>
2929
<directory suffix=".php">../../../lib/Doctrine</directory>
30-
</include>
31-
</coverage>
30+
</whitelist>
31+
</filter>
3232

3333
<groups>
3434
<exclude>

ci/github/phpunit/sqlite.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
</testsuite>
1919
</testsuites>
2020

21-
<coverage>
22-
<include>
21+
<filter>
22+
<whitelist>
2323
<directory suffix=".php">../../../lib/Doctrine</directory>
24-
</include>
25-
</coverage>
24+
</whitelist>
25+
</filter>
2626

2727
<groups>
2828
<exclude>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"require-dev": {
3535
"doctrine/coding-standard": "^6.0",
3636
"phpstan/phpstan": "^0.12.18",
37-
"phpunit/phpunit": "^7.5",
37+
"phpunit/phpunit": "^8.0",
3838
"symfony/yaml": "^3.4|^4.0|^5.0",
3939
"vimeo/psalm": "^3.11"
4040
},

tests/Doctrine/Tests/DbalFunctionalTestCase.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ protected function resetSharedConn()
2525
self::$_sharedConn = null;
2626
}
2727

28-
/**
29-
* @return void
30-
*/
31-
protected function setUp()
28+
protected function setUp() : void
3229
{
3330
if (isset($this->sharedFixture['conn'])) {
3431
$this->_conn = $this->sharedFixture['conn'];

tests/Doctrine/Tests/Mapping/UnderscoreNamingStrategyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class UnderscoreNamingStrategyTest extends TestCase
1616
/** @test */
1717
public function checkDeprecationMessage() : void
1818
{
19-
$this->expectDeprecationMessage('Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0.');
19+
$this->expectDeprecationMessageSame('Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0.');
2020
new UnderscoreNamingStrategy(CASE_LOWER, false);
2121
}
2222
}

tests/Doctrine/Tests/ORM/Cache/AbstractRegionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class AbstractRegionTest extends OrmFunctionalTestCase
2222
*/
2323
protected $cache;
2424

25-
protected function setUp()
25+
protected function setUp() : void
2626
{
2727
parent::setUp();
2828

0 commit comments

Comments
 (0)