Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 290e4d6

Browse files
committed
Merge branch 'hotfix/qa' into release-1.0.0
Close #20 Close #21
2 parents 06cb9c8 + 2dd0970 commit 290e4d6

File tree

4 files changed

+93
-5
lines changed

4 files changed

+93
-5
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22
/**
33
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository
4-
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (https://www.zend.com)
4+
* @copyright Copyright (c) 2017-2018 Zend Technologies USA Inc. (https://www.zend.com)
55
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License
66
*/
77

88
declare(strict_types=1);
99

1010
namespace Zend\Expressive\Authentication\Exception;
1111

12-
class InvalidConfigException extends RuntimeException implements ExceptionInterface
12+
class InvalidConfigException extends RuntimeException
1313
{
1414
}

src/Exception/RuntimeException.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<?php
22
/**
33
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository
4-
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (https://www.zend.com)
4+
* @copyright Copyright (c) 2017-2018 Zend Technologies USA Inc. (https://www.zend.com)
55
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License
66
*/
77

88
declare(strict_types=1);
99

1010
namespace Zend\Expressive\Authentication\Exception;
1111

12-
class RuntimeException extends \RuntimeException implements
13-
ExceptionInterface
12+
class RuntimeException extends \RuntimeException implements ExceptionInterface
1413
{
1514
}

test/ConfigProviderTest.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository
4+
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace ZendTest\Expressive\Authentication;
11+
12+
use PHPUnit\Framework\TestCase;
13+
use Zend\Expressive\Authentication\AuthenticationMiddleware;
14+
use Zend\Expressive\Authentication\ConfigProvider;
15+
use Zend\Expressive\Authentication\UserRepository;
16+
17+
class ConfigProviderTest extends TestCase
18+
{
19+
/** @var ConfigProvider */
20+
private $provider;
21+
22+
protected function setUp()
23+
{
24+
$this->provider = new ConfigProvider();
25+
}
26+
27+
public function testProviderDefinesExpectedFactoryServices()
28+
{
29+
$config = $this->provider->getDependencies();
30+
$factories = $config['factories'];
31+
32+
$this->assertArrayHasKey(AuthenticationMiddleware::class, $factories);
33+
$this->assertArrayHasKey(UserRepository\Htpasswd::class, $factories);
34+
$this->assertArrayHasKey(UserRepository\PdoDatabase::class, $factories);
35+
}
36+
37+
public function testInvocationReturnsArrayWithDependencies()
38+
{
39+
$config = ($this->provider)();
40+
41+
$this->assertInternalType('array', $config);
42+
$this->assertArrayHasKey('authentication', $config);
43+
$this->assertInternalType('array', $config['authentication']);
44+
45+
$this->assertArrayHasKey('dependencies', $config);
46+
$this->assertInternalType('array', $config['dependencies']);
47+
$this->assertArrayHasKey('aliases', $config['dependencies']);
48+
$this->assertArrayHasKey('factories', $config['dependencies']);
49+
}
50+
}

test/ExceptionTest.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* @see https://github.com/zendframework/zend-expressive-authentication for the canonical source repository
4+
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/zend-expressive-authentication/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace ZendTest\Expressive\Authentication;
11+
12+
use Generator;
13+
use PHPUnit\Framework\TestCase;
14+
use Psr\Container\ContainerExceptionInterface;
15+
use Zend\Expressive\Authentication\Exception\ExceptionInterface;
16+
17+
class ExceptionTest extends TestCase
18+
{
19+
public function exception() : Generator
20+
{
21+
$namespace = substr(ExceptionInterface::class, 0, strrpos(ExceptionInterface::class, '\\') + 1);
22+
23+
$exceptions = glob(__DIR__ . '/../src/Exception/*.php');
24+
foreach ($exceptions as $exception) {
25+
$class = substr(basename($exception), 0, -4);
26+
27+
yield $class => [$namespace . $class];
28+
}
29+
}
30+
31+
/**
32+
* @dataProvider exception
33+
*/
34+
public function testExceptionIsInstanceOfExceptionInterface(string $exception) : void
35+
{
36+
$this->assertContains('Exception', $exception);
37+
$this->assertTrue(is_a($exception, ExceptionInterface::class, true));
38+
}
39+
}

0 commit comments

Comments
 (0)