diff --git a/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm b/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm index cf6a07a8ea3783e6a55f5cdcf6655401e84aaf2c..88210f501608d6c1f13598d7a5bee7a41da4a4bf 100644 --- a/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm +++ b/modules/Bio/EnsEMBL/DBSQL/DBConnection.pm @@ -526,6 +526,21 @@ sub username { $self->{_username}; } +=head2 user + + Arg [1] : (optional) string $arg + The new value of the username used by this connection. + Example : $user = $db_connection->user() + Description: Convenience alias for the username method + Returntype : String + +=cut + +sub user { + my ($self, $arg) = @_; + return $self->username($arg); +} + =head2 host @@ -550,6 +565,21 @@ sub host { $self->{_host}; } +=head2 hostname + + Arg [1] : (optional) string $arg + The new value of the host used by this connection. + Example : $hostname = $db_connection->hostname() + Description: Convenience alias for the host method + Returntype : String + +=cut + +sub hostname { + my ($self, $arg) = @_; + return $self->host($arg); +} + =head2 password @@ -582,7 +612,20 @@ sub password { return ( ref( $self->{_password} ) && &{ $self->{_password} } ) || ''; } +=head2 pass + Arg [1] : (optional) string $arg + The new value of the password used by this connection. + Example : $pass = $db_connection->pass() + Description: Convenience alias for the password method + Returntype : String + +=cut + +sub pass { + my ($self, $arg) = @_; + return $self->password($arg); +} =head2 disconnect_when_inactive diff --git a/modules/t/dbConnection.t b/modules/t/dbConnection.t index c448cf4f26c5e1935583342c5c6b18365fb3201b..cd9d569420752cd95f2ce815138beec619c85bf0 100644 --- a/modules/t/dbConnection.t +++ b/modules/t/dbConnection.t @@ -79,17 +79,25 @@ ok(test_getter_setter($dbc, 'dbname' , 'ensembl_db_name')); # 6 username # ok(test_getter_setter($dbc, 'username', 'ensembl_user')); +is($dbc->user(), $dbc->username(), 'Checking user() returns same as username()'); # # 7 password # ok(test_getter_setter($dbc, 'password', 'ensembl_password')); +is($dbc->pass(), $dbc->password(), 'Checking pass() returns same as password()'); # # 10 dbhandle # ok(test_getter_setter($dbc, 'db_handle', $dbc->db_handle)); +# +# dbname +# +ok(test_getter_setter($dbc, 'host', $dbc->host)); +is($dbc->hostname(), $dbc->host(), 'Checking hostname() returns same as host()'); + # Check the to_hash() works is_deeply($dbc->to_hash(), \%dbc_args, 'Checking to_hash() can roundtrip a DBConnection');