Debian Codegraph @

t/18-is_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 # Jimbo is almost certainly not blocked right now
17 my $result = $bot->is_blockedscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/is_blocked().('Jimbo Wales');
18 my $bc;
19 warning_isscip-perl cpan MediaWiki-Bot 5.007000 main/warning_is().(
20 sub { $bc = $bot->test_blockedscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/test_blocked().('User:Jimbo Wales'); },
21 'test_blocked is an alias of is_blocked; please use the new name. This alias might be removed in a future release',
22 'test_blocked is deprecated'
23 );
24 okscip-perl cpan MediaWiki-Bot 5.007000 main/ok().(!$result, 'current blocks');
25 isscip-perl cpan MediaWiki-Bot 5.007000 main/is().($result, $bc, 'BC method returned the same as the current method');
26 }
27
28 {
29 # A random old account I chose - it will probably be blocked forever
30 # (del/undel) 21:48, July 26, 2008 Cometstyles (talk | contribs | block) blocked Hiwhispees (talk | contribs) with an expiry time of infinite (account creation disabled, e-mail blocked) ‎ (bye grawp) (unblock | change block)
31 my $result = $bot->is_blockedscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/is_blocked().('User:Hiwhispees~testwiki');
32 my $bc;
33 warning_isscip-perl cpan MediaWiki-Bot 5.007000 main/warning_is().(
34 sub { $bc = $bot->test_blockedscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/test_blocked().('Hiwhispees~testwiki'); },
35 'test_blocked is an alias of is_blocked; please use the new name. This alias might be removed in a future release',
36 'test_blocked is deprecated'
37 );
38 okscip-perl cpan MediaWiki-Bot 5.007000 main/ok().($result, 'current blocks');
39 isscip-perl cpan MediaWiki-Bot 5.007000 main/is().($result, $bc, 'BC method returned the same as the current method');
40 }