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

Commit

Permalink
Merge branch 'hotfix/17'
Browse files Browse the repository at this point in the history
Close #17
  • Loading branch information
weierophinney committed Sep 17, 2018
2 parents 3302a71 + 7682565 commit dc1514e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.0.1 - TBD
## 1.0.1 - 2018-09-17

### Added

Expand All @@ -22,7 +22,8 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#17](https://github.com/zendframework/zend-expressive-authorization-rbac/pull/17) fixes exception messages on invalid configuration to refer to the
configuration key `zend-expressive-authorization-rbac` instead of `authorization`.

## 1.0.0 - 2018-09-13

Expand Down
6 changes: 3 additions & 3 deletions src/ZendRbacFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ public function __invoke(ContainerInterface $container) : AuthorizationInterface
$config = $container->get('config')['zend-expressive-authorization-rbac'] ?? null;
if (null === $config) {
throw new Exception\InvalidConfigException(sprintf(
'Cannot create %s instance; no "authorization" config key present',
'Cannot create %s instance; no "zend-expressive-authorization-rbac" config key present',
ZendRbac::class
));
}
if (! isset($config['roles'])) {
throw new Exception\InvalidConfigException(sprintf(
'Cannot create %s instance; no authorization.roles configured',
'Cannot create %s instance; no zend-expressive-authorization-rbac.roles configured',
ZendRbac::class
));
}
if (! isset($config['permissions'])) {
throw new Exception\InvalidConfigException(sprintf(
'Cannot create %s instance; no authorization.permissions configured',
'Cannot create %s instance; no zend-expressive-authorization-rbac.permissions configured',
ZendRbac::class
));
}
Expand Down
3 changes: 3 additions & 0 deletions test/ZendRbacFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function testFactoryWithoutConfig()
$factory = new ZendRbacFactory();

$this->expectException(Exception\InvalidConfigException::class);
$this->expectExceptionMessage('zend-expressive-authorization-rbac');
$factory($this->container->reveal());
}

Expand All @@ -44,6 +45,7 @@ public function testFactoryWithoutZendRbacConfig()
$factory = new ZendRbacFactory();

$this->expectException(Exception\InvalidConfigException::class);
$this->expectExceptionMessage('zend-expressive-authorization-rbac.roles');
$factory($this->container->reveal());
}

Expand All @@ -58,6 +60,7 @@ public function testFactoryWithoutPermissions()
$factory = new ZendRbacFactory();

$this->expectException(Exception\InvalidConfigException::class);
$this->expectExceptionMessage('zend-expressive-authorization-rbac.permissions');
$factory($this->container->reveal());
}

Expand Down

0 comments on commit dc1514e

Please sign in to comment.