migrate Account Friends sentFriendRequest to FB
This commit is contained in:
parent
b5c1ffe5b7
commit
8299e9e706
3 changed files with 59 additions and 17 deletions
|
|
@ -16,6 +16,7 @@ use strict;
|
|||
use Test::More;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Test::Mechanize;
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Init
|
||||
|
|
@ -25,7 +26,7 @@ my $session = WebGUI::Test->session;
|
|||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
|
||||
plan tests => 7; # Increment this number for each test you create
|
||||
plan tests => 11; # Increment this number for each test you create
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test the creation of WebGUI::Account::Friends
|
||||
|
|
@ -67,4 +68,37 @@ is( $account->getUrl( 'op=account' ), $session->url->page( 'op=account' ),
|
|||
'getUrl doesnt add op=account if already exists'
|
||||
);
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Test the send friend request form
|
||||
|
||||
# Start a session
|
||||
my $mech = WebGUI::Test::Mechanize->new( config => WebGUI::Test->file );
|
||||
$mech->get_ok( '/' );
|
||||
|
||||
# Get our admin
|
||||
my $admin = WebGUI::User->new( $mech->session, "3" );
|
||||
|
||||
# Add a user who can be a friend for admin
|
||||
my $edgar_friendly = WebGUI::Test->user( username => 'edgarfriendly', ableToBeFriend => 1 );
|
||||
$edgar_friendly = WebGUI::User->new( $mech->session, $edgar_friendly->getId ); # fix the session
|
||||
|
||||
# Add a user who is not very nice
|
||||
my $simon_phoenix = WebGUI::Test->user( username => 'simonphoenix', ableToBeFriend => 0 );
|
||||
$simon_phoenix = WebGUI::User->new( $mech->session, $simon_phoenix->getId ); # fix the session
|
||||
|
||||
$mech->session->user({ user => $admin });
|
||||
|
||||
$mech->get_ok( "/?op=account;module=friends;do=sendFriendsRequest;uid=" . $edgar_friendly->getId, "get send request form" );
|
||||
$mech->submit_form_ok(
|
||||
{
|
||||
form_name => "messageForm",
|
||||
fields => { }, # keep the defaults
|
||||
},
|
||||
"submit send request form",
|
||||
);
|
||||
|
||||
my $friend = WebGUI::Friends->new($mech->session);
|
||||
ok( $friend->isInvited($edgar_friendly->getId), "invitation was sent" );
|
||||
|
||||
|
||||
#vim:ft=perl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue