/**
  * Ensures that the FacebookApp and access token fall back when missing.
  *
  * @param FacebookRequest $request
  *
  * @throws FacebookSDKException
  */
 public function addFallbackDefaults(FacebookRequest $request)
 {
     if (!$request->getApp()) {
         $app = $this->getApp();
         if (!$app) {
             throw new FacebookSDKException('Missing FacebookApp on FacebookRequest and no fallback detected on FacebookBatchRequest.');
         }
         $request->setApp($app);
     }
     if (!$request->getAccessToken()) {
         $accessToken = $this->getAccessToken();
         if (!$accessToken) {
             throw new FacebookSDKException('Missing access token on FacebookRequest and no fallback detected on FacebookBatchRequest.');
         }
         $request->setAccessToken($accessToken);
     }
 }
 private function assertRequestContainsAppAndToken(FacebookRequest $request, FacebookApp $expectedApp, $expectedToken)
 {
     $app = $request->getApp();
     $token = $request->getAccessToken();
     $this->assertSame($expectedApp, $app);
     $this->assertEquals($expectedToken, $token);
 }