Exemple #1
0
 public function testUserNotLinkedTo()
 {
     $userProfile = new \Hybrid_User_Profile();
     $userProfile->identifier = null;
     $this->hybridAuthMock->method('authenticate')->willReturn(new \Hybrid_Provider_Adapter());
     $this->authAdapterMock->method('getUserProfile')->willReturn($userProfile);
     $this->assertInstanceOf('\\Hybrid_Auth', $this->hybridAuthMock);
     $provider = new AuthProvider('Facebook');
     $provider->setResponse($this->getApp());
     $provider->setHybridauth($this->hybridAuthMock);
     $provider->setAuthAdapter($this->authAdapterMock);
     try {
         $provider->authProcess();
     } catch (RedirectException $red) {
     } catch (\Exception $e) {
     }
     $message = Messages::pop();
     $this->assertEquals("First you need to be linked to Facebook", $message->text);
 }
Exemple #2
0
<?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;
    };
};