Opened 11 years ago
Closed 11 years ago
#5419 closed enhancement (fixed)
Object cache active notice
Reported by: | r-a-y | Owned by: | r-a-y |
---|---|---|---|
Milestone: | 2.0 | Priority: | normal |
Severity: | normal | Version: | 1.0 |
Component: | Messages | Keywords: | has-patch |
Cc: |
Description
When a user is logged in, we always fetch the active notice.
Let's object cache this unnecessary query as notices rarely change.
Attachments (1)
Change History (4)
#2
@
11 years ago
Unit test looks fine to me. Theoretically you could split it into two tests, but it's fine to put them together. (Only practical difference is that when you do multiple assertions in a single test, and one fails, the rest of the assertions in that test are not run. So if you're going to put them together, make sure they're closely linked and would likely be broken by the same bug.)
I'm pretty sure do_action_ref_array()
is not necessary here. do_action( 'messages_notice_before_delete', $this )
will pass the object by reference automatically, as of PHP 5.0.
Attached patch:
'messages_notice_before_delete'
to do something before a notice is deletedget_active()
methodI guess what I need feedback on is the unit test. Should I be putting all the asserts in my one method? Or should I split them up into a different file? I kind of lumped them altogether since the asserts are related to one another.