diff --git a/.travis.yml b/.travis.yml
index d67b6911..7a3995b8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,16 @@
language: php
php:
- - 5.3.3
+ - 5.3
- 5.4
- 5.5
- 5.6
- - hhvm
+ - 7.0
+ - 7.1
matrix:
- allow_failures:
- - php: hhvm
+ include:
+ - php: 5.6
+ env: dependencies="--prefer-lowest --prefer-stable"
script:
- vendor/bin/tester tests -s -p php
@@ -20,5 +22,11 @@ after_failure:
before_script:
# Install Nette Tester & Code Checker
- - composer install --no-interaction --dev --prefer-source
- - composer create-project nette/code-checker code-checker ~2.3 --no-interaction --prefer-source
+ - travis_retry composer update --no-interaction --prefer-dist $dependencies
+ - travis_retry composer create-project nette/code-checker code-checker ~2.5 --no-interaction
+
+sudo: false
+
+cache:
+ directories:
+ - $HOME/.composer/cache
diff --git a/composer.json b/composer.json
index 993cb4d3..c95cdb1d 100644
--- a/composer.json
+++ b/composer.json
@@ -1,16 +1,16 @@
{
"name": "nette/security",
"description": "Nette Security: Access Control Component",
- "homepage": "http://nette.org",
+ "homepage": "https://nette.org",
"license": ["BSD-3-Clause", "GPL-2.0", "GPL-3.0"],
"authors": [
{
"name": "David Grudl",
- "homepage": "http://davidgrudl.com"
+ "homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
- "homepage": "http://nette.org/contributors"
+ "homepage": "https://nette.org/contributors"
}
],
"require": {
@@ -20,7 +20,7 @@
"require-dev": {
"nette/di": "~2.3",
"nette/http": "~2.3",
- "nette/tester": "~1.0"
+ "nette/tester": "~1.4"
},
"conflict": {
"nette/nette": "<2.2"
@@ -28,10 +28,5 @@
"autoload": {
"classmap": ["src/"]
},
- "minimum-stability": "dev",
- "extra": {
- "branch-alias": {
- "dev-master": "2.3-dev"
- }
- }
+ "minimum-stability": "dev"
}
diff --git a/contributing.md b/contributing.md
index a1cbbd53..860882bf 100644
--- a/contributing.md
+++ b/contributing.md
@@ -5,7 +5,7 @@ The issue tracker is the preferred channel for bug reports, features requests
and submitting pull requests, but please respect the following restrictions:
* Please **do not** use the issue tracker for personal support requests (use
- [Nette forum](http://forum.nette.org) or [Stack Overflow](http://stackoverflow.com)).
+ [Nette forum](https://forum.nette.org) or [Stack Overflow](http://stackoverflow.com)).
* Please **do not** derail or troll issues. Keep the discussion on topic and
respect the opinions of others.
@@ -21,7 +21,7 @@ fits with the scope and aims of the project. It's up to *you* to make a strong
case to convince the project's developers of the merits of this feature.
Nette welcomes **pull requests**. If you'd like to contribute, please take a moment
-to [read the guidelines](http://nette.org/en/contributing) in order to make
+to [read the guidelines](https://nette.org/en/contributing) in order to make
the contribution process easy and effective for everyone involved.
Thanks!
diff --git a/license.md b/license.md
index af571d59..cf741bd0 100644
--- a/license.md
+++ b/license.md
@@ -21,7 +21,7 @@ If your stuff is good, it will not take long to establish a reputation for yours
New BSD License
---------------
-Copyright (c) 2004, 2014 David Grudl (http://davidgrudl.com)
+Copyright (c) 2004, 2014 David Grudl (https://davidgrudl.com)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
diff --git a/readme.md b/readme.md
index 29a17251..982b7bb4 100644
--- a/readme.md
+++ b/readme.md
@@ -2,7 +2,7 @@ Nette Security: Access Control
==============================
[](https://packagist.org/packages/nette/security)
-[](https://travis-ci.org/nette/security)
+[](https://travis-ci.org/nette/security)
- user login and logout
- verifying user privileges
@@ -120,7 +120,7 @@ class MyAuthenticator extends Nette\Object implements NS\IAuthenticator
throw new NS\AuthenticationException('User not found.');
}
- if ($row->password !== md5($password)) {
+ if (!NS\Passwords::verify($password, $row->password)) {
throw new NS\AuthenticationException('Invalid password.');
}
@@ -129,7 +129,7 @@ class MyAuthenticator extends Nette\Object implements NS\IAuthenticator
}
```
-Class `MyAuthenticator` communicates with the database using [Nette\Database |database] layer and works with table `users`, where it grabs `username` and md5 hash of `password` in the appropriate columns. If the password check is successful, it returns new identity with user ID and role, which we will mention [later | #roles];
+Class `MyAuthenticator` communicates with the database using [Nette\Database |database] layer and works with table `users`, where it grabs `username` and hash of `password` in the appropriate columns. If the password check is successful, it returns new identity with user ID and role, which we will mention [later | #roles];
This authenticator would be configured in the `config.neon` file like this:
diff --git a/src/Bridges/SecurityDI/SecurityExtension.php b/src/Bridges/SecurityDI/SecurityExtension.php
index 82c6713d..dde3ffed 100644
--- a/src/Bridges/SecurityDI/SecurityExtension.php
+++ b/src/Bridges/SecurityDI/SecurityExtension.php
@@ -1,8 +1,8 @@
debugMode && $config['debugger']) {
$user->addSetup('@Tracy\Bar::addPanel', array(
- new Nette\DI\Statement('Nette\Bridges\SecurityTracy\UserPanel')
+ new Nette\DI\Statement('Nette\Bridges\SecurityTracy\UserPanel'),
));
}
diff --git a/src/Bridges/SecurityTracy/UserPanel.php b/src/Bridges/SecurityTracy/UserPanel.php
index e25f40a5..46ca603a 100644
--- a/src/Bridges/SecurityTracy/UserPanel.php
+++ b/src/Bridges/SecurityTracy/UserPanel.php
@@ -1,20 +1,18 @@
user;
require __DIR__ . '/templates/UserPanel.tab.phtml';
return ob_get_clean();
@@ -51,7 +49,7 @@ public function getTab()
*/
public function getPanel()
{
- ob_start();
+ ob_start(function () {});
$user = $this->user;
require __DIR__ . '/templates/UserPanel.panel.phtml';
return ob_get_clean();
diff --git a/src/Bridges/SecurityTracy/templates/UserPanel.tab.phtml b/src/Bridges/SecurityTracy/templates/UserPanel.tab.phtml
index 38a461a1..cbf9afc3 100644
--- a/src/Bridges/SecurityTracy/templates/UserPanel.tab.phtml
+++ b/src/Bridges/SecurityTracy/templates/UserPanel.tab.phtml
@@ -5,8 +5,6 @@ namespace Nette\Bridges\SecurityTracy;
use Nette;
?>
-isLoggedIn()): ?>
-
-
-
-
+
+
+
diff --git a/src/Security/AuthenticationException.php b/src/Security/AuthenticationException.php
index 7dee689c..c03803d9 100644
--- a/src/Security/AuthenticationException.php
+++ b/src/Security/AuthenticationException.php
@@ -1,19 +1,15 @@
= 5.3.7.
- *
- * @author David Grudl
*/
class Passwords
{
diff --git a/src/Security/Permission.php b/src/Security/Permission.php
index ca1ace7d..56ce0939 100644
--- a/src/Security/Permission.php
+++ b/src/Security/Permission.php
@@ -1,8 +1,8 @@
roles[$role] = array(
- 'parents' => $roleParents,
+ 'parents' => $roleParents,
'children' => array(),
);
@@ -179,7 +173,7 @@ public function roleInheritsFrom($role, $inherit, $onlyParents = FALSE)
*
* @param string
* @throws Nette\InvalidStateException
- * @return self
+ * @return static
*/
public function removeRole($role)
{
@@ -218,7 +212,7 @@ public function removeRole($role)
/**
* Removes all Roles from the list.
*
- * @return self
+ * @return static
*/
public function removeAllRoles()
{
@@ -248,7 +242,7 @@ public function removeAllRoles()
* @param string
* @throws Nette\InvalidArgumentException
* @throws Nette\InvalidStateException
- * @return self
+ * @return static
*/
public function addResource($resource, $parent = NULL)
{
@@ -264,8 +258,8 @@ public function addResource($resource, $parent = NULL)
}
$this->resources[$resource] = array(
- 'parent' => $parent,
- 'children' => array()
+ 'parent' => $parent,
+ 'children' => array(),
);
return $this;
@@ -355,7 +349,7 @@ public function resourceInheritsFrom($resource, $inherit, $onlyParent = FALSE)
*
* @param string
* @throws Nette\InvalidStateException
- * @return self
+ * @return static
*/
public function removeResource($resource)
{
@@ -387,7 +381,7 @@ public function removeResource($resource)
/**
* Removes all Resources.
- * @return self
+ * @return static
*/
public function removeAllResources()
{
@@ -415,7 +409,7 @@ public function removeAllResources()
* @param string|array|Permission::ALL resources
* @param string|array|Permission::ALL privileges
* @param callable assertion
- * @return self
+ * @return static
*/
public function allow($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL, $assertion = NULL)
{
@@ -432,7 +426,7 @@ public function allow($roles = self::ALL, $resources = self::ALL, $privileges =
* @param string|array|Permission::ALL resources
* @param string|array|Permission::ALL privileges
* @param callable assertion
- * @return self
+ * @return static
*/
public function deny($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL, $assertion = NULL)
{
@@ -447,7 +441,7 @@ public function deny($roles = self::ALL, $resources = self::ALL, $privileges = s
* @param string|array|Permission::ALL roles
* @param string|array|Permission::ALL resources
* @param string|array|Permission::ALL privileges
- * @return self
+ * @return static
*/
public function removeAllow($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL)
{
@@ -462,7 +456,7 @@ public function removeAllow($roles = self::ALL, $resources = self::ALL, $privile
* @param string|array|Permission::ALL roles
* @param string|array|Permission::ALL resources
* @param string|array|Permission::ALL privileges
- * @return self
+ * @return static
*/
public function removeDeny($roles = self::ALL, $resources = self::ALL, $privileges = self::ALL)
{
@@ -480,7 +474,7 @@ public function removeDeny($roles = self::ALL, $resources = self::ALL, $privileg
* @param string|array|Permission::ALL privileges
* @param callable assertion
* @throws Nette\InvalidStateException
- * @return self
+ * @return static
*/
protected function setRule($toAdd, $type, $roles, $resources, $privileges, $assertion = NULL)
{
@@ -552,10 +546,10 @@ protected function setRule($toAdd, $type, $roles, $resources, $privileges, $asse
$rules = array(
'allPrivileges' => array(
'type' => self::DENY,
- 'assert' => NULL
+ 'assert' => NULL,
),
- 'byPrivilege' => array()
- );
+ 'byPrivilege' => array(),
+ );
}
continue;
}
diff --git a/src/Security/SimpleAuthenticator.php b/src/Security/SimpleAuthenticator.php
index 44492fd6..2c4a92fe 100644
--- a/src/Security/SimpleAuthenticator.php
+++ b/src/Security/SimpleAuthenticator.php
@@ -1,8 +1,8 @@
compile($config, 'Container1'));
+eval(@$compiler->compile($config, 'Container1')); // @ compatibility with DI 2.4
$container = new Container1;
$authenticator = $container->getService('security.authenticator');
diff --git a/tests/Security.DI/SecurityExtension.user.phpt b/tests/Security.DI/SecurityExtension.user.phpt
index 4690919e..aa897f16 100644
--- a/tests/Security.DI/SecurityExtension.user.phpt
+++ b/tests/Security.DI/SecurityExtension.user.phpt
@@ -4,11 +4,11 @@
* Test: SecurityExtension
*/
-use Nette\DI,
- Nette\Bridges\HttpDI\HttpExtension,
- Nette\Bridges\HttpDI\SessionExtension,
- Nette\Bridges\SecurityDI\SecurityExtension,
- Tester\Assert;
+use Nette\DI;
+use Nette\Bridges\HttpDI\HttpExtension;
+use Nette\Bridges\HttpDI\SessionExtension;
+use Nette\Bridges\SecurityDI\SecurityExtension;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -19,7 +19,7 @@ $compiler->addExtension('foo', new HttpExtension);
$compiler->addExtension('bar', new SessionExtension);
$compiler->addExtension('security', new SecurityExtension);
-eval($compiler->compile(array(), 'Container1'));
+eval(@$compiler->compile(array(), 'Container1')); // @ compatibility with DI 2.4
$container = new Container1;
Assert::type('Nette\Http\UserStorage', $container->getService('security.userStorage'));
diff --git a/tests/Security/Identity.phpt b/tests/Security/Identity.phpt
index 62ab3671..942250f5 100644
--- a/tests/Security/Identity.phpt
+++ b/tests/Security/Identity.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Security\Identity.
*/
-use Nette\Security\Identity,
- Tester\Assert;
+use Nette\Security\Identity;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
-test(function() {
+test(function () {
$id = new Identity(12, 'admin', array('name' => 'John'));
Assert::same(12, $id->getId());
@@ -23,7 +23,7 @@ test(function() {
});
-test(function() {
+test(function () {
$id = new Identity('12');
Assert::same(12, $id->getId());
diff --git a/tests/Security/MockUserStorage.php b/tests/Security/MockUserStorage.php
index 4a9824c7..57dc6b97 100644
--- a/tests/Security/MockUserStorage.php
+++ b/tests/Security/MockUserStorage.php
@@ -26,9 +26,10 @@ function getIdentity()
}
function setExpiration($time, $flags = 0)
- {}
+ {
+ }
function getLogoutReason()
- {}
-
+ {
+ }
}
diff --git a/tests/Security/Passwords.hash().phpt b/tests/Security/Passwords.hash().phpt
index af1e511c..6d016b3c 100644
--- a/tests/Security/Passwords.hash().phpt
+++ b/tests/Security/Passwords.hash().phpt
@@ -5,8 +5,8 @@
* @phpversion 5.3.7
*/
-use Nette\Security\Passwords,
- Tester\Assert;
+use Nette\Security\Passwords;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -24,17 +24,17 @@ Assert::truthy(
echo $h;
$hash = Passwords::hash('dg');
-Assert::same( $hash, crypt('dg', $hash) );
+Assert::same($hash, crypt('dg', $hash));
-Assert::exception(function() {
+Assert::exception(function () {
Passwords::hash('dg', array('cost' => 3));
}, 'Nette\InvalidArgumentException', 'Cost must be in range 4-31, 3 given.');
-Assert::exception(function() {
+Assert::exception(function () {
Passwords::hash('dg', array('cost' => 32));
}, 'Nette\InvalidArgumentException', 'Cost must be in range 4-31, 32 given.');
-Assert::exception(function() {
+Assert::exception(function () {
Passwords::hash('dg', array('salt' => 'abc'));
}, 'Nette\InvalidArgumentException', 'Salt must be 22 characters long, 3 given.');
diff --git a/tests/Security/Passwords.needsRehash().phpt b/tests/Security/Passwords.needsRehash().phpt
index d86a4ce5..261a481b 100644
--- a/tests/Security/Passwords.needsRehash().phpt
+++ b/tests/Security/Passwords.needsRehash().phpt
@@ -5,8 +5,8 @@
* @phpversion 5.3.7
*/
-use Nette\Security\Passwords,
- Tester\Assert;
+use Nette\Security\Passwords;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Security/Passwords.verify().phpt b/tests/Security/Passwords.verify().phpt
index e2ad0ddf..ec6d16fc 100644
--- a/tests/Security/Passwords.verify().phpt
+++ b/tests/Security/Passwords.verify().phpt
@@ -5,8 +5,8 @@
* @phpversion 5.3.7
*/
-use Nette\Security\Passwords,
- Tester\Assert;
+use Nette\Security\Passwords;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
diff --git a/tests/Security/Permission.CMSExample.phpt b/tests/Security/Permission.CMSExample.phpt
index b99598f4..2e43790e 100644
--- a/tests/Security/Permission.CMSExample.phpt
+++ b/tests/Security/Permission.CMSExample.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that an example for a content management system is operable.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -31,45 +31,45 @@ $acl->allow('administrator');
// Access control checks based on above permission sets
-Assert::true( $acl->isAllowed('guest', NULL, 'view') );
-Assert::false( $acl->isAllowed('guest', NULL, 'edit') );
-Assert::false( $acl->isAllowed('guest', NULL, 'submit') );
-Assert::false( $acl->isAllowed('guest', NULL, 'revise') );
-Assert::false( $acl->isAllowed('guest', NULL, 'publish') );
-Assert::false( $acl->isAllowed('guest', NULL, 'archive') );
-Assert::false( $acl->isAllowed('guest', NULL, 'delete') );
-Assert::false( $acl->isAllowed('guest', NULL, 'unknown') );
-Assert::false( $acl->isAllowed('guest') );
-
-Assert::true( $acl->isAllowed('staff', NULL, 'view') );
-Assert::true( $acl->isAllowed('staff', NULL, 'edit') );
-Assert::true( $acl->isAllowed('staff', NULL, 'submit') );
-Assert::true( $acl->isAllowed('staff', NULL, 'revise') );
-Assert::false( $acl->isAllowed('staff', NULL, 'publish') );
-Assert::false( $acl->isAllowed('staff', NULL, 'archive') );
-Assert::false( $acl->isAllowed('staff', NULL, 'delete') );
-Assert::false( $acl->isAllowed('staff', NULL, 'unknown') );
-Assert::false( $acl->isAllowed('staff') );
-
-Assert::true( $acl->isAllowed('editor', NULL, 'view') );
-Assert::true( $acl->isAllowed('editor', NULL, 'edit') );
-Assert::true( $acl->isAllowed('editor', NULL, 'submit') );
-Assert::true( $acl->isAllowed('editor', NULL, 'revise') );
-Assert::true( $acl->isAllowed('editor', NULL, 'publish') );
-Assert::true( $acl->isAllowed('editor', NULL, 'archive') );
-Assert::true( $acl->isAllowed('editor', NULL, 'delete') );
-Assert::false( $acl->isAllowed('editor', NULL, 'unknown') );
-Assert::false( $acl->isAllowed('editor') );
-
-Assert::true( $acl->isAllowed('administrator', NULL, 'view') );
-Assert::true( $acl->isAllowed('administrator', NULL, 'edit') );
-Assert::true( $acl->isAllowed('administrator', NULL, 'submit') );
-Assert::true( $acl->isAllowed('administrator', NULL, 'revise') );
-Assert::true( $acl->isAllowed('administrator', NULL, 'publish') );
-Assert::true( $acl->isAllowed('administrator', NULL, 'archive') );
-Assert::true( $acl->isAllowed('administrator', NULL, 'delete') );
-Assert::true( $acl->isAllowed('administrator', NULL, 'unknown') );
-Assert::true( $acl->isAllowed('administrator') );
+Assert::true($acl->isAllowed('guest', NULL, 'view'));
+Assert::false($acl->isAllowed('guest', NULL, 'edit'));
+Assert::false($acl->isAllowed('guest', NULL, 'submit'));
+Assert::false($acl->isAllowed('guest', NULL, 'revise'));
+Assert::false($acl->isAllowed('guest', NULL, 'publish'));
+Assert::false($acl->isAllowed('guest', NULL, 'archive'));
+Assert::false($acl->isAllowed('guest', NULL, 'delete'));
+Assert::false($acl->isAllowed('guest', NULL, 'unknown'));
+Assert::false($acl->isAllowed('guest'));
+
+Assert::true($acl->isAllowed('staff', NULL, 'view'));
+Assert::true($acl->isAllowed('staff', NULL, 'edit'));
+Assert::true($acl->isAllowed('staff', NULL, 'submit'));
+Assert::true($acl->isAllowed('staff', NULL, 'revise'));
+Assert::false($acl->isAllowed('staff', NULL, 'publish'));
+Assert::false($acl->isAllowed('staff', NULL, 'archive'));
+Assert::false($acl->isAllowed('staff', NULL, 'delete'));
+Assert::false($acl->isAllowed('staff', NULL, 'unknown'));
+Assert::false($acl->isAllowed('staff'));
+
+Assert::true($acl->isAllowed('editor', NULL, 'view'));
+Assert::true($acl->isAllowed('editor', NULL, 'edit'));
+Assert::true($acl->isAllowed('editor', NULL, 'submit'));
+Assert::true($acl->isAllowed('editor', NULL, 'revise'));
+Assert::true($acl->isAllowed('editor', NULL, 'publish'));
+Assert::true($acl->isAllowed('editor', NULL, 'archive'));
+Assert::true($acl->isAllowed('editor', NULL, 'delete'));
+Assert::false($acl->isAllowed('editor', NULL, 'unknown'));
+Assert::false($acl->isAllowed('editor'));
+
+Assert::true($acl->isAllowed('administrator', NULL, 'view'));
+Assert::true($acl->isAllowed('administrator', NULL, 'edit'));
+Assert::true($acl->isAllowed('administrator', NULL, 'submit'));
+Assert::true($acl->isAllowed('administrator', NULL, 'revise'));
+Assert::true($acl->isAllowed('administrator', NULL, 'publish'));
+Assert::true($acl->isAllowed('administrator', NULL, 'archive'));
+Assert::true($acl->isAllowed('administrator', NULL, 'delete'));
+Assert::true($acl->isAllowed('administrator', NULL, 'unknown'));
+Assert::true($acl->isAllowed('administrator'));
// Some checks on specific areas, which inherit access controls from the root ACL node
$acl->addResource('newsletter');
@@ -78,14 +78,14 @@ $acl->addResource('gallery');
$acl->addResource('profiles', 'gallery');
$acl->addResource('config');
$acl->addResource('hosts', 'config');
-Assert::true( $acl->isAllowed('guest', 'pending', 'view') );
-Assert::true( $acl->isAllowed('staff', 'profiles', 'revise') );
-Assert::true( $acl->isAllowed('staff', 'pending', 'view') );
-Assert::true( $acl->isAllowed('staff', 'pending', 'edit') );
-Assert::false( $acl->isAllowed('staff', 'pending', 'publish') );
-Assert::false( $acl->isAllowed('staff', 'pending') );
-Assert::false( $acl->isAllowed('editor', 'hosts', 'unknown') );
-Assert::true( $acl->isAllowed('administrator', 'pending') );
+Assert::true($acl->isAllowed('guest', 'pending', 'view'));
+Assert::true($acl->isAllowed('staff', 'profiles', 'revise'));
+Assert::true($acl->isAllowed('staff', 'pending', 'view'));
+Assert::true($acl->isAllowed('staff', 'pending', 'edit'));
+Assert::false($acl->isAllowed('staff', 'pending', 'publish'));
+Assert::false($acl->isAllowed('staff', 'pending'));
+Assert::false($acl->isAllowed('editor', 'hosts', 'unknown'));
+Assert::true($acl->isAllowed('administrator', 'pending'));
// Add a new group, marketing, which bases its permissions on staff
$acl->addRole('marketing', 'staff');
@@ -109,35 +109,35 @@ $acl->deny(NULL, 'announcement', 'archive');
// Access control checks for the above refined permission sets
-Assert::true( $acl->isAllowed('marketing', NULL, 'view') );
-Assert::true( $acl->isAllowed('marketing', NULL, 'edit') );
-Assert::true( $acl->isAllowed('marketing', NULL, 'submit') );
-Assert::true( $acl->isAllowed('marketing', NULL, 'revise') );
-Assert::false( $acl->isAllowed('marketing', NULL, 'publish') );
-Assert::false( $acl->isAllowed('marketing', NULL, 'archive') );
-Assert::false( $acl->isAllowed('marketing', NULL, 'delete') );
-Assert::false( $acl->isAllowed('marketing', NULL, 'unknown') );
-Assert::false( $acl->isAllowed('marketing') );
-
-Assert::true( $acl->isAllowed('marketing', 'newsletter', 'publish') );
-Assert::false( $acl->isAllowed('staff', 'pending', 'publish') );
-Assert::true( $acl->isAllowed('marketing', 'pending', 'publish') );
-Assert::true( $acl->isAllowed('marketing', 'newsletter', 'archive') );
-Assert::false( $acl->isAllowed('marketing', 'newsletter', 'delete') );
-Assert::false( $acl->isAllowed('marketing', 'newsletter') );
-
-Assert::true( $acl->isAllowed('marketing', 'latest', 'publish') );
-Assert::true( $acl->isAllowed('marketing', 'latest', 'archive') );
-Assert::false( $acl->isAllowed('marketing', 'latest', 'delete') );
-Assert::false( $acl->isAllowed('marketing', 'latest', 'revise') );
-Assert::false( $acl->isAllowed('marketing', 'latest') );
-
-Assert::false( $acl->isAllowed('marketing', 'announcement', 'archive') );
-Assert::false( $acl->isAllowed('staff', 'announcement', 'archive') );
-Assert::false( $acl->isAllowed('administrator', 'announcement', 'archive') );
-
-Assert::false( $acl->isAllowed('staff', 'latest', 'publish') );
-Assert::false( $acl->isAllowed('editor', 'announcement', 'archive') );
+Assert::true($acl->isAllowed('marketing', NULL, 'view'));
+Assert::true($acl->isAllowed('marketing', NULL, 'edit'));
+Assert::true($acl->isAllowed('marketing', NULL, 'submit'));
+Assert::true($acl->isAllowed('marketing', NULL, 'revise'));
+Assert::false($acl->isAllowed('marketing', NULL, 'publish'));
+Assert::false($acl->isAllowed('marketing', NULL, 'archive'));
+Assert::false($acl->isAllowed('marketing', NULL, 'delete'));
+Assert::false($acl->isAllowed('marketing', NULL, 'unknown'));
+Assert::false($acl->isAllowed('marketing'));
+
+Assert::true($acl->isAllowed('marketing', 'newsletter', 'publish'));
+Assert::false($acl->isAllowed('staff', 'pending', 'publish'));
+Assert::true($acl->isAllowed('marketing', 'pending', 'publish'));
+Assert::true($acl->isAllowed('marketing', 'newsletter', 'archive'));
+Assert::false($acl->isAllowed('marketing', 'newsletter', 'delete'));
+Assert::false($acl->isAllowed('marketing', 'newsletter'));
+
+Assert::true($acl->isAllowed('marketing', 'latest', 'publish'));
+Assert::true($acl->isAllowed('marketing', 'latest', 'archive'));
+Assert::false($acl->isAllowed('marketing', 'latest', 'delete'));
+Assert::false($acl->isAllowed('marketing', 'latest', 'revise'));
+Assert::false($acl->isAllowed('marketing', 'latest'));
+
+Assert::false($acl->isAllowed('marketing', 'announcement', 'archive'));
+Assert::false($acl->isAllowed('staff', 'announcement', 'archive'));
+Assert::false($acl->isAllowed('administrator', 'announcement', 'archive'));
+
+Assert::false($acl->isAllowed('staff', 'latest', 'publish'));
+Assert::false($acl->isAllowed('editor', 'announcement', 'archive'));
// Remove some previous permission specifications
@@ -152,19 +152,19 @@ $acl->removeDeny('staff', 'latest', 'revise');
// Access control checks for the above refinements
-Assert::false( $acl->isAllowed('marketing', 'newsletter', 'publish') );
-Assert::false( $acl->isAllowed('marketing', 'newsletter', 'archive') );
+Assert::false($acl->isAllowed('marketing', 'newsletter', 'publish'));
+Assert::false($acl->isAllowed('marketing', 'newsletter', 'archive'));
-Assert::false( $acl->isAllowed('marketing', 'latest', 'archive') );
+Assert::false($acl->isAllowed('marketing', 'latest', 'archive'));
-Assert::true( $acl->isAllowed('staff', 'latest', 'revise') );
-Assert::true( $acl->isAllowed('marketing', 'latest', 'revise') );
+Assert::true($acl->isAllowed('staff', 'latest', 'revise'));
+Assert::true($acl->isAllowed('marketing', 'latest', 'revise'));
// Grant marketing all permissions on the latest news
$acl->allow('marketing', 'latest');
// Access control checks for the above refinement
-Assert::true( $acl->isAllowed('marketing', 'latest', 'archive') );
-Assert::true( $acl->isAllowed('marketing', 'latest', 'publish') );
-Assert::true( $acl->isAllowed('marketing', 'latest', 'edit') );
-Assert::true( $acl->isAllowed('marketing', 'latest') );
+Assert::true($acl->isAllowed('marketing', 'latest', 'archive'));
+Assert::true($acl->isAllowed('marketing', 'latest', 'publish'));
+Assert::true($acl->isAllowed('marketing', 'latest', 'edit'));
+Assert::true($acl->isAllowed('marketing', 'latest'));
diff --git a/tests/Security/Permission.DefaultAssert.phpt b/tests/Security/Permission.DefaultAssert.phpt
index 97646b69..b0d3315e 100644
--- a/tests/Security/Permission.DefaultAssert.phpt
+++ b/tests/Security/Permission.DefaultAssert.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that the default rule obeys its assertion.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -19,4 +19,4 @@ function falseAssertion()
$acl = new Permission;
$acl->deny(NULL, NULL, NULL, 'falseAssertion');
-Assert::true( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::true($acl->isAllowed(NULL, NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.DefaultDeny.phpt b/tests/Security/Permission.DefaultDeny.phpt
index 31003737..2ac4a182 100644
--- a/tests/Security/Permission.DefaultDeny.phpt
+++ b/tests/Security/Permission.DefaultDeny.phpt
@@ -4,17 +4,17 @@
* Test: Nette\Security\Permission Ensures that by default denies access to everything by all.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::false( $acl->isAllowed() );
-Assert::false( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed());
+Assert::false($acl->isAllowed(NULL, NULL, 'somePrivilege'));
$acl->addRole('guest');
-Assert::false( $acl->isAllowed('guest') );
-Assert::false( $acl->isAllowed('guest', NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed('guest'));
+Assert::false($acl->isAllowed('guest', NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.DefaultRuleSet.phpt b/tests/Security/Permission.DefaultRuleSet.phpt
index 6a2e612b..063218b1 100644
--- a/tests/Security/Permission.DefaultRuleSet.phpt
+++ b/tests/Security/Permission.DefaultRuleSet.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that ACL-wide rules (all Roles, Resources, and privileges) work properly.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,9 +13,9 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->allow();
-Assert::true( $acl->isAllowed() );
-Assert::true( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::true($acl->isAllowed());
+Assert::true($acl->isAllowed(NULL, NULL, 'somePrivilege'));
$acl->deny();
-Assert::false( $acl->isAllowed() );
-Assert::false( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed());
+Assert::false($acl->isAllowed(NULL, NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.IsAllowedNonExistent.phpt b/tests/Security/Permission.IsAllowedNonExistent.phpt
index fd2b129f..e7f3b9f7 100644
--- a/tests/Security/Permission.IsAllowedNonExistent.phpt
+++ b/tests/Security/Permission.IsAllowedNonExistent.phpt
@@ -4,19 +4,19 @@
* Test: Nette\Security\Permission Ensures that an exception is thrown when a non-existent Role and Resource parameters are specified to isAllowed().
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
-Assert::exception(function() {
+Assert::exception(function () {
$acl = new Permission;
$acl->isAllowed('nonexistent');
}, 'Nette\InvalidStateException', "Role 'nonexistent' does not exist.");
-Assert::exception(function() {
+Assert::exception(function () {
$acl = new Permission;
$acl->isAllowed(NULL, 'nonexistent');
}, 'Nette\InvalidStateException', "Resource 'nonexistent' does not exist.");
diff --git a/tests/Security/Permission.PrivilegeAllow.phpt b/tests/Security/Permission.PrivilegeAllow.phpt
index f93bd1ca..a5dd2141 100644
--- a/tests/Security/Permission.PrivilegeAllow.phpt
+++ b/tests/Security/Permission.PrivilegeAllow.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that a privilege allowed for all Roles upon all Resources works properly.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,4 +13,4 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->allow(NULL, NULL, 'somePrivilege');
-Assert::true( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::true($acl->isAllowed(NULL, NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.PrivilegeAssert.phpt b/tests/Security/Permission.PrivilegeAssert.phpt
index 5a157bd6..557db609 100644
--- a/tests/Security/Permission.PrivilegeAssert.phpt
+++ b/tests/Security/Permission.PrivilegeAssert.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that assertions on privileges work properly.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -24,7 +24,7 @@ function trueAssertion()
$acl = new Permission;
$acl->allow(NULL, NULL, 'somePrivilege', 'trueAssertion');
-Assert::true( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::true($acl->isAllowed(NULL, NULL, 'somePrivilege'));
$acl->allow(NULL, NULL, 'somePrivilege', 'falseAssertion');
-Assert::false( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed(NULL, NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.PrivilegeDeny.phpt b/tests/Security/Permission.PrivilegeDeny.phpt
index 9d82d8cc..01d59d92 100644
--- a/tests/Security/Permission.PrivilegeDeny.phpt
+++ b/tests/Security/Permission.PrivilegeDeny.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that a privilege denied for all Roles upon all Resources works properly.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,4 +14,4 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->allow();
$acl->deny(NULL, NULL, 'somePrivilege');
-Assert::false( $acl->isAllowed(NULL, NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed(NULL, NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.Privileges.phpt b/tests/Security/Permission.Privileges.phpt
index 172990f7..31eb5be7 100644
--- a/tests/Security/Permission.Privileges.phpt
+++ b/tests/Security/Permission.Privileges.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that multiple privileges work properly.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,12 +13,12 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->allow(NULL, NULL, array('p1', 'p2', 'p3'));
-Assert::true( $acl->isAllowed(NULL, NULL, 'p1') );
-Assert::true( $acl->isAllowed(NULL, NULL, 'p2') );
-Assert::true( $acl->isAllowed(NULL, NULL, 'p3') );
-Assert::false( $acl->isAllowed(NULL, NULL, 'p4') );
+Assert::true($acl->isAllowed(NULL, NULL, 'p1'));
+Assert::true($acl->isAllowed(NULL, NULL, 'p2'));
+Assert::true($acl->isAllowed(NULL, NULL, 'p3'));
+Assert::false($acl->isAllowed(NULL, NULL, 'p4'));
$acl->deny(NULL, NULL, 'p1');
-Assert::false( $acl->isAllowed(NULL, NULL, 'p1') );
+Assert::false($acl->isAllowed(NULL, NULL, 'p1'));
$acl->deny(NULL, NULL, array('p2', 'p3'));
-Assert::false( $acl->isAllowed(NULL, NULL, 'p2') );
-Assert::false( $acl->isAllowed(NULL, NULL, 'p3') );
+Assert::false($acl->isAllowed(NULL, NULL, 'p2'));
+Assert::false($acl->isAllowed(NULL, NULL, 'p3'));
diff --git a/tests/Security/Permission.RemoveDefaultAllow.phpt b/tests/Security/Permission.RemoveDefaultAllow.phpt
index 5745c4dc..975f04ab 100644
--- a/tests/Security/Permission.RemoveDefaultAllow.phpt
+++ b/tests/Security/Permission.RemoveDefaultAllow.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removing the default allow rule results in default deny rule being assigned.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,6 +13,6 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->allow();
-Assert::true( $acl->isAllowed() );
+Assert::true($acl->isAllowed());
$acl->removeAllow();
-Assert::false( $acl->isAllowed() );
+Assert::false($acl->isAllowed());
diff --git a/tests/Security/Permission.RemoveDefaultAllowNonExistent.phpt b/tests/Security/Permission.RemoveDefaultAllowNonExistent.phpt
index 21d0617d..72f58318 100644
--- a/tests/Security/Permission.RemoveDefaultAllowNonExistent.phpt
+++ b/tests/Security/Permission.RemoveDefaultAllowNonExistent.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removing non-existent default allow rule does nothing.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,4 +13,4 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->removeAllow();
-Assert::false( $acl->isAllowed() );
+Assert::false($acl->isAllowed());
diff --git a/tests/Security/Permission.RemoveDefaultDeny.phpt b/tests/Security/Permission.RemoveDefaultDeny.phpt
index 4a031214..291150b0 100644
--- a/tests/Security/Permission.RemoveDefaultDeny.phpt
+++ b/tests/Security/Permission.RemoveDefaultDeny.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Security\Permission Ensures that removing the default deny rule results in default deny rule.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::false( $acl->isAllowed() );
+Assert::false($acl->isAllowed());
$acl->removeDeny();
-Assert::false( $acl->isAllowed() );
+Assert::false($acl->isAllowed());
diff --git a/tests/Security/Permission.RemoveDefaultDenyAssert.phpt b/tests/Security/Permission.RemoveDefaultDenyAssert.phpt
index b8ecd180..4fd7fe45 100644
--- a/tests/Security/Permission.RemoveDefaultDenyAssert.phpt
+++ b/tests/Security/Permission.RemoveDefaultDenyAssert.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removing the default deny rule results in assertion method being removed.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -19,6 +19,6 @@ function falseAssertion()
$acl = new Permission;
$acl->deny(NULL, NULL, NULL, 'falseAssertion');
-Assert::true( $acl->isAllowed() );
+Assert::true($acl->isAllowed());
$acl->removeDeny();
-Assert::false( $acl->isAllowed() );
+Assert::false($acl->isAllowed());
diff --git a/tests/Security/Permission.RemoveDefaultDenyNonExistent.phpt b/tests/Security/Permission.RemoveDefaultDenyNonExistent.phpt
index 713d464a..76e88fcd 100644
--- a/tests/Security/Permission.RemoveDefaultDenyNonExistent.phpt
+++ b/tests/Security/Permission.RemoveDefaultDenyNonExistent.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removing non-existent default deny rule does nothing.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,4 +14,4 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->allow();
$acl->removeDeny();
-Assert::true( $acl->isAllowed() );
+Assert::true($acl->isAllowed());
diff --git a/tests/Security/Permission.RemovingRoleAfterItWasAllowedAccessToAllResources.phpt b/tests/Security/Permission.RemovingRoleAfterItWasAllowedAccessToAllResources.phpt
index d3ce326a..e5b5c1d4 100644
--- a/tests/Security/Permission.RemovingRoleAfterItWasAllowedAccessToAllResources.phpt
+++ b/tests/Security/Permission.RemovingRoleAfterItWasAllowedAccessToAllResources.phpt
@@ -5,8 +5,8 @@
* raise undefined index error.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -24,4 +24,4 @@ $acl->allow(NULL,'Test','xxx');
$acl->removeRole('test0');
// Check after fix
-Assert::false( $acl->hasRole('test0') );
+Assert::false($acl->hasRole('test0'));
diff --git a/tests/Security/Permission.ResourceAddAndGetOne.phpt b/tests/Security/Permission.ResourceAddAndGetOne.phpt
index c34b6d93..92106ca6 100644
--- a/tests/Security/Permission.ResourceAddAndGetOne.phpt
+++ b/tests/Security/Permission.ResourceAddAndGetOne.phpt
@@ -4,18 +4,18 @@
* Test: Nette\Security\Permission Ensures that basic addition and retrieval of a single Resource works.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::false( $acl->hasResource('area') );
+Assert::false($acl->hasResource('area'));
$acl->addResource('area');
-Assert::true( $acl->hasResource('area') );
+Assert::true($acl->hasResource('area'));
$acl->removeResource('area');
-Assert::false( $acl->hasResource('area') );
+Assert::false($acl->hasResource('area'));
diff --git a/tests/Security/Permission.ResourceAddInheritsNonExistent.phpt b/tests/Security/Permission.ResourceAddInheritsNonExistent.phpt
index 1d599129..fc6836de 100644
--- a/tests/Security/Permission.ResourceAddInheritsNonExistent.phpt
+++ b/tests/Security/Permission.ResourceAddInheritsNonExistent.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Security\Permission Ensures that an exception is thrown when a non-existent Resource is specified as a parent upon Resource addition.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->addResource('area', 'nonexistent');
}, 'Nette\InvalidStateException', "Resource 'nonexistent' does not exist.");
diff --git a/tests/Security/Permission.ResourceDuplicate.phpt b/tests/Security/Permission.ResourceDuplicate.phpt
index ea92f2e1..7e071875 100644
--- a/tests/Security/Permission.ResourceDuplicate.phpt
+++ b/tests/Security/Permission.ResourceDuplicate.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Security\Permission Ensures that the same Resource cannot be added more than once.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
-Assert::exception(function() {
+Assert::exception(function () {
$acl = new Permission;
$acl->addResource('area');
$acl->addResource('area');
diff --git a/tests/Security/Permission.ResourceInherits.phpt b/tests/Security/Permission.ResourceInherits.phpt
index 46f12a8c..753c9422 100644
--- a/tests/Security/Permission.ResourceInherits.phpt
+++ b/tests/Security/Permission.ResourceInherits.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Tests basic Resource inheritance.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -16,14 +16,14 @@ $acl->addResource('city');
$acl->addResource('building', 'city');
$acl->addResource('room', 'building');
-Assert::same( array('city', 'building', 'room'), $acl->getResources() );
-Assert::true( $acl->resourceInheritsFrom('building', 'city', TRUE) );
-Assert::true( $acl->resourceInheritsFrom('room', 'building', TRUE) );
-Assert::true( $acl->resourceInheritsFrom('room', 'city') );
-Assert::false( $acl->resourceInheritsFrom('room', 'city', TRUE) );
-Assert::false( $acl->resourceInheritsFrom('city', 'building') );
-Assert::false( $acl->resourceInheritsFrom('building', 'room') );
-Assert::false( $acl->resourceInheritsFrom('city', 'room') );
+Assert::same(array('city', 'building', 'room'), $acl->getResources());
+Assert::true($acl->resourceInheritsFrom('building', 'city', TRUE));
+Assert::true($acl->resourceInheritsFrom('room', 'building', TRUE));
+Assert::true($acl->resourceInheritsFrom('room', 'city'));
+Assert::false($acl->resourceInheritsFrom('room', 'city', TRUE));
+Assert::false($acl->resourceInheritsFrom('city', 'building'));
+Assert::false($acl->resourceInheritsFrom('building', 'room'));
+Assert::false($acl->resourceInheritsFrom('city', 'room'));
$acl->removeResource('building');
-Assert::false( $acl->hasResource('room') );
+Assert::false($acl->hasResource('room'));
diff --git a/tests/Security/Permission.ResourceInheritsNonExistent.phpt b/tests/Security/Permission.ResourceInheritsNonExistent.phpt
index 1ae3545b..8e8569c6 100644
--- a/tests/Security/Permission.ResourceInheritsNonExistent.phpt
+++ b/tests/Security/Permission.ResourceInheritsNonExistent.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that an exception is thrown when a non-existent Resource is specified to each parameter of inherits().
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,10 +13,10 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addResource('area');
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->resourceInheritsFrom('nonexistent', 'area');
}, 'Nette\InvalidStateException', "Resource 'nonexistent' does not exist.");
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->resourceInheritsFrom('area', 'nonexistent');
}, 'Nette\InvalidStateException', "Resource 'nonexistent' does not exist.");
diff --git a/tests/Security/Permission.ResourceRemoveAll.phpt b/tests/Security/Permission.ResourceRemoveAll.phpt
index 16401b61..15578931 100644
--- a/tests/Security/Permission.ResourceRemoveAll.phpt
+++ b/tests/Security/Permission.ResourceRemoveAll.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removal of all Resources works.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,4 +14,4 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addResource('area');
$acl->removeAllResources();
-Assert::false( $acl->hasResource('area') );
+Assert::false($acl->hasResource('area'));
diff --git a/tests/Security/Permission.ResourceRemoveOneNonExistent.phpt b/tests/Security/Permission.ResourceRemoveOneNonExistent.phpt
index 2819116a..ae996b31 100644
--- a/tests/Security/Permission.ResourceRemoveOneNonExistent.phpt
+++ b/tests/Security/Permission.ResourceRemoveOneNonExistent.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Security\Permission Ensures that an exception is thrown when a non-existent Resource is specified for removal.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->removeResource('nonexistent');
}, 'Nette\InvalidStateException', "Resource 'nonexistent' does not exist.");
diff --git a/tests/Security/Permission.RoleDefaultAllowRuleWithPrivilegeDenyRule.phpt b/tests/Security/Permission.RoleDefaultAllowRuleWithPrivilegeDenyRule.phpt
index c655c63d..8e2b265d 100644
--- a/tests/Security/Permission.RoleDefaultAllowRuleWithPrivilegeDenyRule.phpt
+++ b/tests/Security/Permission.RoleDefaultAllowRuleWithPrivilegeDenyRule.phpt
@@ -5,8 +5,8 @@
* rule on the entire ACL.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -18,4 +18,4 @@ $acl->addRole('staff', 'guest');
$acl->deny();
$acl->allow('staff');
$acl->deny('staff', NULL, array('privilege1', 'privilege2'));
-Assert::false( $acl->isAllowed('staff', NULL, 'privilege1') );
+Assert::false($acl->isAllowed('staff', NULL, 'privilege1'));
diff --git a/tests/Security/Permission.RoleDefaultAllowRuleWithResourceDenyRule.phpt b/tests/Security/Permission.RoleDefaultAllowRuleWithResourceDenyRule.phpt
index ccfa447f..49d34e00 100644
--- a/tests/Security/Permission.RoleDefaultAllowRuleWithResourceDenyRule.phpt
+++ b/tests/Security/Permission.RoleDefaultAllowRuleWithResourceDenyRule.phpt
@@ -2,11 +2,11 @@
/**
* Test: Nette\Security\Permission Ensures that for a particular Role, a deny rule on a specific Resource is honored before an allow rule
-* on the entire ACL.
+ * on the entire ACL.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -20,4 +20,4 @@ $acl->addResource('area2');
$acl->deny();
$acl->allow('staff');
$acl->deny('staff', array('area1', 'area2'));
-Assert::false( $acl->isAllowed('staff', 'area1') );
+Assert::false($acl->isAllowed('staff', 'area1'));
diff --git a/tests/Security/Permission.RoleDefaultRuleSet.phpt b/tests/Security/Permission.RoleDefaultRuleSet.phpt
index bc84c751..05fe4234 100644
--- a/tests/Security/Permission.RoleDefaultRuleSet.phpt
+++ b/tests/Security/Permission.RoleDefaultRuleSet.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that ACL-wide rules (all Resources and privileges) work properly for a particular Role.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,6 +14,6 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest');
-Assert::true( $acl->isAllowed('guest') );
+Assert::true($acl->isAllowed('guest'));
$acl->deny('guest');
-Assert::false( $acl->isAllowed('guest') );
+Assert::false($acl->isAllowed('guest'));
diff --git a/tests/Security/Permission.RoleDefaultRuleSetPrivilege.phpt b/tests/Security/Permission.RoleDefaultRuleSetPrivilege.phpt
index fc1c39e5..2e49c9e1 100644
--- a/tests/Security/Permission.RoleDefaultRuleSetPrivilege.phpt
+++ b/tests/Security/Permission.RoleDefaultRuleSetPrivilege.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that ACL-wide rules apply to privileges for a particular Role.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,6 +14,6 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest');
-Assert::true( $acl->isAllowed('guest', NULL, 'somePrivilege') );
+Assert::true($acl->isAllowed('guest', NULL, 'somePrivilege'));
$acl->deny('guest');
-Assert::false( $acl->isAllowed('guest', NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed('guest', NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.RolePrivilegeAllow.phpt b/tests/Security/Permission.RolePrivilegeAllow.phpt
index a1602693..61bcc179 100644
--- a/tests/Security/Permission.RolePrivilegeAllow.phpt
+++ b/tests/Security/Permission.RolePrivilegeAllow.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that a privilege allowed for a particular Role upon all Resources works properly.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,4 +14,4 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest', NULL, 'somePrivilege');
-Assert::true( $acl->isAllowed('guest', NULL, 'somePrivilege') );
+Assert::true($acl->isAllowed('guest', NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.RolePrivilegeAssert.phpt b/tests/Security/Permission.RolePrivilegeAssert.phpt
index 0751f135..0b31e0f2 100644
--- a/tests/Security/Permission.RolePrivilegeAssert.phpt
+++ b/tests/Security/Permission.RolePrivilegeAssert.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that assertions on privileges work properly for a particular Role.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -25,6 +25,6 @@ function trueAssertion()
$acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest', NULL, 'somePrivilege', 'trueAssertion');
-Assert::true( $acl->isAllowed('guest', NULL, 'somePrivilege') );
+Assert::true($acl->isAllowed('guest', NULL, 'somePrivilege'));
$acl->allow('guest', NULL, 'somePrivilege', 'falseAssertion');
-Assert::false( $acl->isAllowed('guest', NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed('guest', NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.RolePrivilegeDeny.phpt b/tests/Security/Permission.RolePrivilegeDeny.phpt
index 06a91395..03988147 100644
--- a/tests/Security/Permission.RolePrivilegeDeny.phpt
+++ b/tests/Security/Permission.RolePrivilegeDeny.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that a privilege denied for a particular Role upon all Resources works properly.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -15,4 +15,4 @@ $acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest');
$acl->deny('guest', NULL, 'somePrivilege');
-Assert::false( $acl->isAllowed('guest', NULL, 'somePrivilege') );
+Assert::false($acl->isAllowed('guest', NULL, 'somePrivilege'));
diff --git a/tests/Security/Permission.RolePrivileges.phpt b/tests/Security/Permission.RolePrivileges.phpt
index 04538715..f58a9a0c 100644
--- a/tests/Security/Permission.RolePrivileges.phpt
+++ b/tests/Security/Permission.RolePrivileges.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that multiple privileges work properly for a particular Role.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,12 +14,12 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest', NULL, array('p1', 'p2', 'p3'));
-Assert::true( $acl->isAllowed('guest', NULL, 'p1') );
-Assert::true( $acl->isAllowed('guest', NULL, 'p2') );
-Assert::true( $acl->isAllowed('guest', NULL, 'p3') );
-Assert::false( $acl->isAllowed('guest', NULL, 'p4') );
+Assert::true($acl->isAllowed('guest', NULL, 'p1'));
+Assert::true($acl->isAllowed('guest', NULL, 'p2'));
+Assert::true($acl->isAllowed('guest', NULL, 'p3'));
+Assert::false($acl->isAllowed('guest', NULL, 'p4'));
$acl->deny('guest', NULL, 'p1');
-Assert::false( $acl->isAllowed('guest', NULL, 'p1') );
+Assert::false($acl->isAllowed('guest', NULL, 'p1'));
$acl->deny('guest', NULL, array('p2', 'p3'));
-Assert::false( $acl->isAllowed('guest', NULL, 'p2') );
-Assert::false( $acl->isAllowed('guest', NULL, 'p3') );
+Assert::false($acl->isAllowed('guest', NULL, 'p2'));
+Assert::false($acl->isAllowed('guest', NULL, 'p3'));
diff --git a/tests/Security/Permission.RoleRegistryAddAndGetOne.phpt b/tests/Security/Permission.RoleRegistryAddAndGetOne.phpt
index c7617fc5..82f5f03a 100644
--- a/tests/Security/Permission.RoleRegistryAddAndGetOne.phpt
+++ b/tests/Security/Permission.RoleRegistryAddAndGetOne.phpt
@@ -4,18 +4,18 @@
* Test: Nette\Security\Permission Ensures that basic addition and retrieval of a single Role works.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::false( $acl->hasRole('guest') );
+Assert::false($acl->hasRole('guest'));
$acl->addRole('guest');
-Assert::true( $acl->hasRole('guest') );
+Assert::true($acl->hasRole('guest'));
$acl->removeRole('guest');
-Assert::false( $acl->hasRole('guest') );
+Assert::false($acl->hasRole('guest'));
diff --git a/tests/Security/Permission.RoleRegistryAddInheritsNonExistent.phpt b/tests/Security/Permission.RoleRegistryAddInheritsNonExistent.phpt
index 928a54e0..974ca66b 100644
--- a/tests/Security/Permission.RoleRegistryAddInheritsNonExistent.phpt
+++ b/tests/Security/Permission.RoleRegistryAddInheritsNonExistent.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Security\Permission Ensures that an exception is thrown when a non-existent Role is specified as a parent upon Role addition.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->addRole('guest', 'nonexistent');
}, 'Nette\InvalidStateException', "Role 'nonexistent' does not exist.");
diff --git a/tests/Security/Permission.RoleRegistryDuplicate.phpt b/tests/Security/Permission.RoleRegistryDuplicate.phpt
index 97adde8c..621f66f0 100644
--- a/tests/Security/Permission.RoleRegistryDuplicate.phpt
+++ b/tests/Security/Permission.RoleRegistryDuplicate.phpt
@@ -4,15 +4,15 @@
* Test: Nette\Security\Permission Ensures that the same Role cannot be registered more than once to the registry.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->addRole('guest');
$acl->addRole('guest');
}, 'Nette\InvalidStateException', "Role 'guest' already exists in the list.");
diff --git a/tests/Security/Permission.RoleRegistryInherits.phpt b/tests/Security/Permission.RoleRegistryInherits.phpt
index bd2866d3..a9e5ce55 100644
--- a/tests/Security/Permission.RoleRegistryInherits.phpt
+++ b/tests/Security/Permission.RoleRegistryInherits.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Tests basic Role inheritance.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -15,20 +15,20 @@ $acl = new Permission;
$acl->addRole('guest');
$acl->addRole('member', 'guest');
$acl->addRole('editor', 'member');
-Assert::same( array('guest', 'member', 'editor'), $acl->getRoles() );
-Assert::same( array(), $acl->getRoleParents('guest') );
-Assert::same( array('guest'), $acl->getRoleParents('member') );
-Assert::same( array('member'), $acl->getRoleParents('editor') );
+Assert::same(array('guest', 'member', 'editor'), $acl->getRoles());
+Assert::same(array(), $acl->getRoleParents('guest'));
+Assert::same(array('guest'), $acl->getRoleParents('member'));
+Assert::same(array('member'), $acl->getRoleParents('editor'));
-Assert::true( $acl->roleInheritsFrom('member', 'guest', TRUE) );
-Assert::true( $acl->roleInheritsFrom('editor', 'member', TRUE) );
-Assert::true( $acl->roleInheritsFrom('editor', 'guest') );
-Assert::false( $acl->roleInheritsFrom('editor', 'guest', TRUE) );
-Assert::false( $acl->roleInheritsFrom('guest', 'member') );
-Assert::false( $acl->roleInheritsFrom('member', 'editor') );
-Assert::false( $acl->roleInheritsFrom('guest', 'editor') );
+Assert::true($acl->roleInheritsFrom('member', 'guest', TRUE));
+Assert::true($acl->roleInheritsFrom('editor', 'member', TRUE));
+Assert::true($acl->roleInheritsFrom('editor', 'guest'));
+Assert::false($acl->roleInheritsFrom('editor', 'guest', TRUE));
+Assert::false($acl->roleInheritsFrom('guest', 'member'));
+Assert::false($acl->roleInheritsFrom('member', 'editor'));
+Assert::false($acl->roleInheritsFrom('guest', 'editor'));
$acl->removeRole('member');
-Assert::same( array(), $acl->getRoleParents('editor') );
-Assert::false( $acl->roleInheritsFrom('editor', 'guest') );
+Assert::same(array(), $acl->getRoleParents('editor'));
+Assert::false($acl->roleInheritsFrom('editor', 'guest'));
diff --git a/tests/Security/Permission.RoleRegistryInheritsMultiple.phpt b/tests/Security/Permission.RoleRegistryInheritsMultiple.phpt
index 2d64ffc1..00c52d68 100644
--- a/tests/Security/Permission.RoleRegistryInheritsMultiple.phpt
+++ b/tests/Security/Permission.RoleRegistryInheritsMultiple.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Tests basic Role multiple inheritance.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -16,15 +16,15 @@ $acl->addRole('parent1');
$acl->addRole('parent2');
$acl->addRole('child', array('parent1', 'parent2'));
-Assert::same( array(
+Assert::same(array(
'parent1',
'parent2',
-), $acl->getRoleParents('child') );
+), $acl->getRoleParents('child'));
-Assert::true( $acl->roleInheritsFrom('child', 'parent1') );
-Assert::true( $acl->roleInheritsFrom('child', 'parent2') );
+Assert::true($acl->roleInheritsFrom('child', 'parent1'));
+Assert::true($acl->roleInheritsFrom('child', 'parent2'));
$acl->removeRole('parent1');
-Assert::same( array('parent2'), $acl->getRoleParents('child') );
-Assert::true( $acl->roleInheritsFrom('child', 'parent2') );
+Assert::same(array('parent2'), $acl->getRoleParents('child'));
+Assert::true($acl->roleInheritsFrom('child', 'parent2'));
diff --git a/tests/Security/Permission.RoleRegistryInheritsNonExistent.phpt b/tests/Security/Permission.RoleRegistryInheritsNonExistent.phpt
index 462f980c..765196cb 100644
--- a/tests/Security/Permission.RoleRegistryInheritsNonExistent.phpt
+++ b/tests/Security/Permission.RoleRegistryInheritsNonExistent.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that an exception is thrown when a non-existent Role is specified to each parameter of inherits().
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,10 +13,10 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->roleInheritsFrom('nonexistent', 'guest');
}, 'Nette\InvalidStateException', "Role 'nonexistent' does not exist.");
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->roleInheritsFrom('guest', 'nonexistent');
}, 'Nette\InvalidStateException', "Role 'nonexistent' does not exist.");
diff --git a/tests/Security/Permission.RoleRegistryRemoveAll.phpt b/tests/Security/Permission.RoleRegistryRemoveAll.phpt
index 9fbc25af..d7334f94 100644
--- a/tests/Security/Permission.RoleRegistryRemoveAll.phpt
+++ b/tests/Security/Permission.RoleRegistryRemoveAll.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removal of all Roles works.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,4 +14,4 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
$acl->removeAllRoles();
-Assert::false( $acl->hasRole('guest') );
+Assert::false($acl->hasRole('guest'));
diff --git a/tests/Security/Permission.RoleRegistryRemoveOneNonExistent.phpt b/tests/Security/Permission.RoleRegistryRemoveOneNonExistent.phpt
index a232ba27..0ecc4207 100644
--- a/tests/Security/Permission.RoleRegistryRemoveOneNonExistent.phpt
+++ b/tests/Security/Permission.RoleRegistryRemoveOneNonExistent.phpt
@@ -4,14 +4,14 @@
* Test: Nette\Security\Permission Ensures that an exception is thrown when a non-existent Role is specified for removal.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->removeRole('nonexistent');
}, 'Nette\InvalidStateException', "Role 'nonexistent' does not exist.");
diff --git a/tests/Security/Permission.RuleRoleRemove.phpt b/tests/Security/Permission.RuleRoleRemove.phpt
index 26ecb1cd..466a1312 100644
--- a/tests/Security/Permission.RuleRoleRemove.phpt
+++ b/tests/Security/Permission.RuleRoleRemove.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removal of a Role results in its rules being removed.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,11 +14,11 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest');
-Assert::true( $acl->isAllowed('guest') );
+Assert::true($acl->isAllowed('guest'));
$acl->removeRole('guest');
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->isAllowed('guest');
}, 'Nette\InvalidStateException', "Role 'guest' does not exist.");
$acl->addRole('guest');
-Assert::false( $acl->isAllowed('guest') );
+Assert::false($acl->isAllowed('guest'));
diff --git a/tests/Security/Permission.RuleRoleRemoveAll.phpt b/tests/Security/Permission.RuleRoleRemoveAll.phpt
index 00719d58..9b428477 100644
--- a/tests/Security/Permission.RuleRoleRemoveAll.phpt
+++ b/tests/Security/Permission.RuleRoleRemoveAll.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removal of all Roles results in Role-specific rules being removed.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,11 +14,11 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addRole('guest');
$acl->allow('guest');
-Assert::true( $acl->isAllowed('guest') );
+Assert::true($acl->isAllowed('guest'));
$acl->removeAllRoles();
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->isAllowed('guest');
}, 'Nette\InvalidStateException', "Role 'guest' does not exist.");
$acl->addRole('guest');
-Assert::false( $acl->isAllowed('guest') );
+Assert::false($acl->isAllowed('guest'));
diff --git a/tests/Security/Permission.RulesRemove.phpt b/tests/Security/Permission.RulesRemove.phpt
index 91910a01..5fb67994 100644
--- a/tests/Security/Permission.RulesRemove.phpt
+++ b/tests/Security/Permission.RulesRemove.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensure that basic rule removal works.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -13,9 +13,9 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->allow(NULL, NULL, array('privilege1', 'privilege2'));
-Assert::false( $acl->isAllowed() );
-Assert::true( $acl->isAllowed(NULL, NULL, 'privilege1') );
-Assert::true( $acl->isAllowed(NULL, NULL, 'privilege2') );
+Assert::false($acl->isAllowed());
+Assert::true($acl->isAllowed(NULL, NULL, 'privilege1'));
+Assert::true($acl->isAllowed(NULL, NULL, 'privilege2'));
$acl->removeAllow(NULL, NULL, 'privilege1');
-Assert::false( $acl->isAllowed(NULL, NULL, 'privilege1') );
-Assert::true( $acl->isAllowed(NULL, NULL, 'privilege2') );
+Assert::false($acl->isAllowed(NULL, NULL, 'privilege1'));
+Assert::true($acl->isAllowed(NULL, NULL, 'privilege2'));
diff --git a/tests/Security/Permission.RulesResourceRemove.phpt b/tests/Security/Permission.RulesResourceRemove.phpt
index 078ded22..560cd9db 100644
--- a/tests/Security/Permission.RulesResourceRemove.phpt
+++ b/tests/Security/Permission.RulesResourceRemove.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removal of a Resource results in its rules being removed.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,11 +14,11 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addResource('area');
$acl->allow(NULL, 'area');
-Assert::true( $acl->isAllowed(NULL, 'area') );
+Assert::true($acl->isAllowed(NULL, 'area'));
$acl->removeResource('area');
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->isAllowed(NULL, 'area');
}, 'Nette\InvalidStateException', "Resource 'area' does not exist.");
$acl->addResource('area');
-Assert::false( $acl->isAllowed(NULL, 'area') );
+Assert::false($acl->isAllowed(NULL, 'area'));
diff --git a/tests/Security/Permission.RulesResourceRemoveAll.phpt b/tests/Security/Permission.RulesResourceRemoveAll.phpt
index c11b4c6b..a1b7bc6b 100644
--- a/tests/Security/Permission.RulesResourceRemoveAll.phpt
+++ b/tests/Security/Permission.RulesResourceRemoveAll.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\Permission Ensures that removal of all Resources results in Resource-specific rules being removed.
*/
-use Nette\Security\Permission,
- Tester\Assert;
+use Nette\Security\Permission;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -14,11 +14,11 @@ require __DIR__ . '/../bootstrap.php';
$acl = new Permission;
$acl->addResource('area');
$acl->allow(NULL, 'area');
-Assert::true( $acl->isAllowed(NULL, 'area') );
+Assert::true($acl->isAllowed(NULL, 'area'));
$acl->removeAllResources();
-Assert::exception(function() use ($acl) {
+Assert::exception(function () use ($acl) {
$acl->isAllowed(NULL, 'area');
}, 'Nette\InvalidStateException', "Resource 'area' does not exist.");
$acl->addResource('area');
-Assert::false( $acl->isAllowed(NULL, 'area') );
+Assert::false($acl->isAllowed(NULL, 'area'));
diff --git a/tests/Security/SimpleAuthenticator.Roles.phpt b/tests/Security/SimpleAuthenticator.Roles.phpt
index 4ce3174a..00bab572 100644
--- a/tests/Security/SimpleAuthenticator.Roles.phpt
+++ b/tests/Security/SimpleAuthenticator.Roles.phpt
@@ -4,26 +4,26 @@
* Test: Nette\Security\SimpleAuthenticator and roles
*/
-use Nette\Security\SimpleAuthenticator,
- Tester\Assert;
+use Nette\Security\SimpleAuthenticator;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
$users = array(
- 'john' => 'john123',
+ 'john' => 'john123',
'admin' => 'admin123',
- 'user' => 'user123',
+ 'user' => 'user123',
);
$usersRoles = array(
'admin' => array('admin', 'user'),
- 'user' => 'user',
+ 'user' => 'user',
);
$expectedRoles = array(
'admin' => array('admin', 'user'),
- 'user' => array('user'),
- 'john' => array(),
+ 'user' => array('user'),
+ 'john' => array(),
);
$authenticator = new SimpleAuthenticator($users, $usersRoles);
diff --git a/tests/Security/SimpleAuthenticator.phpt b/tests/Security/SimpleAuthenticator.phpt
index 94c7e86a..c6af7d56 100644
--- a/tests/Security/SimpleAuthenticator.phpt
+++ b/tests/Security/SimpleAuthenticator.phpt
@@ -4,8 +4,8 @@
* Test: Nette\Security\SimpleAuthenticator
*/
-use Nette\Security\SimpleAuthenticator,
- Tester\Assert;
+use Nette\Security\SimpleAuthenticator;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -19,17 +19,17 @@ $users = array(
$authenticator = new SimpleAuthenticator($users);
$identity = $authenticator->authenticate(array('john', 'password123!'));
-Assert::type( 'Nette\Security\IIdentity', $identity );
+Assert::type('Nette\Security\IIdentity', $identity);
Assert::equal('john', $identity->getId());
$identity = $authenticator->authenticate(array('admin', 'admin'));
-Assert::type( 'Nette\Security\IIdentity', $identity );
+Assert::type('Nette\Security\IIdentity', $identity);
Assert::equal('admin', $identity->getId());
-Assert::exception(function() use ($authenticator) {
+Assert::exception(function () use ($authenticator) {
$authenticator->authenticate(array('admin', 'wrong password'));
}, 'Nette\Security\AuthenticationException', 'Invalid password.');
-Assert::exception(function() use ($authenticator) {
+Assert::exception(function () use ($authenticator) {
$authenticator->authenticate(array('nobody', 'password'));
}, 'Nette\Security\AuthenticationException', "User 'nobody' not found.");
diff --git a/tests/Security/User.authentication.phpt b/tests/Security/User.authentication.phpt
index d945a0d9..d37c63da 100644
--- a/tests/Security/User.authentication.phpt
+++ b/tests/Security/User.authentication.phpt
@@ -4,9 +4,9 @@
* Test: Nette\Security\User authentication.
*/
-use Nette\Security\IAuthenticator,
- Nette\Security\Identity,
- Tester\Assert;
+use Nette\Security\IAuthenticator;
+use Nette\Security\Identity;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -57,13 +57,13 @@ $user->onLoggedOut[] = function () use ($counter) {
};
-Assert::false( $user->isLoggedIn() );
-Assert::null( $user->getIdentity() );
-Assert::null( $user->getId() );
+Assert::false($user->isLoggedIn());
+Assert::null($user->getIdentity());
+Assert::null($user->getId());
// authenticate
-Assert::exception(function() use ($user) {
+Assert::exception(function () use ($user) {
// login without handler
$user->login('jane', '');
}, 'Nette\InvalidStateException', 'Authenticator has not been set.');
@@ -71,51 +71,51 @@ Assert::exception(function() use ($user) {
$handler = new Authenticator;
$user->setAuthenticator($handler);
-Assert::exception(function() use ($user) {
+Assert::exception(function () use ($user) {
// login as jane
$user->login('jane', '');
}, 'Nette\Security\AuthenticationException', 'Unknown user');
-Assert::exception(function() use ($user) {
+Assert::exception(function () use ($user) {
// login as john
$user->login('john', '');
}, 'Nette\Security\AuthenticationException', 'Password not match');
// login as john#2
$user->login('john', 'xxx');
-Assert::same( 1, $counter->login );
-Assert::true( $user->isLoggedIn() );
-Assert::equal( new Identity('John Doe', 'admin'), $user->getIdentity() );
-Assert::same( 'John Doe', $user->getId() );
+Assert::same(1, $counter->login);
+Assert::true($user->isLoggedIn());
+Assert::equal(new Identity('John Doe', 'admin'), $user->getIdentity());
+Assert::same('John Doe', $user->getId());
// login as john#3
$user->logout(TRUE);
-Assert::same( 1, $counter->logout );
-$user->login( new Identity('John Doe', 'admin') );
-Assert::same( 2, $counter->login );
-Assert::true( $user->isLoggedIn() );
-Assert::equal( new Identity('John Doe', 'admin'), $user->getIdentity() );
+Assert::same(1, $counter->logout);
+$user->login(new Identity('John Doe', 'admin'));
+Assert::same(2, $counter->login);
+Assert::true($user->isLoggedIn());
+Assert::equal(new Identity('John Doe', 'admin'), $user->getIdentity());
// log out
// logging out...
$user->logout(FALSE);
-Assert::same( 2, $counter->logout );
+Assert::same(2, $counter->logout);
-Assert::false( $user->isLoggedIn() );
-Assert::equal( new Identity('John Doe', 'admin'), $user->getIdentity() );
+Assert::false($user->isLoggedIn());
+Assert::equal(new Identity('John Doe', 'admin'), $user->getIdentity());
// logging out and clearing identity...
$user->logout(TRUE);
-Assert::same( 2, $counter->logout ); // not logged in -> logout event not triggered
+Assert::same(2, $counter->logout); // not logged in -> logout event not triggered
-Assert::false( $user->isLoggedIn() );
-Assert::null( $user->getIdentity() );
+Assert::false($user->isLoggedIn());
+Assert::null($user->getIdentity());
// namespace
// login as john#2?
$user->login('john', 'xxx');
-Assert::same( 3, $counter->login );
-Assert::true( $user->isLoggedIn() );
+Assert::same(3, $counter->login);
+Assert::true($user->isLoggedIn());
diff --git a/tests/Security/User.authorization.phpt b/tests/Security/User.authorization.phpt
index ecc91371..7e044c8c 100644
--- a/tests/Security/User.authorization.phpt
+++ b/tests/Security/User.authorization.phpt
@@ -4,10 +4,10 @@
* Test: Nette\Security\User authorization.
*/
-use Nette\Security\IAuthenticator,
- Nette\Security\Identity,
- Nette\Security\IAuthorizator,
- Tester\Assert;
+use Nette\Security\IAuthenticator;
+use Nette\Security\Identity;
+use Nette\Security\IAuthorizator;
+use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -62,12 +62,12 @@ class Authorizator implements IAuthorizator
$user = new Nette\Security\User(new MockUserStorage);
// guest
-Assert::false( $user->isLoggedIn() );
+Assert::false($user->isLoggedIn());
-Assert::same( array('guest'), $user->getRoles() );
-Assert::false( $user->isInRole('admin') );
-Assert::true( $user->isInRole('guest') );
+Assert::same(array('guest'), $user->getRoles());
+Assert::false($user->isInRole('admin'));
+Assert::true($user->isInRole('guest'));
// authenticated
@@ -77,26 +77,26 @@ $user->setAuthenticator($handler);
// login as john
$user->login('john', 'xxx');
-Assert::true( $user->isLoggedIn() );
-Assert::same( array('admin'), $user->getRoles() );
-Assert::true( $user->isInRole('admin') );
-Assert::false( $user->isInRole('guest') );
+Assert::true($user->isLoggedIn());
+Assert::same(array('admin'), $user->getRoles());
+Assert::true($user->isInRole('admin'));
+Assert::false($user->isInRole('guest'));
// authorization
-Assert::exception(function() use ($user) {
+Assert::exception(function () use ($user) {
$user->isAllowed('delete_file');
}, 'Nette\InvalidStateException', 'Authorizator has not been set.');
$handler = new Authorizator;
$user->setAuthorizator($handler);
-Assert::true( $user->isAllowed('delete_file') );
-Assert::false( $user->isAllowed('sleep_with_jany') );
+Assert::true($user->isAllowed('delete_file'));
+Assert::false($user->isAllowed('sleep_with_jany'));
// log out
// logging out...
$user->logout(FALSE);
-Assert::false( $user->isAllowed('delete_file') );
+Assert::false($user->isAllowed('delete_file'));
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 85f7726f..e333db3d 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -4,7 +4,7 @@
// invoked through the command: ../vendor/bin/tester .
if (@!include __DIR__ . '/../vendor/autoload.php') {
- echo 'Install Nette Tester using `composer update --dev`';
+ echo 'Install Nette Tester using `composer install`';
exit(1);
}