Skip to content

[Tests-Only] Phpunit8 20200326#37168

Closed
phil-davis wants to merge 1 commit into
masterfrom
phpunit8-20200326
Closed

[Tests-Only] Phpunit8 20200326#37168
phil-davis wants to merge 1 commit into
masterfrom
phpunit8-20200326

Conversation

@phil-davis

@phil-davis phil-davis commented Mar 26, 2020

Copy link
Copy Markdown
Contributor

Description

See what happens when phpunit8 is used.

This is on top of the pending/future PR that will drop PHP 7.1 support some time in the future.

  1. Remove undeclared property PHPUnit\Framework\Error\Deprecated - not valid/needed any more with phpunit8

  2. Stop using assertAttributeEquals in tests/lib/ConfigTest.php - that assert is deprecated and being removed. I wrote a function that does an assertEquals for each item.

  3. Adjust createMock calls to remove deprecated array of interface names - createMock() can only be passed a single class/interface.

Passing an array of interface names to createMock() for creating a test double that implements multiple interfaces is deprecated and will no longer be supported in PHPUnit 9.
Passing an array of interface names to getMockBuilder() for creating a test double that implements multiple interfaces is deprecated and will no longer be supported in PHPUnit 9.

How Has This Been Tested?

CI

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@codecov

codecov Bot commented Mar 26, 2020

Copy link
Copy Markdown

Codecov Report

Merging #37168 into master will decrease coverage by 10.73%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #37168       +/-   ##
=============================================
- Coverage     64.87%   54.14%   -10.74%     
=============================================
  Files          1269       63     -1206     
  Lines         74947     7510    -67437     
  Branches       1331     1331               
=============================================
- Hits          48625     4066    -44559     
+ Misses        25930     3052    -22878     
  Partials        392      392
Flag Coverage Δ Complexity Δ
#javascript 54.14% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit ? ?
Impacted Files Coverage Δ Complexity Δ
apps/updatenotification/templates/admin.php
lib/private/Encryption/Keys/Storage.php
lib/private/App/CodeChecker/NodeVisitor.php
lib/private/RedisFactory.php
apps/dav/lib/Avatars/AvatarNode.php
...s/dav/appinfo/Migrations/Version20170202213905.php
apps/dav/lib/Upload/ChunkLocationProvider.php
apps/files/lib/AppInfo/Application.php
apps/systemtags/list.php
apps/files_external/lib/Lib/Backend/DAV.php
... and 1194 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66d41ff...26d06cd. Read the comment docs.

@phil-davis

Copy link
Copy Markdown
Contributor Author

Remaining warnings are all about use of deprecated methods that look inside private properties of a class. These should be refactored.

There were 24 warnings:

1) Test\Http\Client\WebDavClientServiceTest::testNewClientWithProxy
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

2) Test\Http\Client\WebDavClientServiceTest::testNewClientWithProxyAndAuth
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

3) Test\SystemConfigTest::testSetValue
assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

4) Test\SystemConfigTest::testSetValues
assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

5) Test\SystemConfigTest::testDeleteValue
assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

6) Test\Template\ResourceLocatorTest::testConstructor
assertAttributeInstanceOf() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.
assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.

7) ExpirationTest::testParseRetentionObligation with data set #0 ('disabled', null, null, null)
assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

8) ExpirationTest::testParseRetentionObligation with data set #1 ('auto', 30, -1, true)
9) ExpirationTest::testParseRetentionObligation with data set #2 ('auto,auto', 30, -1, true)
10) ExpirationTest::testParseRetentionObligation with data set #3 ('auto, auto', 30, -1, true)
11) ExpirationTest::testParseRetentionObligation with data set #4 ('auto, 3', -1, 3, true)
12) ExpirationTest::testParseRetentionObligation with data set #5 ('5, auto', 5, -1, true)
13) ExpirationTest::testParseRetentionObligation with data set #6 ('3, 5', 3, 5, false)
14) ExpirationTest::testParseRetentionObligation with data set #7 ('10, 3', 10, 10, false)
assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

15) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #0 ('disabled', null, null, null)
16) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #1 ('auto', -1, -1, true)
17) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #2 ('auto,auto', -1, -1, true)
18) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #3 ('auto, auto', -1, -1, true)
19) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #4 ('auto, 3', -1, 3, true)
20) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #5 ('5, auto', 5, -1, true)
21) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #6 ('3, 5', 3, 5, false)
22) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #7 ('10, 3', 10, 10, false)
23) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #8 ('g,a,r,b,a,g,e', -1, -1, true)
24) OCA\Files_Versions\Tests\ExpirationTest::testParseRetentionObligation with data set #9 ('-3,8', -1, -1, true)
assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.
readAttribute() is deprecated and will be removed in PHPUnit 9.
getObjectAttribute() is deprecated and will be removed in PHPUnit 9.

@phil-davis phil-davis force-pushed the phpunit8-20200326 branch 2 times, most recently from 26d06cd to ec18c84 Compare April 7, 2020 04:02
@phil-davis phil-davis force-pushed the phpunit8-20200326 branch 3 times, most recently from 5ef2bda to 82e0c05 Compare April 17, 2020 16:02
@phil-davis

Copy link
Copy Markdown
Contributor Author

See PRs #37286 and #37282

@phil-davis phil-davis closed this Apr 21, 2020
@phil-davis phil-davis deleted the phpunit8-20200326 branch April 21, 2020 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant