/** * Allows a model to use a user id, in addition to email and username, as unique identifier. * * @param mixed unique value * @return string field name */ public function unique_key($value) { return (is_int($value)) ? 'id' : parent::unique_key($value); }
/** * * @dataProvider provider_unique_key */ public function test_unique_key($value, $expected_attribute) { $this->assertEquals($expected_attribute, Model_Auth_User::unique_key($value)); }