@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $privileges = array('new', 'test', 'edit');
|
| 67 | 67 | |
| 68 | - foreach(array($role, $user) as $testObj) |
|
| 68 | + foreach (array($role, $user) as $testObj) |
|
| 69 | 69 | {
|
| 70 | 70 | // non user is always false? |
| 71 | - foreach($privileges as $p) |
|
| 71 | + foreach ($privileges as $p) |
|
| 72 | 72 | {
|
| 73 | - $this->assertFalse((bool)$target->assert($acl, $testObj, null, $p)); |
|
| 73 | + $this->assertFalse((bool) $target->assert($acl, $testObj, null, $p)); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // user and wrong privilege is false? |
| 77 | - foreach($privileges as $p) |
|
| 77 | + foreach ($privileges as $p) |
|
| 78 | 78 | {
|
| 79 | 79 | // Casting null to false is safe here, 'edit' for pair user-privilege tested after |
| 80 | - $this->assertFalse((bool)$target->assert($acl, $testObj, $job, $p)); |
|
| 80 | + $this->assertFalse((bool) $target->assert($acl, $testObj, $job, $p)); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | //$user->setOrganization($organization); |
| 118 | 118 | |
| 119 | 119 | /** Organization without user **/ |
| 120 | - $this->assertFalse( $assertion->checkOrganizationPermissions( $user, $job ) ); |
|
| 120 | + $this->assertFalse($assertion->checkOrganizationPermissions($user, $job)); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * @dataProvider assertParametersWithoutOrganization |
| 125 | 125 | */ |
| 126 | - public function testAssertWithoutOrganisation($input, $expected){
|
|
| 126 | + public function testAssertWithoutOrganisation($input, $expected) {
|
|
| 127 | 127 | |
| 128 | - $method="assert".($expected?"True":"False"); |
|
| 128 | + $method = "assert".($expected ? "True" : "False"); |
|
| 129 | 129 | |
| 130 | 130 | $this->$method( |
| 131 | 131 | $this->target->assert( |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function assertParametersWithoutOrganization(){
|
|
| 141 | + public function assertParametersWithoutOrganization() {
|
|
| 142 | 142 | |
| 143 | 143 | $userId = 1234; |
| 144 | 144 | $user = new User(); |
@@ -163,13 +163,13 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | return [ |
| 166 | - [[new Acl(), null, null, null] , false ], |
|
| 167 | - [[new Acl(), null, null, Permissions::PERMISSION_CHANGE] , false ], |
|
| 168 | - [[new Acl(), $user, $jobMock, 'edit'] , true ], |
|
| 166 | + [[new Acl(), null, null, null], false], |
|
| 167 | + [[new Acl(), null, null, Permissions::PERMISSION_CHANGE], false], |
|
| 168 | + [[new Acl(), $user, $jobMock, 'edit'], true], |
|
| 169 | 169 | ]; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - public function testAssertUserIsOrganizationAdmin(){
|
|
| 172 | + public function testAssertUserIsOrganizationAdmin() {
|
|
| 173 | 173 | |
| 174 | 174 | $userId = 1234; |
| 175 | 175 | $user = new User(); |
@@ -192,13 +192,13 @@ discard block |
||
| 192 | 192 | $this->assertTrue( |
| 193 | 193 | $this->target->assert( |
| 194 | 194 | new Acl(), // acl |
| 195 | - $user, // role |
|
| 196 | - $jobMock, // resource |
|
| 195 | + $user, // role |
|
| 196 | + $jobMock, // resource |
|
| 197 | 197 | 'edit' // privilege |
| 198 | 198 | )); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - public function testAssertUserIsOwnerOfTheParentOrganization(){
|
|
| 201 | + public function testAssertUserIsOwnerOfTheParentOrganization() {
|
|
| 202 | 202 | |
| 203 | 203 | $userId = 1234; |
| 204 | 204 | $user = new User(); |
@@ -225,13 +225,13 @@ discard block |
||
| 225 | 225 | $this->assertTrue( |
| 226 | 226 | $this->target->assert( |
| 227 | 227 | new Acl(), // acl |
| 228 | - $user, // role |
|
| 229 | - $jobMock, // resource |
|
| 228 | + $user, // role |
|
| 229 | + $jobMock, // resource |
|
| 230 | 230 | 'edit' // privilege |
| 231 | 231 | )); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function testUserIsEmployeeWithJobsChangePermissions(){
|
|
| 234 | + public function testUserIsEmployeeWithJobsChangePermissions() {
|
|
| 235 | 235 | |
| 236 | 236 | $userId = 1234; |
| 237 | 237 | $user = new User(); |
@@ -265,8 +265,8 @@ discard block |
||
| 265 | 265 | $this->assertTrue( |
| 266 | 266 | $this->target->assert( |
| 267 | 267 | new Acl(), // acl |
| 268 | - $user, // role |
|
| 269 | - $jobMock, // resource |
|
| 268 | + $user, // role |
|
| 269 | + $jobMock, // resource |
|
| 270 | 270 | 'edit' // privilege |
| 271 | 271 | )); |
| 272 | 272 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | $commonModules = include_once __DIR__.'/../../../config/common.modules.php'; |
| 3 | 3 | |
| 4 | 4 | return array( |
| 5 | - 'modules' => array_merge($commonModules,array( |
|
| 5 | + 'modules' => array_merge($commonModules, array( |
|
| 6 | 6 | 'Core', |
| 7 | 7 | 'Auth', |
| 8 | 8 | 'Jobs', |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** @var array $testConfig */ |
| 4 | -$testConfig = include __DIR__ . '/TestConfig.php'; |
|
| 4 | +$testConfig = include __DIR__.'/TestConfig.php'; |
|
| 5 | 5 | |
| 6 | -require_once __DIR__ . '/../../../test/Bootstrap.php'; |
|
| 6 | +require_once __DIR__.'/../../../test/Bootstrap.php'; |
|
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | return array( |
| 6 | 6 | // This should be an array of module namespaces used in the application. |
| 7 | - 'modules' => array_merge($commonModules,array( |
|
| 7 | + 'modules' => array_merge($commonModules, array( |
|
| 8 | 8 | 'Core', |
| 9 | 9 | 'Auth', |
| 10 | 10 | 'Jobs', |
@@ -155,9 +155,9 @@ |
||
| 155 | 155 | $self = $this; |
| 156 | 156 | |
| 157 | 157 | $events->expects($this->once())->method('triggerUntil') |
| 158 | - ->will($this->returnCallback(function ($callback,$eventName,$event) use ($acl, $role, $resource, $privilege, $self) { |
|
| 158 | + ->will($this->returnCallback(function($callback, $eventName, $event) use ($acl, $role, $resource, $privilege, $self) { |
|
| 159 | 159 | $self->assertTrue(is_callable($callback)); |
| 160 | - $self->assertEquals('assert',$eventName); |
|
| 160 | + $self->assertEquals('assert', $eventName); |
|
| 161 | 161 | $self->assertSame($acl, $event->getAcl()); |
| 162 | 162 | $self->assertSame($role, $event->getRole()); |
| 163 | 163 | $self->assertSame($resource, $event->getResource()); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ->willReturn(array()); |
| 39 | 39 | |
| 40 | 40 | $target = new AssertionManagerFactory(); |
| 41 | - $manager = $target->__invoke($services,AssertionManager::class); |
|
| 41 | + $manager = $target->__invoke($services, AssertionManager::class); |
|
| 42 | 42 | |
| 43 | 43 | $this->assertInstanceOf('\Acl\Assertion\AssertionManager', $manager); |
| 44 | 44 | //$this->assertFalse($manager->shareByDefault(), 'The managers\' shareByDefault value must be set to FALSE by the factory.'); |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $target = new AssertionManagerFactory(); |
| 63 | 63 | |
| 64 | - $manager = $target->__invoke($services,AssertionManager::class); |
|
| 64 | + $manager = $target->__invoke($services, AssertionManager::class); |
|
| 65 | 65 | |
| 66 | - $this->assertTrue($testResult === $manager->has($testName), 'Expected managers\' has method to return ' . ($testResult ? 'TRUE' : 'FALSE') . ' on ' .$testName); |
|
| 66 | + $this->assertTrue($testResult === $manager->has($testName), 'Expected managers\' has method to return '.($testResult ? 'TRUE' : 'FALSE').' on '.$testName); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public function provideConfigArrays() |
@@ -49,6 +49,6 @@ |
||
| 49 | 49 | ])); |
| 50 | 50 | |
| 51 | 51 | $controllerFactory = new RemoveControllerFactory(); |
| 52 | - $this->assertInstanceOf(RemoveController::class, $controllerFactory($serviceLocator,'irrelevant')); |
|
| 52 | + $this->assertInstanceOf(RemoveController::class, $controllerFactory($serviceLocator, 'irrelevant')); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | private $target = [ |
| 40 | 40 | UserSwitcherFactory::class, |
| 41 | 41 | '@testCreateServiceInvokesItself' => [ |
| 42 | - 'mock' => [ '__invoke' ], |
|
| 42 | + 'mock' => ['__invoke'], |
|
| 43 | 43 | ], |
| 44 | 44 | ]; |
| 45 | 45 | |
| 46 | - private $inheritance = [ FactoryInterface::class ]; |
|
| 46 | + private $inheritance = [FactoryInterface::class]; |
|
| 47 | 47 | |
| 48 | 48 | public function testCreateServiceInvokesItself() |
| 49 | 49 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $auth = $this->getMockBuilder(AuthenticationService::class)->disableOriginalConstructor()->getMock(); |
| 64 | 64 | $acl = $this->getMockBuilder(Acl::class)->disableOriginalConstructor()->getMock(); |
| 65 | 65 | $sm = $this->createServiceManagerMock(); |
| 66 | - $controllerPlugins = $this->getPluginManagerMock(['Acl' => ['service' => $acl, 'count_get' => 1]],$sm); |
|
| 66 | + $controllerPlugins = $this->getPluginManagerMock(['Acl' => ['service' => $acl, 'count_get' => 1]], $sm); |
|
| 67 | 67 | $container = $this->getServiceManagerMock([ |
| 68 | 68 | 'AuthenticationService' => ['service' => $auth, 'count_get' => 1], |
| 69 | 69 | 'ControllerPluginManager' => ['service' => $controllerPlugins, 'count_get' => 1] |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | $hm = new HelperPluginManager($sm); |
| 28 | 28 | |
| 29 | - $helper = $f->__invoke($sm,Auth::class); |
|
| 29 | + $helper = $f->__invoke($sm, Auth::class); |
|
| 30 | 30 | |
| 31 | 31 | $this->assertInstanceOf('\Auth\View\Helper\Auth', $helper); |
| 32 | 32 | $this->assertSame($auth, $helper->getService()); |