Skip to content

Commit

Permalink
Fixes testcases.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Sep 19, 2015
1 parent 4d23be2 commit b00f175
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/Authorization/AuthorizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function setUp()
$memory = new Provider(new Runtime('foo', []));
$memory->put('acl_foo', $this->memoryProvider());

$this->stub = new Authorization($this->app['auth'], 'foo', $memory);
$this->stub = (new Authorization('foo', $memory))->setAuthenticator($this->app['auth']);
}

/**
Expand Down Expand Up @@ -116,7 +116,7 @@ public function testSyncMemoryAfterConstruct()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($this->app['auth'], 'foo');
$stub = (new Authorization('foo'))->setAuthenticator($this->app['auth']);

$this->assertFalse($stub->attached());

Expand Down Expand Up @@ -171,7 +171,7 @@ public function testAttachMethodThrowsExceptionWhenAttachMultipleMemory()

$runtime2 = new Provider(new Runtime('foobar', []));

$stub = new Authorization($this->app['auth'], 'foo', $runtime1);
$stub = (new Authorization('foo', $runtime1))->setAuthenticator($this->app['auth']);
$stub->attach($runtime2);
}

Expand All @@ -187,7 +187,7 @@ public function testAttachMethodWhenAttachMultipleMemoryUsingTheSameInstance()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($this->app['auth'], 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($this->app['auth']);
$stub->attach($runtime);
}

Expand All @@ -201,7 +201,7 @@ public function testAllowMethod()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($this->app['auth'], 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($this->app['auth']);

$stub->allow('guest', 'manage-user');

Expand All @@ -228,7 +228,7 @@ public function testDenyMethod()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($this->app['auth'], 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($this->app['auth']);

$stub->deny('admin', 'manage-user');

Expand Down Expand Up @@ -260,7 +260,7 @@ public function testCanMethodAsAdminUser()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($auth, 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($auth);

$stub->addActions(['Manage Page', 'Manage Photo']);
$stub->allow('guest', 'Manage Page');
Expand All @@ -286,7 +286,7 @@ public function testCanMethodAsUser()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($auth, 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($auth);

$stub->addRoles(['Staff']);
$stub->addActions(['Manage Application', 'Manage Photo']);
Expand All @@ -312,7 +312,7 @@ public function testCanMethodAsUserShouldNotBeAffectedByRoleOrder()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($auth, 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($auth);

$stub->addRoles(['Staff']);
$stub->addActions(['Manage Application', 'Manage Photo']);
Expand All @@ -333,7 +333,7 @@ public function testCanMethodAsGuestUser()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($this->app['auth'], 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($this->app['auth']);

$stub->addActions(['Manage Page', 'Manage Photo']);
$stub->allow('guest', 'Manage Page');
Expand All @@ -353,7 +353,7 @@ public function testCheckMethod()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($this->app['auth'], 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($this->app['auth']);

$stub->addActions(['Manage Page', 'Manage Photo']);
$stub->allow('guest', 'Manage Page');
Expand Down Expand Up @@ -454,7 +454,7 @@ public function testAddDuplicates()
$runtime = $this->getRuntimeMemoryProvider();
$runtime->put('acl_foo', $this->memoryProvider());

$stub = new Authorization($this->app['auth'], 'foo', $runtime);
$stub = (new Authorization('foo', $runtime))->setAuthenticator($this->app['auth']);
$refl = new \ReflectionObject($stub);
$actions = $refl->getProperty('actions');
$roles = $refl->getProperty('roles');
Expand Down

0 comments on commit b00f175

Please sign in to comment.