PageRenderTime 22ms CodeModel.GetById 17ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/3.2/t/41_test_image_exists.t

http://perlwikipedia.googlecode.com/
Unknown | 28 lines | 20 code | 8 blank | 0 comment | 0 complexity | 03ae1d29749437aa2f2908ae8af7b5a2 MD5 | raw file
Possible License(s): GPL-3.0
 1# Before `make install' is performed this script should be runnable with
 2# `make test'. After `make install' it should work as `perl MediaWiki::Bot.t'
 3
 4#########################
 5
 6use strict;
 7use warnings;
 8use Test::More tests => 4;
 9
10#########################
11
12use MediaWiki::Bot;
13
14my $bot = MediaWiki::Bot->new({
15    agent   => 'MediaWiki::Bot tests (41_test_image_exists.t)',
16});
17
18my @images = (  'File:D2c6ac30964d4348d1a2b3ff7e97fa08.png',
19                'File:Windows 7.png',
20                'File:Albert Einstein Head.jpg', );
21
22is($bot->test_image_exists($images[0]),    0,  'Nonexistent image not found');
23is($bot->test_image_exists($images[1]),    1,  'Image is local');
24is($bot->test_image_exists($images[2]),    2,  'Image is on Commons');
25
26my $is = $bot->test_image_exists(\@images);
27my $ought = [0, 1, 2];
28is_deeply($is, $ought, 'Multiple images checked OK');