Skip to content

Review changes for phpunit 8 #37308

Description

@phil-davis

PR #37307 implemented phpunit version 8. Some test and code changes were needed.
Review to see if they can/should be refactored differently.

  1. Provide a default constructor for OC\Files\Storage\Common 5d8dcbd
[PHP Fatal error:  Class Mock_Common_a6b4666b contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (OCP\Files\Storage::__construct) in /drone/src/lib/composer/phpunit/phpunit/src/Framework/MockObject/MockClass.php(42) : eval()'d code on line 3]

Maybe something different could be done to fix that?

  1. Adjust getting protected and private object properties in unit tests 6785277
    There were some unit tests that "looked inside" objects and checked the values of private and protected properties. The tests were refactored to get those by casting the objects to array and looking in the array - that is a tricky way to "see inside" an object.

Actually unit tests should not really be "looking inside" an object - they should be testing the external behavior of the public methods and properties. Review the things in that commit and think "why is that being tested in the first place?", "what should really be done?"

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions