This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/qa' into release-1.0.0
- Loading branch information
Showing
4 changed files
with
93 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository | ||
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @copyright Copyright (c) 2017-2018 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Zend\Expressive\Authentication\Exception; | ||
|
||
class InvalidConfigException extends RuntimeException implements ExceptionInterface | ||
class InvalidConfigException extends RuntimeException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository | ||
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @copyright Copyright (c) 2017-2018 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Zend\Expressive\Authentication\Exception; | ||
|
||
class RuntimeException extends \RuntimeException implements | ||
ExceptionInterface | ||
class RuntimeException extends \RuntimeException implements ExceptionInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository | ||
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ZendTest\Expressive\Authentication; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Zend\Expressive\Authentication\AuthenticationMiddleware; | ||
use Zend\Expressive\Authentication\ConfigProvider; | ||
use Zend\Expressive\Authentication\UserRepository; | ||
|
||
class ConfigProviderTest extends TestCase | ||
{ | ||
/** @var ConfigProvider */ | ||
private $provider; | ||
|
||
protected function setUp() | ||
{ | ||
$this->provider = new ConfigProvider(); | ||
} | ||
|
||
public function testProviderDefinesExpectedFactoryServices() | ||
{ | ||
$config = $this->provider->getDependencies(); | ||
$factories = $config['factories']; | ||
|
||
$this->assertArrayHasKey(AuthenticationMiddleware::class, $factories); | ||
$this->assertArrayHasKey(UserRepository\Htpasswd::class, $factories); | ||
$this->assertArrayHasKey(UserRepository\PdoDatabase::class, $factories); | ||
} | ||
|
||
public function testInvocationReturnsArrayWithDependencies() | ||
{ | ||
$config = ($this->provider)(); | ||
|
||
$this->assertInternalType('array', $config); | ||
$this->assertArrayHasKey('authentication', $config); | ||
$this->assertInternalType('array', $config['authentication']); | ||
|
||
$this->assertArrayHasKey('dependencies', $config); | ||
$this->assertInternalType('array', $config['dependencies']); | ||
$this->assertArrayHasKey('aliases', $config['dependencies']); | ||
$this->assertArrayHasKey('factories', $config['dependencies']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository | ||
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com) | ||
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ZendTest\Expressive\Authentication; | ||
|
||
use Generator; | ||
use PHPUnit\Framework\TestCase; | ||
use Psr\Container\ContainerExceptionInterface; | ||
use Zend\Expressive\Authentication\Exception\ExceptionInterface; | ||
|
||
class ExceptionTest extends TestCase | ||
{ | ||
public function exception() : Generator | ||
{ | ||
$namespace = substr(ExceptionInterface::class, 0, strrpos(ExceptionInterface::class, '\\') + 1); | ||
|
||
$exceptions = glob(__DIR__ . '/../src/Exception/*.php'); | ||
foreach ($exceptions as $exception) { | ||
$class = substr(basename($exception), 0, -4); | ||
|
||
yield $class => [$namespace . $class]; | ||
} | ||
} | ||
|
||
/** | ||
* @dataProvider exception | ||
*/ | ||
public function testExceptionIsInstanceOfExceptionInterface(string $exception) : void | ||
{ | ||
$this->assertContains('Exception', $exception); | ||
$this->assertTrue(is_a($exception, ExceptionInterface::class, true)); | ||
} | ||
} |