Skip to:
Content

BuddyPress.org

Changeset 8708


Ignore:
Timestamp:
07/28/2014 10:51:54 AM (10 years ago)
Author:
djpaul
Message:

Activity: fix unit tests (broken in r8697) by making sure BP_Activity_Activity returns integers for integer DB columns.

r8697 changed a == check to a stricter === check. When an activity item was fetched by creating a BP_Activity_Activity object, properties that were stored in the DB in integer columns were being returned by strings, and this caused the unit tests to fail. This change explicitly casts these properties as integers before the object is returned.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-classes.php

    r8541 r8708  
    147147
    148148        if ( ! empty( $row ) ) {
    149             $this->id                = $row->id;
    150             $this->item_id           = $row->item_id;
    151             $this->secondary_item_id = $row->secondary_item_id;
    152             $this->user_id           = $row->user_id;
     149            $this->id                = (int) $row->id;
     150            $this->item_id           = (int) $row->item_id;
     151            $this->secondary_item_id = (int) $row->secondary_item_id;
     152            $this->user_id           = (int) $row->user_id;
    153153            $this->primary_link      = $row->primary_link;
    154154            $this->component         = $row->component;
     
    158158            $this->date_recorded     = $row->date_recorded;
    159159            $this->hide_sitewide     = $row->hide_sitewide;
    160             $this->mptt_left         = $row->mptt_left;
    161             $this->mptt_right        = $row->mptt_right;
     160            $this->mptt_left         = (int) $row->mptt_left;
     161            $this->mptt_right        = (int) $row->mptt_right;
    162162            $this->is_spam           = $row->is_spam;
    163163        }
Note: See TracChangeset for help on using the changeset viewer.