mirror of
https://github.com/buddypress/buddypress.git
synced 2026-07-21 20:54:17 +08:00
A number of problems can arise when using a formatted group count for this comparison, because formatted counts are strings. Fixes #6813. git-svn-id: https://buddypress.svn.wordpress.org/trunk@10445 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
27 lines
704 B
PHP
27 lines
704 B
PHP
<?php
|
|
|
|
/**
|
|
* @group groups
|
|
* @covers ::groups_total_groups_for_user
|
|
*/
|
|
class BP_Tests_Groups_Functions_GroupsTotalGroupsForUser extends BP_UnitTestCase {
|
|
/**
|
|
* @ticket BP6813
|
|
*/
|
|
public function test_should_return_integer() {
|
|
$this->assertInternalType( 'int', groups_total_groups_for_user( 123 ) );
|
|
}
|
|
|
|
/**
|
|
* @ticket BP6813
|
|
*/
|
|
public function test_should_return_integer_when_fetching_from_cache() {
|
|
/*
|
|
* Put a string in the cache.
|
|
* In-memory cache will respect type, but persistent caching engines return all scalars as strings.
|
|
*/
|
|
wp_cache_set( 'bp_total_groups_for_user_123', '321', 'bp' );
|
|
|
|
$this->assertInternalType( 'int', groups_total_groups_for_user( 123 ) );
|
|
}
|
|
}
|