示例#1
0
 public function testUserAlreadyLinkedTo()
 {
     $identity = new \Application\Users\Row();
     $identity->id = 2;
     $userProfile = new \Hybrid_User_Profile();
     $userProfile->identifier = 112233;
     $this->authAdapterMock->method('getUserProfile')->willReturn($userProfile);
     $this->hybridAuthMock->method('authenticate')->willReturn(new \Hybrid_Provider_Adapter());
     $this->assertInstanceOf('\\Hybrid_Auth', $this->hybridAuthMock);
     $provider = new AuthProvider('Facebook');
     $provider->setResponse($this->getApp());
     $provider->setIdentity($identity);
     $provider->setHybridauth($this->hybridAuthMock);
     $provider->setAuthAdapter($this->authAdapterMock);
     try {
         $provider->authProcess();
     } catch (RedirectException $red) {
     } catch (\Exception $e) {
     }
     $message = Messages::pop();
     $this->assertEquals("You have already linked to Facebook", $message->text);
 }
示例#2
0
文件: auth.php 项目: Kit-kat1/bluz
<?php

/**
 * Auth controllers
 *
 * @author yuklia
 * @created  05.05.15 17:30
 */
namespace Application;

use Bluz\Proxy\Messages;
use Application\Auth\AuthProvider;
return function ($provider = '') {
    /**
     * @var Bootstrap $this
     */
    try {
        $auth = new AuthProvider($provider);
        $auth->setResponse($this);
        $auth->setIdentity($this->user());
        $auth->authProcess();
    } catch (Exception $e) {
        Messages::addError($e->getMessage());
    }
    return function () {
        return false;
    };
};