/**
  * Set up a test case.
  *
  * @see WP_UnitTestCase::setup()
  */
 public function setUp()
 {
     parent::setUp();
     $this->provider = Two_Factor_Sms::get_instance();
 }
 /**
  * Generate and sms the user token.
  *
  * @since 0.1-dev
  *
  * @param WP_User $user WP_User object of the logged-in user.
  * @return boolean
  */
 public function generate_and_sms_token($user)
 {
     require_once TWO_FACTOR_SMS_DIR . 'includes/Twilio/Services/Twilio.php';
     $sid = get_user_meta($user->ID, self::ACCOUNT_SID_META_KEY, true);
     $token = get_user_meta($user->ID, self::AUTH_TOKEN_META_KEY, true);
     $sender = get_user_meta($user->ID, self::SENDER_NUMBER_META_KEY, true);
     $receiver = get_user_meta($user->ID, self::RECEIVER_NUMBER_META_KEY, true);
     self::$twilio = new Services_Twilio($sid, $token);
     $code = $this->generate_token($user->ID);
     try {
         $message = self::$twilio->account->messages->create(array('From' => $sender, 'To' => $receiver, 'Body' => wp_strip_all_tags(sprintf(__('Your login confirmation code for %s is %s.', 'two-factor-sms'), get_bloginfo('name'), $code))));
     } catch (Services_Twilio_RestException $e) {
         return false;
     }
     return true;
 }