예제 #1
0
 public function testFbPosterPostMessageWithLinkOnAuthorizedUsersFeed()
 {
     $mockedSdk = m::mock('SammyK\\LaravelFacebookSdk\\LaravelFacebookSdk');
     $requestParams = ['message' => 'This is a test message.', 'link' => 'http://www.onet.pl/'];
     $mockedSdk->shouldReceive('post')->once()->with('/me/feed', $requestParams);
     $instance = new FbPoster($mockedSdk);
     $instance->postMessageWithLinkOnAuthorizedUsersFeed('This is a test message.', 'http://www.onet.pl/');
 }
예제 #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');
});