Skip to:
Content

Opened 4 years ago

Closed 4 years ago

Last modified 4 weeks ago

#2801 closed enhancement (fixed)

Increased/improved count tests and the issues they uncovered

Reported by: thebrandonallen Owned by:
Milestone: 2.6 Priority: normal
Severity: normal Version: trunk
Component: Tools Keywords: has-patch
Cc:

Description

Increased/improved count tests and the issues they uncovered

I spent some time beefing/speeding up our count tests to build a solid base for #1799. While doing this, it made it easier to see where we needed some other fixes.

I’ll be including two patches on this ticket. The first is the tests themselves. The second improves our type casting in the count functions. The latter isn’t of major importance. It doesn’t effect the tests in any way, it’s simply improvements to our type casting I discovered while working on the tests. It’s a nice-to-have, but not omg-sweet-tea.

The tests, as they stand on this ticket will not all pass. For most of the failures, I could have forced them to pass within the individual test, but I chose to track down and fix the actual issues instead. I will post patches on the relevant tickets.

Required for passing tests:
#2322
#2529
#2800

Attachments (2)

2801.01.patch (49.2 KB) - added by thebrandonallen 4 years ago.
Test improvements
2801.02.patch (13.0 KB) - added by thebrandonallen 4 years ago.
Type casting improvements

Download all attachments as: .zip

Change History (30)

@thebrandonallen
4 years ago

Test improvements

@thebrandonallen
4 years ago

Type casting improvements

This ticket was mentioned in Slack in #bbpress by netweb. View the logs.


4 years ago

This ticket was mentioned in Slack in #bbpress by jjj. View the logs.


4 years ago

#3 @johnjamesjacoby
4 years ago

In 5730:

Common: Additional type-casting in query functions.

Ensures direct query results return a consistent, testable value.

Props thebrandonallen, netweb. See #2801.

#4 @johnjamesjacoby
4 years ago

In 5731:

Forums: Normalize type-casting in some count functions. More to do here.

Props thebrandonallen, netweb. See #2801.

#5 @johnjamesjacoby
4 years ago

In 5732:

Bumps: Normalize type-casting in bump functions.

Props thebrandonallen, netweb. See #2801.

#6 @johnjamesjacoby
4 years ago

In 5733:

Core: Force-clear post caches on several common moderation actions.

Fixes inconsistencies around cached objects related to counts, which are currently stored in metadata.

Props thebrandonallen, netweb. See #2801.

#7 @johnjamesjacoby
4 years ago

In 5734:

Forums: Type-cast improvements to bbp_forum_query_last_reply_id().

Fixes bug where strict false comparison would cache cache condition to never occur.

Props thebrandonallen, netweb. See #2801.

#8 @johnjamesjacoby
4 years ago

In 5737:

Replies: Improve type-casting in reply functions. Also use newly created bbp_update_reply_to_id() function in bbp_update_reply_to().

Props thebrandonallen, netweb. See #2801.

#9 @johnjamesjacoby
4 years ago

In 5738:

Topics: Improve type-casting in topic functions.

Props thebrandonallen, netweb. See #2801.

#10 @johnjamesjacoby
4 years ago

In 5739:

Common: Improve type-casting return values in query functions.

Props thebrandonallen, netweb. See #2801.

#11 @netweb
4 years ago

In 5740:

Tests: Test an array of posts not the total post counts:

  • Test the forum's topic ids in test_bbp_forum_query_topic_ids()
  • Test the forum's subforum ids in test_bbp_forum_query_subforum_ids()

Props thebrandonallen, netweb. See #2801

#12 @netweb
4 years ago

In r5741:
Tests: Improved performance of user component count function tests, now 33⅓% faster
Props thebrandonallen. See #2801

In r5766:
Tests: Improved performance and use bbp_clean_post_cache() in topics template counts function tests
Props thebrandonallen. See #2801


Originally committed the above two commits against the wrong ticket

#13 @netweb
4 years ago

In 5767:

Tests: Improved performance of forum component count template function tests

Props thebrandonallen. See #2801

#14 @netweb
4 years ago

So far, I've merged in all the test changes from 2801.diff except the following three:

  • tests/phpunit/testcases/topics/functions/counts.php
  • tests/phpunit/testcases/forums/functions/counts.php
  • tests/phpunit/testcases/common/query.php

I'll get to these in the morning...

#15 @netweb
4 years ago

In 5769:

Tests: Added integer differential bump count assertions to test_bbp_bump_topic_reply_count() and test_bbp_bump_topic_reply_count_hidden() tests
Props thebrandonallen. See #2801

#16 @netweb
4 years ago

@thebrandonallen In r5769 I left out a few of the assertions you included in your original patch and the following two:

  • bbp_bump_topic_reply_count( $t, '1' );/bbp_bump_topic_reply_count_hidden( $t, '1' );
    • I left this one out as the function parameters require this if passed to be an integer
  • bbp_get_topic_reply_count( $t, true );/bbp_get_topic_reply_count_hidden( $t, true );
    • I left this one out because test is not testing the bbp_get_topic_reply_count / bbp_get_topic_reply_count_hidden functions, the testing of any integer parameters with these functions should only be tested in their own respective function tests

#17 @netweb
4 years ago

In 5777:

Tests: Fix failing test test_bbp_update_forum_topic_count()

Props thebrandonallen. See #2801

#18 @netweb
4 years ago

In 5780:

Tests: Updated topic component count functions tests
Props thebrandonallen, netweb. See #2801

#19 @netweb
4 years ago

In 5787:

Tests: Test test_bbp_get_all_child_ids() for bbp_get_all_child_ids()

Props thebrandonallen, netweb. See #2810, #2801

#20 @netweb
4 years ago

In 5791:

Tests: Tests for the common component query functions

  • public function test_bbp_get_public_child_ids() for bbp_get_public_child_ids()
  • public function test_bbp_get_public_child_count() for bbp_get_public_child_count()

Props thebrandonallen, netweb. See #2801

#21 @netweb
4 years ago

In 5792:

Tests: Updated forum component count functions tests

Props thebrandonallen, netweb. See #2801

#22 @netweb
4 years ago

In 5888:

Bumps: Normalize type-casting in bbp_bump_user_reply_count() missed in r5732

See #2801

#23 @netweb
4 years ago

In 5920:

Tests: Introduce generic tests to test topic counts with various new, spam, trash, delete, and approve reply actions

Props thebrandonallen. See #2801.

#24 @netweb
4 years ago

In 5921:

Tests: Introduce generic tests to test forum counts with various new, spam, trash, and approve topic actions

Props thebrandonallen. See #2801.

#25 @netweb
4 years ago

In 5923:

Forums: Improve type-casting in forum functions.

Props thebrandonallen. See #2801.

#26 @netweb
4 years ago

In 5924:

Replies: Improve type-casting in bbp_update_reply_topic_id() missed in r5737

Props thebrandonallen. See #2801.

#27 @netweb
4 years ago

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

Thats everything now done from 2801.01.patch and 2801.02.patch patches except for:

  • I didn't add BBP_Tests_Forums_Functions_Counts::test_bbp_move_topic_counts because this is already covered in BBP_Tests_Topics_Functions_Topic::test_bbp_move_topic_handler
  • I didn't add BBP_Tests_Forums_Functions_Counts::test_bbp_forum_deleted_topic_counts because not all post data is removed from from the db for some reason, though this should be fixed by allowing our tests to use bbp_trash_topic(), bbp_untrash_topic(), bbp_delete_Topic(), bbp_trash_reply(), bbp_untrash_reply(), and bbp_delete_reply as these are currently unable to be used in our tests for some reason, including when used by a keymaster user ¯\_(ツ)_/¯

Marking this now as fixed, for any issues arising please create a new ticket.

Thanks again for all these thebrandonallen :)

#28 @johnjamesjacoby
4 weeks ago

Assigning all closed & unassigned tickets in the 2.6 milestone to myself.

Note: See TracTickets for help on using tickets.