Changeset 7087 for trunk/tests/testcases/groups/template.php
- Timestamp:
- 05/19/2013 12:09:30 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/testcases/groups/template.php
r7086 r7087 35 35 $this->assertEquals( $ids, array( $g1, ) ); 36 36 } 37 38 /** 39 * Integration test to make sure order and orderby are interpreted when 40 * no 'type' value has been passed 41 * 42 * @group bp_has_groups 43 */ 44 public function test_bp_has_groups_with_order_orderby_with_null_type() { 45 $g1 = $this->factory->group->create( array( 46 'name' => 'AAAAA', 47 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 100 ), 48 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000000 ), 49 ) ); 50 $g2 = $this->factory->group->create( array( 51 'name' => 'BBBBB', 52 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 1000000 ), 53 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 10000 ), 54 ) ); 55 $g3 = $this->factory->group->create( array( 56 'name' => 'CCCCC', 57 'date_created' => gmdate( 'Y-m-d H:i:s', time() - 10000 ), 58 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 10 ), 59 ) ); 60 61 global $groups_template; 62 bp_has_groups( array( 63 'order' => 'ASC', 64 'orderby' => 'name', 65 ) ); 66 67 $ids = wp_parse_id_list( wp_list_pluck( $groups_template->groups, 'id' ) ); 68 $this->assertEquals( array( $g1, $g2, $g3, ), $ids ); 69 } 70 71 /** 72 * Integration test to make sure 'order' is set to 'DESC' and 'orderby' 73 * to 'last_activity' when no type or order/orderby params are passed. 74 * This ensures backpat with the old system, where 'active' was the 75 * default type param, and there were no order/orderby params. 76 * 77 * @group bp_has_groups 78 */ 79 public function test_bp_has_groups_defaults_to_DESC_last_activity_for_default_type_active_backpat() { 80 $g1 = $this->factory->group->create( array( 81 'name' => 'AAAAA', 82 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 100 ), 83 ) ); 84 $g2 = $this->factory->group->create( array( 85 'name' => 'BBBBB', 86 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000000 ), 87 ) ); 88 $g3 = $this->factory->group->create( array( 89 'name' => 'CCCCC', 90 'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 10000 ), 91 ) ); 92 93 global $groups_template; 94 bp_has_groups(); 95 96 $ids = wp_parse_id_list( wp_list_pluck( $groups_template->groups, 'id' ) ); 97 $this->assertEquals( array( $g1, $g3, $g2, ), $ids ); 98 } 99 37 100 }
Note: See TracChangeset
for help on using the changeset viewer.