PHP Класс AcControllerResourceTest

Наследование: extends AcTestCase, use trait AuthorityControllerHelpers
Показать файл Открыть проект

Открытые методы

Метод Описание
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