Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#44521 closed enhancement (fixed)

Add documentation to the PHPUnit factory objects

Reported by: andizer's profile andizer Owned by: pento's profile pento
Milestone: 5.1 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: docs Cc:

Description

I discovered that the php unit test factories for WordPress aren't documented well. To make it easier for every one I decided to add some documentation for it.

Another thing I was wondering about is the old php4 way to declare methods (without access modifiers) and var declarations on class attributes. Is it desirable to modernize these or should I keep this untouched. Probably it is worth to make a separate issue for it.

Attachments (2)

44521.diff (15.1 KB) - added by andizer 7 years ago.
44521.2.diff (15.2 KB) - added by andizer 7 years ago.

Download all attachments as: .zip

Change History (8)

@andizer
7 years ago

#1 @andizer
7 years ago

  • Keywords has-patch added

#2 @JPry
7 years ago

@andizer

One thing I noticed when doing a quick skim of your patch: The docblock for WP_UnitTest_Factory_Callback_After_Create::__construct() has string as the parameter type. This should actually be callable. While this type hint is only valid in PHP 5.4+, using it in the docblock won't have any issue.

@andizer
7 years ago

#3 @andizer
7 years ago

@JPry Thanks. You are right, it makes more sense to have it named callable. I've changed it.

#4 @netweb
7 years ago

  • Component changed from General to Build/Test Tools
  • Milestone changed from Awaiting Review to 5.0

#5 @jorbin
6 years ago

  • Milestone changed from 5.0 to 5.1

#6 @pento
6 years ago

  • Owner set to pento
  • Resolution set to fixed
  • Status changed from new to closed

In 44497:

Docs: Add docblocks for the PHPUnit factory objects.

Props andizer.
Fixes #44521.

Note: See TracTickets for help on using tickets.