3 # This file is part of Audio::MPD
4 # Copyright (c) 2007 Jerome Quelin, all rights reserved.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the same terms as Perl itself.
17 # are we able to test module?
18 eval 'use Audio::MPD::Test';
19 plan skip_all => $@ if $@ =~ s/\n+Compilation failed.*//s;
25 # testing constructor defaults.
26 $mpd = Audio::MPD->new;
27 is( $mpd->_host, 'localhost', 'host defaults to localhost' );
28 is( $mpd->_port, 6600, 'port defaults to 6600' );
29 is( $mpd->_password, '', 'password default to empty string' );
30 isa_ok( $mpd, 'Audio::MPD', 'object creation' );
34 # changing fake mpd config to test constructor.
37 customize_test_mpd_configuration($port);
42 # testing constructor params.
43 $mpd = Audio::MPD->new('127.0.0.1', $port, 'foobar' );
44 is( $mpd->_host, '127.0.0.1', 'host set to param' );
45 is( $mpd->_port, $port, 'port set to param' );
46 is( $mpd->_password, 'foobar', 'password set to param' );
49 # testing constructor environment defaults...
50 $ENV{MPD_HOST} = '127.0.0.1';
51 $ENV{MPD_PORT} = $port;
52 $ENV{MPD_PASSWORD} = 'foobar';
53 $mpd = Audio::MPD->new;
54 is( $mpd->_host, $ENV{MPD_HOST}, 'host default to $ENV{MPD_HOST}' );
55 is( $mpd->_port, $ENV{MPD_PORT}, 'port default to $ENV{MPD_PORT}' );
56 is( $mpd->_password, $ENV{MPD_PASSWORD}, 'port default to $ENV{MPD_PASSWORD}' );
58 delete $ENV{MPD_HOST};
59 delete $ENV{MPD_PORT};
60 delete $ENV{MPD_PASSWORD};