Skip to content

Commit c3a6287

Browse files
Anton ShevchukAnton Shevchuk
Anton Shevchuk
authored and
Anton Shevchuk
committed
Created Http\RequestMethod with constants
1 parent 954b8b5 commit c3a6287

File tree

5 files changed

+57
-15
lines changed

5 files changed

+57
-15
lines changed

src/models/Auth/AuthInterface.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22
/**
3-
* Created by PhpStorm.
4-
* User: yuklia
5-
* Date: 06.05.15
6-
* Time: 18:41
3+
* @copyright Bluz PHP Team
4+
* @link https://github.com/bluzphp/skeleton
5+
*/
6+
7+
/**
8+
* @namespace
79
*/
810
namespace Application\Auth;
911

src/models/Auth/AuthProvider.php

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
<?php
22
/**
3-
* Hybrid Auth integration
4-
* @author yuklia <[email protected]>
3+
* @copyright Bluz PHP Team
4+
* @link https://github.com/bluzphp/skeleton
5+
*/
6+
7+
/**
8+
* @namespace
59
*/
610
namespace Application\Auth;
711

812
use Application\Auth;
913
use Application\Users;
1014
use Bluz\Application\Exception\ApplicationException;
15+
use Bluz\Auth\EntityInterface;
1116
use Bluz\Proxy\Config;
1217
use Bluz\Proxy\Messages;
1318
use Bluz\Proxy\Response;
1419

1520
/**
16-
* Class AuthProvider
21+
* Hybrid Auth integration
22+
* @author yuklia <[email protected]>
1723
* @package Application\Auth
1824
*/
1925
class AuthProvider implements AuthInterface
2026
{
2127
/**
22-
* @var \Application\Users\Row $identity
28+
* @var EntityInterface $identity
2329
*/
2430
protected $identity;
2531

@@ -48,7 +54,6 @@ public function __construct($providerName)
4854
$this->providerName = ucfirst($providerName);
4955
}
5056

51-
5257
/**
5358
* @return \Hybrid_Auth
5459
*/
@@ -70,15 +75,15 @@ public function setHybridauth($hybridauth)
7075
}
7176

7277
/**
73-
* @param \Application\Users\Row $identity
78+
* @param EntityInterface $identity
7479
*/
7580
public function setIdentity($identity)
7681
{
7782
$this->identity = $identity;
7883
}
7984

8085
/**
81-
* @return \Application\Users\Row $user
86+
* @return EntityInterface $user
8287
*/
8388
public function getIdentity()
8489
{
@@ -161,7 +166,6 @@ public function authProcess()
161166
$authTable = Auth\Table::getInstance();
162167
$auth = $authTable->getAuthRow(strtolower($this->providerName), $profile->identifier);
163168

164-
165169
if ($this->identity) {
166170
if ($auth) {
167171
Messages::addNotice(sprintf('You have already linked to %s', $this->providerName));

src/modules/auth/controllers/auth.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
/**
1515
* @param string $provider
16-
* @return \closure
16+
* @return false
1717
*/
1818
return function ($provider = '') {
1919
/**

src/modules/auth/controllers/endpoint.php

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*/
88
namespace Application;
99

10-
use Application\Users;
11-
1210
/**
1311
* @return \closure
1412
*/
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* @copyright Bluz PHP Team
4+
* @link https://github.com/bluzphp/skeleton
5+
*/
6+
7+
/**
8+
* @namespace
9+
*/
10+
namespace Application\Tests\Auth;
11+
12+
use Application\Auth\AuthProvider;
13+
use Application\Tests\ControllerTestCase;
14+
15+
/**
16+
* Class AuthProviderTest
17+
* @author yuklia <[email protected]>
18+
* @package Application\Tests\Auth
19+
*/
20+
class AuthProviderTest extends ControllerTestCase
21+
{
22+
/**
23+
* @expectedException \Exception
24+
*/
25+
public function testProviderNotFound()
26+
{
27+
new AuthProvider('fake_data');
28+
}
29+
30+
/**
31+
* @expectedException \Exception
32+
*/
33+
public function testFailureHybridProvider()
34+
{
35+
$provider = new AuthProvider('olo');
36+
self::assertInstanceOf('\Hybrid_Provider_Adapter', $provider->authenticate('olo'));
37+
}
38+
}

0 commit comments

Comments
 (0)