NAME

Test::MobileAgent - set environmental variables to mock HTTP::MobileAgent

SYNOPSIS

use Test::More;
use Test::MobileAgent;
use HTTP::MobileAgent;

# Case 1: you can simply pass a vendor name in lower case.
{
  local %ENV;
  test_mobile_agent('docomo');

  my $ua = HTTP::MobileAgent->new;
  ok $ua->is_docomo;
}

# Case 2: also with some hint to be more specific.
{
  local %ENV;
  test_mobile_agent('docomo.N503');

  my $ua = HTTP::MobileAgent->new;
  ok $ua->is_docomo;
}

# Case 3: you can pass a full name of an agent.
{
  local %ENV;
  test_mobile_agent('DoCoMo/3.0/N503');

  my $ua = HTTP::MobileAgent->new;
  ok $ua->is_docomo;
}

# Case 4: you can also pass extra headers.
{
  local %ENV;
  test_mobile_agent('DoCoMo/3.0/N503',
    x_dcmguid => 'STFUWSC',
  );

  my $ua = HTTP::MobileAgent->new;
  ok $ua->is_docomo;
  ok $ua->user_id;   # STFUWSC
}

# Case 5: you need an HTTP::Headers compatible object?
my $headers = test_mobile_agent_headers('docomo.N503');
my $ua = HTTP::MobileAgent->new($headers);

# Case 6: or just a hash of environmental variables?
my %env = test_mobile_agent_env('docomo.N503');
my $req = Plack::Request->new({ %plack_env, %env });

DESCRIPTION

This module helps to test applications that use HTTP::MobileAgent. See the SYNOPSIS for usage.

METHODS

test_mobile_agent

test_mobile_agent_env

test_mobile_agent_headers

test_mobile_agent_list

TO DO

This can be a bit more powerful if you can pass something like an asset file of Moxy to configure.

SEE ALSO

HTTP::MobileAgent, Moxy

REPOSITORY

I am not a heavy user of mobile phones nor HTTP::MobileAgent. Patches are always welcome :)

http://github.com/charsbar/test-mobileagent

AUTHOR

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Kenichi Ishigaki.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.