Opened 10 years ago
Closed 9 years ago
#6128 closed defect (bug) (fixed)
buddypress()->activity->actions in unit tests
Reported by: | imath | Owned by: | imath |
---|---|---|---|
Milestone: | 2.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | 2nd-opinion |
Cc: |
Description
If you look at #6126, you'll see that i've discovered a trouble when directly using BP_Activity_Activity( $id )
. I've found this bug lately because when running the complete tests suite, everything seemed to work fine. It's only when i've run only a couple of tests i've discovered this issue.
The problem was located in tests where i wasn't resetting the global buddypress()->activity->actions
the right way. As a result the following tests were not only dealing with the default activity actions but also with post types activities actions.
I've also discovered some other troubles like the fact once a post type (for instance the 'page' one) were added to the post types to track, some bp_activity
properties were still set for the following tests.
So i've edited each test and made sure the globals were properly reset -> see *.pertest.patch
But as boonebgorges suggested in this comment, i think we should use the BP_UnitTestCase->setUp()
method to be sure for the future tests we'll build we won't have to think about how to completely reset globals a test about post types activities edited. This way each new test will always get a default buddypress()->activity->actions
. -> see *.setUp.patch
What do you think ?
Let's see this in 2.3