Every call to retrieve posts goes through WP_Query
, and the bulk of the logic is in the method get_posts
. Here’s some potentially useful information about the current state of what is arguably the most important function in WordPress.
WP_Query::get_posts
is 890 lines long, and has a cyclomatic complexity of 256. A good cyclomatic complexity is ~2-6, with a maximum of 10.
WP_Query::get_posts
has an NPath complexity of 1.43573394139742×10^48. This can also be expressed as:
1,435,733,941,397,422,709,124,940,625,188,500,371,668,992,000,000
Or 1.435 Quindecillion. This is 25 orders of magnitude greater than the number of stars in the visible universe. It is also the number of unit tests required to fully test WP_Query::get_posts
.
Should unit tests be written for WP_Query::get_posts
, averaging 1.5kb each, and these tests are stored on 1TB Samsung Hard drives weighing 0.4kg each, the resulting storage would weigh a little more than 4 solar masses, or 80 Undecillion KG. For comparison, the smallest stellar black hole known is XTE J1650-500, weighing in at 3.8 solar masses
RT @Tarendai: New Blogpost: WP_Query::get_posts() http://t.co/1LsWb648ZC #wordpress
The missing WP_Query unit tests have been identified as Beta Sagittae… http://t.co/ClRB9wnhKN
RT @Tarendai: The missing WP_Query unit tests have been identified as Beta Sagittae… http://t.co/ClRB9wnhKN
That’s quite a method there RT @Tarendai: The missing WP_Query unit tests have been identified as Beta Sagittae… http://t.co/DKG5Tluj4Z
RT @Tarendai: The missing WP_Query unit tests have been identified as Beta Sagittae… http://t.co/ClRB9wnhKN
RT @Tarendai: The missing WP_Query unit tests have been identified as Beta Sagittae… http://t.co/ClRB9wnhKN
RT @Tarendai: New Blogpost: WP_Query::get_posts() http://t.co/1LsWb648ZC #wordpress