Branch Coverage

blib/lib/Mojolicious/Plugin/PubSubHubbub.pm
Criterion Covered Total %
branch 105 172 61.0


line true false branch
37 1 2 if (my $config_param = $mojo->config('PubSubHubbub'))
44 2 1 unless (exists $helpers->{'callback'})
52 2 1 unless (exists $helpers->{'endpoint'})
65 2 1 if ($param->{'hub'})
73 1 2 if ($param->{'lease_seconds'})
86 1 1 unless $param eq 'cb'
97 9 9 if $c->param('hub.mode')
137 1 2 unless @_ or not $plugin->hub
155 0 2 if index($plugin->hub, 'https') == 0
164 0 2 unless ($res)
170 2 0 if $res->is_success
183 4 3 if ($c->param('hub.topic') and $c->param('hub.challenge') and $c->param('hub.mode') =~ /^(?:un)?subscribe$/u)
195 8 12 if $c->param("hub.$_")
204 2 2 if $ok
230 0 11 if ref $_
233 7 4 if ($_ =~ /^\<([^>]+?)\>(.*?rel\s*=\s*"(self|hub|alternate)".*?)$/imu)
242 4 3 if ($check =~ /type\s*=\s*"([^"]+?)"/imou)
244 0 4 if $type and not $type =~ /$FEED_TYPE_RE/u
250 5 2 if ($check =~ /title\s*=\s*"([^"]+?)"/imou)
255 3 4 unless ($link{'short_type'})
256 1 2 if $link{'href'} =~ /$FEED_ENDING_RE/u
283 0 13 if $type and not $type =~ /$FEED_TYPE_RE/u
286 8 5 if $1
288 0 13 unless $href and $rel
294 8 5 if ($short_type) { }
297 2 3 if $href =~ /\.(r(?:ss|df)|atom)$/iu
306 10 3 if $title
307 8 5 if $type
327 2 1 if ($links->{'self'})
332 0 2 if ($link->{'short_type'} and not $topic->{'short_type'})
339 3 0 if ($links->{'hub'})
344 0 3 if ($link->{'short_type'} and not $hub->{'short_type'})
351 2 1 if $topic and $hub
357 1 0 if ($alternate)
364 5 0 do { $link->{'title'} =~ /(?i:feed|stream)/iu } ? :
5 0 $link->{'title'} ? :
372 2 3 if ($link->{'title'} =~ /[ck]omment/iu) { }
392 3 5 if ($Mojolicious::Plugin::PubSubHubbub::a->{'pref'} < $Mojolicious::Plugin::PubSubHubbub::b->{'pref'}) { }
1 4 elsif ($Mojolicious::Plugin::PubSubHubbub::a->{'pref'} > $Mojolicious::Plugin::PubSubHubbub::b->{'pref'}) { }
4 0 elsif ($Mojolicious::Plugin::PubSubHubbub::a->{'short_type'} gt $Mojolicious::Plugin::PubSubHubbub::b->{'short_type'}) { }
0 0 elsif ($Mojolicious::Plugin::PubSubHubbub::a->{'short_type'} lt $Mojolicious::Plugin::PubSubHubbub::b->{'short_type'}) { }
0 0 elsif (length $Mojolicious::Plugin::PubSubHubbub::a->{'href'} > length $Mojolicious::Plugin::PubSubHubbub::b->{'href'}) { }
0 0 elsif (length $Mojolicious::Plugin::PubSubHubbub::a->{'href'} <= length $Mojolicious::Plugin::PubSubHubbub::b->{'href'}) { }
431 0 0 unless $_[0]
434 0 0 unless my $base = 'Mojo::URL'->new(shift())
451 0 0 unless ($tx->error)
465 0 0 unless ($topic and $hub)
476 0 0 if ($topic and not $hub)
491 0 0 if ($tx->error) { }
505 0 0 unless ($ntopic and $hub)
522 0 0 if $hub
525 0 0 if ($ntopic) { }
0 0 elsif ($topic) { }
549 0 8 unless ($param{'callback'} ||= $c->endpoint('pubsub-callback'))
550 0 0 if $log->error('You have to specify a callback endpoint')
554 2 4 unless (exists $param{'topic'} and $param{'topic'} =~ m[^https?://]iu and exists $param{'hub'})
564 0 0 if (exists $param{'lease_seconds'} and $mode eq 'unsubscribe' || !($param{'lease_seconds'} =~ /^\d+$/u))
571 2 2 if $mode eq 'subscribe'
576 10 0 if exists $param{$_} and $param{$_}
584 0 4 exists $param{'verify_token'} ? :
609 0 4 unless ($res)
611 0 0 if index($param{'hub'}, 'https') == 0
622 2 2 $res->is_success ? :
624 0 4 if wantarray
639 4 5 if ($ct =~ m[^application/atom\+xml]u) { }
3 2 elsif ($ct =~ m[^application/r(?:ss|df)\+xml]u) { }
650 1 1 if $c->req->body
663 0 7 unless $topics->[0]
676 0 7 unless scalar @$topics
681 3 4 if ($secret)
684 3 0 unless (_check_signature($c, $secret))
696 3 1 if (@$topics != @old_topics)
720 10 0 if $links
726 10 0 if ($links->size != $entries->size)
737 10 0 if ($link) { }
0 0 elsif (not $self_href and $type eq 'rss') { }
746 0 0 if $link
750 10 0 if $self_href
756 10 0 if $links
760 10 0 if (@topics > 1)
784 39 0 if (my $sources = $entry->find('source'))
786 26 0 if $s->namespace eq $atom_ns
791 26 13 $source ? :
829 6 12 if (exists $allowed{$href}) { }
853 1 2 unless $signature
872 7 0 if ($x_hub_on_behalf_of and $x_hub_on_behalf_of =~ s/^\s*(\d+)\s*$/$1/u)