Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 9 years ago

#6128 closed defect (bug) (fixed)

buddypress()->activity->actions in unit tests

Reported by: imath's profile imath Owned by: imath's profile 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 ?

Attachments (2)

6128.pertest.patch (9.5 KB) - added by imath 10 years ago.
6128.setUp.patch (9.0 KB) - added by imath 10 years ago.

Download all attachments as: .zip

Change History (8)

@imath
10 years ago

@imath
10 years ago

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


10 years ago

#2 @imath
10 years ago

  • Milestone changed from 2.2 to 2.3

Let's see this in 2.3

#3 @imath
9 years ago

  • Milestone changed from 2.3 to Future Release

#4 @DJPaul
9 years ago

  • Keywords has-patch removed

#5 @imath
9 years ago

  • Milestone changed from Future Release to 2.5

#6 @imath
9 years ago

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

In 10545:

Post Type Activities: add unit tests and improve existing ones.

See #6482
Fixes #6128

Note: See TracTickets for help on using tickets.