diff --git a/modules/profile/profile.pages.inc b/modules/profile/profile.pages.inc index 3462232859ed324b0b5389af99745ab58d9f0324..023b2357ca57ef987cd9bd1a2344054b6d028343 100644 --- a/modules/profile/profile.pages.inc +++ b/modules/profile/profile.pages.inc @@ -33,7 +33,7 @@ function profile_browse() { ':visibility' => PROFILE_PUBLIC_LISTINGS, ))->fetchAll(); - $query = db_select('users')->extend('PagerDefault'); + $query = db_select('users', 'u')->extend('PagerDefault'); $query->join('profile_value', 'v', 'u.uid = v.uid'); $query ->fields('u', array('uid', 'access')) diff --git a/modules/profile/profile.test b/modules/profile/profile.test index c375fb3a1d377b1a9ddd4d2e3ca5658dcc2cd391..61709d34a8c3d833a72f928a64b438b4eff57462 100644 --- a/modules/profile/profile.test +++ b/modules/profile/profile.test @@ -394,10 +394,37 @@ class ProfileBlockTestCase extends DrupalWebTestCase { } } +/** + * Test profile browsing. + */ +class ProfileTestBrowsing extends ProfileTestCase { + public static function getInfo() { + return array( + 'name' => 'Profile browsing', + 'description' => 'Test profile browsing.', + 'group' => 'Profile', + ); + } + + /** + * Test profile browsing. + */ + function testProfileBrowsing() { + $this->drupalLogin($this->admin_user); + $field = $this->createProfileField('list', 'simpletest', array('page' => '%value')); + + // Set a random value for the profile field. + $value = $this->setProfileField($field); + + // Check that user is found on the profile browse page. + $this->drupalGet("profile/{$field['form_name']}/$value"); + $this->assertText($this->normal_user->name); + } +} + /** * TODO: * - Test field visibility - * - Test profile browsing * - Test required fields * - Test fields on registration form * - Test updating fields