PHP 클래스 AcControllerResourceTest

상속: extends AcTestCase, use trait AuthorityControllerHelpers
파일 보기 프로젝트 열기: efficiently/authority-controller

공개 메소드들

메소드 설명
setUp ( )
testBuildCollectionWhenOnIndexAction ( ) Should build a collection when on index action
testBuildNewResourceForNamespacedControllerAndNamespacedModelWithAssociativeArrayIfParamIdIsNotSpecified ( ) Should build a new resource for namespaced controller and namespaced model with hash if params[:id] is not specified
testBuildNewResourceNamespacedModelWithAssociativeArrayIfParamIdIsNotSpecified ( ) Should build a new resource for namespaced model with hash if params[:id] is not specified
testBuildNewResourceWithAssociativeArrayIfParamIdIsNotSpecified ( ) Should build a new resource with hash if params[:id] is not specified
testCreateThroughNamespacedParams ( ) Should store through the namespaced params
testHasSpecifiedNestedResourceClassWithSlashedNamespace ( ) Has the specified nested resource_class when using '/' for namespace
testLoadResourceForNamespacedController ( ) Should properly load resource for namespaced controller
testLoadResourceInstanceWithParamId ( ) Should load the resource into an instance variable if $params['id'] is specified
testLoadResourceWithSameNamespaceAsControllerWithBackslashedNamespace ( ) Should attempt to load a resource with the same namespace as the controller when using '\' for namespace
testNotLoadResourceInstanceIfAlreadySet ( ) Should not load resource into an instance variable if already set
testProperlyDetectNamespacesResourceControllerWithBackslashedNamespace ( ) Should properly detect namespaces for resource and controller when using '\' for namespace
testProperlyDetectRootNamespaceResourceNamespacedControllerWithBackslashedNamespace ( ) Should properly detect root namespace of resource for namespaced controller when using '\' for namespace
testProperlyLoadResourceNamespacedControllerWithBackslashedNamespace ( ) Should properly load resource for namespaced controller when using '\' for namespace
testShouldAllowFullFindMethodToBePassedIntoFindByOption ( ) Should allow full find method to be passed into findBy option
testShouldAlwaysConvertIdParamToString ( ) Should always convert id param to string
testShouldAuthorizeBasedOnResourceNameIfClassIsFalse ( ) Should authorize based on resource name if class is false
testShouldAuthorizeNestedResourceThroughParentAssociationOnIndexAction ( ) Should authorize nested resource through parent association on index action
testShouldAuthorizeParentResourceInCollectionAction ( ) Should authorize parent resource in collection action
testShouldBeAParentResourceWhenNameIsProvidedWhichDoesntMatchController ( ) Should be a parent resource when name is provided which doesn't match controller
testShouldBeParentIfSpecifiedInOptions ( ) // Should be parent if specified in options
testShouldBuildAResourceWhenOnCustomCreateActionEvenWhenParamsIdExists ( ) Should build a resource when on custom create action even when $this->params['id'] exists
testShouldBuildRecordThroughHasOneAssociationWithSingletonAndShallowOptions ( ) Should build record through hasOne association with 'singleton' and 'shallow' options
testShouldCallClosureWhenAnInstanceVariableIsPassed ( ) Should call Closure when an instance variable is passed
testShouldCallLoadResourceAndAuthorizeResourceForLoadAndAuthorizeResource ( ) Should call loadResource and authorizeResource for loadAndAuthorizeResource
testShouldFindRecordThroughHasOneAssociationWithSingletonAndShallowOptions ( ) Should find record through hasOne association with 'singleton' and 'shallow' options
testShouldFindRecordThroughHasOneAssociationWithSingletonOptionWithoutIdParam ( ) Should find record through hasOne association with 'singleton' option without id param
testShouldHaveTheSpecifiedResourceClassIfNameIsPassedToLoadResource ( ) Should have the specified resource_class if 'name' is passed to loadResource()
testShouldLoadACollectionResourceWhenOnCustomActionWithNoIdParam ( ) // Should load a collection resource when on custom action with no id param
testShouldLoadAndAuthorizeUsingCustomInstanceName ( ) Should load and authorize using custom instance name
testShouldLoadCollectionResourceWhenDefiningAuthorityRulesThroughClosure ( ) Should not use load collection when defining Authority rules through a Closure
testShouldLoadParentResourceThroughProperIdParameter ( ) Should load parent resource through proper id parameter
testShouldLoadResourceThroughCustomMethodOfTheController ( ) Should load resource through a custom method of the controller
testShouldLoadResourceThroughTheAssociationOfAnotherParentResourceUsingGetterMethod ( ) Should load resource through the association of another parent resource using getter method
testShouldLoadResourceThroughTheAssociationOfAnotherParentResourceUsingInstanceVariable ( ) Should load resource through the association of another parent resource using instance variable
testShouldLoadResourceThroughTheAssociationOfAnotherParentResourceUsingMethod ( ) Should load resource through the association of another parent resource using method
testShouldLoadResourceThroughTheCustomAssociationName ( ) Should load resource through the custom association name
testShouldLoadResourceUsingCustomFindByAttribute ( ) Should load resource using custom findByAttribute
testShouldLoadResourceUsingCustomIDParam ( ) Should load resource using custom ID param
testShouldLoadResourceUsingCustomQuery ( ) Should load resource using custom query where('attribute_name', $attribute);
testShouldLoadTheModelUsingACustomClass ( ) Should load the model using a custom class
testShouldLoadTheModelUsingACustomNamespacedClass ( ) Should load the model using a custom namespaced class
testShouldLoadThroughFirstMatchingIfMultipleAreGiven ( ) Should load through first matching if multiple are given
testShouldNotAuthorizeSingleResourceInCollectionAction ( ) Should not authorize single resource in collection action
testShouldNotBeAParentResourceWhenNameIsProvidedWhichMatchesController ( ) // Should not be a parent resource when name is provided which matches controller
testShouldNotBeParentIfSpecifiedInOptions ( ) // Should not be parent if specified in options
testShouldNotBuildASingleResourceWhenOnCustomCollectionActionEvenWithId ( ) Should not build a single resource when on custom collection action even with id
testShouldNotBuildRecordThroughHasOneAssociationWithSingletonOptionBecauseItCanCauseItToDeleteItInTheDatabase ( ) Should not build record through hasOne association with 'singleton' option because it can cause it to delete it in the database
testShouldNotCallClosureWhenOnlyClassNameIsPassedOnlyReturnTrue ( ) Should not call Closure when only class name is passed, only return true
testShouldNotLoadThroughParentResourceIfInstanceIsntLoadedWhenShallow ( ) Should not load through parent resource if instance isn't loaded when shallow
testShouldNotTryToLoadResourceForOtherActionIfParamsIdIsUndefined ( ) Should not try to load resource for other action if $this->params['id'] is undefined
testShouldOnlyAuthorizeShowActionOnParentResource ( ) Should only authorize 'show' action on parent resource
testShouldPerformAuthorizationUsingControllerActionAndLoadedModel ( ) Should perform authorization using controller action and loaded model
testShouldPerformAuthorizationUsingControllerActionAndNonLoadedModel ( ) Should perform authorization using controller action and non loaded model
testShouldRaiseAccessDeniedWhenAttemptingToLoadResourceThroughNull ( ) Should raise AccessDenied when attempting to load resource through null

보호된 메소드들

메소드 설명
buildModel ( $modelName, $modelAttributes = [] )

메소드 상세

buildModel() 보호된 메소드

protected buildModel ( $modelName, $modelAttributes = [] )

setUp() 공개 메소드

public setUp ( )

testBuildCollectionWhenOnIndexAction() 공개 메소드

Should build a collection when on index action

testBuildNewResourceForNamespacedControllerAndNamespacedModelWithAssociativeArrayIfParamIdIsNotSpecified() 공개 메소드

Should build a new resource for namespaced controller and namespaced model with hash if params[:id] is not specified

testBuildNewResourceNamespacedModelWithAssociativeArrayIfParamIdIsNotSpecified() 공개 메소드

Should build a new resource for namespaced model with hash if params[:id] is not specified

testBuildNewResourceWithAssociativeArrayIfParamIdIsNotSpecified() 공개 메소드

Should build a new resource with hash if params[:id] is not specified

testCreateThroughNamespacedParams() 공개 메소드

Should store through the namespaced params

testHasSpecifiedNestedResourceClassWithSlashedNamespace() 공개 메소드

Has the specified nested resource_class when using '/' for namespace

testLoadResourceForNamespacedController() 공개 메소드

Should properly load resource for namespaced controller

testLoadResourceInstanceWithParamId() 공개 메소드

Should load the resource into an instance variable if $params['id'] is specified

testLoadResourceWithSameNamespaceAsControllerWithBackslashedNamespace() 공개 메소드

Should attempt to load a resource with the same namespace as the controller when using '\' for namespace

testNotLoadResourceInstanceIfAlreadySet() 공개 메소드

Should not load resource into an instance variable if already set

testProperlyDetectNamespacesResourceControllerWithBackslashedNamespace() 공개 메소드

Should properly detect namespaces for resource and controller when using '\' for namespace

testProperlyDetectRootNamespaceResourceNamespacedControllerWithBackslashedNamespace() 공개 메소드

Should properly detect root namespace of resource for namespaced controller when using '\' for namespace

testProperlyLoadResourceNamespacedControllerWithBackslashedNamespace() 공개 메소드

Should properly load resource for namespaced controller when using '\' for namespace

testShouldAllowFullFindMethodToBePassedIntoFindByOption() 공개 메소드

Should allow full find method to be passed into findBy option

testShouldAlwaysConvertIdParamToString() 공개 메소드

Should always convert id param to string

testShouldAuthorizeBasedOnResourceNameIfClassIsFalse() 공개 메소드

Should authorize based on resource name if class is false

testShouldAuthorizeNestedResourceThroughParentAssociationOnIndexAction() 공개 메소드

Should authorize nested resource through parent association on index action

testShouldAuthorizeParentResourceInCollectionAction() 공개 메소드

Should authorize parent resource in collection action

testShouldBeAParentResourceWhenNameIsProvidedWhichDoesntMatchController() 공개 메소드

Should be a parent resource when name is provided which doesn't match controller

testShouldBeParentIfSpecifiedInOptions() 공개 메소드

// Should be parent if specified in options

testShouldBuildAResourceWhenOnCustomCreateActionEvenWhenParamsIdExists() 공개 메소드

Should build a resource when on custom create action even when $this->params['id'] exists

testShouldBuildRecordThroughHasOneAssociationWithSingletonAndShallowOptions() 공개 메소드

Should build record through hasOne association with 'singleton' and 'shallow' options

testShouldCallClosureWhenAnInstanceVariableIsPassed() 공개 메소드

Should call Closure when an instance variable is passed

testShouldCallLoadResourceAndAuthorizeResourceForLoadAndAuthorizeResource() 공개 메소드

Should call loadResource and authorizeResource for loadAndAuthorizeResource

testShouldFindRecordThroughHasOneAssociationWithSingletonAndShallowOptions() 공개 메소드

Should find record through hasOne association with 'singleton' and 'shallow' options

testShouldFindRecordThroughHasOneAssociationWithSingletonOptionWithoutIdParam() 공개 메소드

Should find record through hasOne association with 'singleton' option without id param

testShouldHaveTheSpecifiedResourceClassIfNameIsPassedToLoadResource() 공개 메소드

Should have the specified resource_class if 'name' is passed to loadResource()

testShouldLoadACollectionResourceWhenOnCustomActionWithNoIdParam() 공개 메소드

// Should load a collection resource when on custom action with no id param

testShouldLoadAndAuthorizeUsingCustomInstanceName() 공개 메소드

Should load and authorize using custom instance name

testShouldLoadCollectionResourceWhenDefiningAuthorityRulesThroughClosure() 공개 메소드

Should not use load collection when defining Authority rules through a Closure

testShouldLoadParentResourceThroughProperIdParameter() 공개 메소드

Should load parent resource through proper id parameter

testShouldLoadResourceThroughCustomMethodOfTheController() 공개 메소드

Should load resource through a custom method of the controller

testShouldLoadResourceThroughTheAssociationOfAnotherParentResourceUsingGetterMethod() 공개 메소드

Should load resource through the association of another parent resource using getter method

testShouldLoadResourceThroughTheAssociationOfAnotherParentResourceUsingInstanceVariable() 공개 메소드

Should load resource through the association of another parent resource using instance variable

testShouldLoadResourceThroughTheAssociationOfAnotherParentResourceUsingMethod() 공개 메소드

Should load resource through the association of another parent resource using method

testShouldLoadResourceThroughTheCustomAssociationName() 공개 메소드

Should load resource through the custom association name

testShouldLoadResourceUsingCustomFindByAttribute() 공개 메소드

Should load resource using custom findByAttribute

testShouldLoadResourceUsingCustomIDParam() 공개 메소드

Should load resource using custom ID param

testShouldLoadResourceUsingCustomQuery() 공개 메소드

Should load resource using custom query where('attribute_name', $attribute);

testShouldLoadTheModelUsingACustomClass() 공개 메소드

Should load the model using a custom class

testShouldLoadTheModelUsingACustomNamespacedClass() 공개 메소드

Should load the model using a custom namespaced class

testShouldLoadThroughFirstMatchingIfMultipleAreGiven() 공개 메소드

Should load through first matching if multiple are given

testShouldNotAuthorizeSingleResourceInCollectionAction() 공개 메소드

Should not authorize single resource in collection action

testShouldNotBeAParentResourceWhenNameIsProvidedWhichMatchesController() 공개 메소드

// Should not be a parent resource when name is provided which matches controller

testShouldNotBeParentIfSpecifiedInOptions() 공개 메소드

// Should not be parent if specified in options

testShouldNotBuildASingleResourceWhenOnCustomCollectionActionEvenWithId() 공개 메소드

Should not build a single resource when on custom collection action even with id

testShouldNotBuildRecordThroughHasOneAssociationWithSingletonOptionBecauseItCanCauseItToDeleteItInTheDatabase() 공개 메소드

Should not build record through hasOne association with 'singleton' option because it can cause it to delete it in the database

testShouldNotCallClosureWhenOnlyClassNameIsPassedOnlyReturnTrue() 공개 메소드

Should not call Closure when only class name is passed, only return true

testShouldNotLoadThroughParentResourceIfInstanceIsntLoadedWhenShallow() 공개 메소드

Should not load through parent resource if instance isn't loaded when shallow

testShouldNotTryToLoadResourceForOtherActionIfParamsIdIsUndefined() 공개 메소드

Should not try to load resource for other action if $this->params['id'] is undefined

testShouldOnlyAuthorizeShowActionOnParentResource() 공개 메소드

Should only authorize 'show' action on parent resource

testShouldPerformAuthorizationUsingControllerActionAndLoadedModel() 공개 메소드

Should perform authorization using controller action and loaded model

testShouldPerformAuthorizationUsingControllerActionAndNonLoadedModel() 공개 메소드

Should perform authorization using controller action and non loaded model

testShouldRaiseAccessDeniedWhenAttemptingToLoadResourceThroughNull() 공개 메소드

Should raise AccessDenied when attempting to load resource through null