| 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 => 3; |
| 5 | |
| 6 | use MediaWiki::Botscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/; |
| 7 | my $t = __FILE__scip-perl cpan MediaWiki-Bot 5.007000 main/__FILE__().; |
| 8 | |
| 9 | my $bot = MediaWiki::Bot->newscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/new().({ |
| 10 | agent => "MediaWiki::Bot tests (https://metacpan.org/MediaWiki::Bot; $t)", |
| 11 | host => 'test.wikipedia.org', |
| 12 | }); |
| 13 | |
| 14 | my @categories = $bot->get_all_categoriesscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/get_all_categories().; |
| 15 | okscip-perl cpan MediaWiki-Bot 5.007000 main/ok().(@categories, "Retrieved categories"); |
| 16 | isscip-perl cpan MediaWiki-Bot 5.007000 main/is().(scalarscip-perl cpan MediaWiki-Bot 5.007000 main/scalar(). @categories, 10, "Got right default number"); |
| 17 | |
| 18 | @categories = $bot->get_all_categoriesscip-perl cpan MediaWiki-Bot 5.007000 MediaWiki/Bot/get_all_categories().({max => 0}); |
| 19 | isscip-perl cpan MediaWiki-Bot 5.007000 main/is().(scalarscip-perl cpan MediaWiki-Bot 5.007000 main/scalar(). @categories, 500, "Got right maximum number"); |