Debian Codegraph @

t/17-was_blocked.t

raw symbols SCIP
1 use strictscip-perl cpan MediaWiki-Bot 5.007000 strict/;
2 use warningsscip-perl cpan MediaWiki-Bot 5.007000 warnings/;
3 use Test::RequiresInternetscip-perl cpan MediaWiki-Bot 5.007000 Test/RequiresInternet/ 'test.wikipedia.org' => 80;
4 use Test::Morescip-perl cpan MediaWiki-Bot 5.007000 Test/More/ tests => 6;
5 use Test::Warnscip-perl cpan MediaWiki-Bot 5.007000 Test/Warn/;
6
7 use MediaWiki::Botscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/;
8 my $t = __FILE__scip-perl cpan MediaWiki-Bot 5.007000 main/__FILE__().;
9
10 my $bot = MediaWiki::Bot->newscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/new().({
11 agent => "MediaWiki::Bot tests (https://metacpan.org/MediaWiki::Bot; $t)",
12 host => 'test.wikipedia.org',
13 });
14
15 {
16 my $user = 'Bad Username'; # has been blocked before
17 my $result = $bot->was_blockedscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/was_blocked().($user);
18 my $bc;
19 warning_isscip-perl cpan MediaWiki-Bot 5.007000 main/warning_is().(
20 sub { $bc = $bot->test_block_histscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/test_block_hist().($user); },
21 'test_block_hist is an alias of was_blocked; please use the new method name. This alias might be removed in a future release',
22 'test_block_hist is deprecated'
23 );
24 okscip-perl cpan MediaWiki-Bot 5.007000 main/ok().($result, 'block history - has been blocked');
25 isscip-perl cpan MediaWiki-Bot 5.007000 main/is().($result, $bc, 'BC method agrees with current method');
26 }
27
28 {
29 my $user = 'Mike.lifeguard'; # I haven't ever been blocked
30 my $result = $bot->was_blockedscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/was_blocked().($user);
31 my $bc;
32 warning_isscip-perl cpan MediaWiki-Bot 5.007000 main/warning_is().(
33 sub { $bc = $bot->test_block_histscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/test_block_hist().($user); },
34 'test_block_hist is an alias of was_blocked; please use the new method name. This alias might be removed in a future release',
35 'test_block_hist is deprecated'
36 );
37 okscip-perl cpan MediaWiki-Bot 5.007000 main/ok().(!$result, 'block history - never blocked');
38 isscip-perl cpan MediaWiki-Bot 5.007000 main/is().($result, $bc, 'BC method agrees with current method');
39 }