Example #1
0
 /**
  *	@group CallsExternalResource
  */
 public function testFbInfoFetcherRetrievesLargeFriendsPicture()
 {
     $mockedTaggableUserLargePictureResponse = $this->getMockedTaggableUserLargePictureResponse();
     $mockedFbSdk = m::mock('SammyK\\LaravelFacebookSdk\\LaravelFacebookSdk');
     $mockedFbSdk->shouldReceive('getAccessTokenFromRedirect')->andReturn('token');
     $mockedFbSdk->shouldReceive('setDefaultAccessToken');
     $mockedFbSdk->shouldReceive('get')->with('/me/taggable_friends?fields=AaJHN8mN4LZ1kYtjE7AkLUZFvAk5hZ3YZajOd50BzAoDVncA_7r2AnM8cVh_f_Bk6FX4LDo3CpvHslCfLO2DFi0r7QGmdioYYKW0LDce7HoYbg,picture.height(720).width(720)')->andReturn($mockedTaggableUserLargePictureResponse);
     $fetcherInstance = new FbInfoFetcher($mockedFbSdk);
     $image = $fetcherInstance->getTaggableFriendsPictureById('AaJHN8mN4LZ1kYtjE7AkLUZFvAk5hZ3YZajOd50BzAoDVncA_7r2AnM8cVh_f_Bk6FX4LDo3CpvHslCfLO2DFi0r7QGmdioYYKW0LDce7HoYbg');
     $this->assertInstanceOf(Intervention\Image\Image::class, $image);
 }
Example #2
0
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::get('facebook_test', function () {
    return View::make('facebook_test');
});
Route::get('/facebook/login', function (SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb) {
    // Send an array of permissions to request
    $login_url = $fb->getLoginUrl(['email', 'user_photos', 'user_friends', 'publish_actions']);
    // Obviously you'd do this in blade :)
    echo '<a href="' . $login_url . '">Login with Facebook</a>';
});
Route::get('/facebook/callback', function (SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb) {
    $fbInfoFetcherInstance = new FbInfoFetcher($fb);
    $accessToken = $fbInfoFetcherInstance->getAccessToken();
    $friendsArray = $fbInfoFetcherInstance->getAuthorizedUsersFriendsArray();
    $firstFriend = $friendsArray[0];
    $friendsName = $firstFriend->getProperty('name');
    $posterInstance = new FbPoster($fb);
    $posterInstance->postMessageWithLinkAndPictureOnAuthorizedUsersFeed('message_tesss', 'http://www.onet.pl/', 'https://maxwelldemon.files.wordpress.com/2012/03/2x1-rectangle.png');
    //$imageInstance = $fbInfoFetcherInstance->getTaggableFriendsPictureById($friendsId);
    //return $imageInstance->response('png');
});