AcControllerResourceTest::testShouldRaiseAccessDeniedWhenAttemptingToLoadResourceThroughNull PHP Method

testShouldRaiseAccessDeniedWhenAttemptingToLoadResourceThroughNull() public method

Should raise AccessDenied when attempting to load resource through null
    public function testShouldRaiseAccessDeniedWhenAttemptingToLoadResourceThroughNull()
    {
        $projectAttributes = ['id' => 2];
        $project = $this->buildModel('Project', $projectAttributes);
        $this->params = array_merge($this->params, array_merge(['action' => 'show', 'id' => $project->id]));
        $resource = new Efficiently\AuthorityController\ControllerResource($this->controller, ['through' => 'category']);
        try {
            $resource->loadResource();
        } catch (Efficiently\AuthorityController\Exceptions\AccessDenied $exception) {
            $this->assertEquals($exception->action, 'show');
            $this->assertEquals($exception->subject, 'Project');
            $this->assertNull($this->getProperty($this->controller, 'project'));
            return;
            // see http://phpunit.de/manual/3.7/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions.examples.ExceptionTest4.php
        }
        $this->fail('An expected exception has not been raised.');
    }
AcControllerResourceTest