PHP Class CrudComponentTestCase, Platform-Crud-Plugin

Inheritance: extends ControllerTestCase
Show file Open project: nodesagency/Platform-Crud-Plugin

Public Properties

Property Type Description
$fixtures Use the core posts fixture to have something to work on. What fixture is used is almost irrelevant, was chosen as it is simple

Public Methods

Method Description
setUp ( ) setUp
tearDown ( ) tearDown method
testAddActionGet ( ) testAddActionGet
testAddActionPost ( ) testAddActionPost
testAddActionTranslated ( ) : void testAddActionTranslated
testAddActionTranslatedBaseline ( ) : void testAddActionTranslatedBaseline
testAddActionTranslatedChangedMessage ( ) : void testAddActionTranslatedChangedName
testAddActionTranslatedChangedName ( ) : void testAddActionTranslatedChangedName
testAddActionTranslatedDefaultDomain ( ) : void testAddActionTranslatedDefaultDomain
testCrudWillComplainAboutUnmappedAction ( ) : void Test if crud complains about unmapped actions
testCustomFindChanged ( ) : void Test if custom finds are changed when re-mapped
testCustomFindDefaults ( ) : void Test the default settings match the expected
testCustomFindDeletePublished ( ) : void Test if custom finders work in delete
testCustomFindDeleteUnpublished ( ) : void Test if custom finders work in delete - part 2
testCustomFindEditPublished ( ) : void Test if custom finders work in edit
testCustomFindEditUnpublished ( ) : void Test if custom finders work in edit - part two
testCustomFindPaginationCustomPublished ( ) : void Test if custom pagination works - for published posts
testCustomFindPaginationCustomUnpublished ( ) : void Test if custom pagination works - for unpublished posts
testCustomFindPaginationDefaultNoAlias ( ) : void Test that the default pagination settings match, bot for 2.3 and < 2.2
testCustomFindPaginationDefaultWithAlias ( ) : void Test that the default pagination settings match, bot for 2.3 and < 2.2
testCustomFindPaginationWithControllerFindMethod ( ) : void Test if custom pagination works when findType is changed from Controller paginate property
testCustomFindViewPublished ( ) : void Test if custom finders work in view
testCustomFindViewUnpublished ( ) : void Test if custom finders work in view - part 2
testDeleteActionDoesNotExists ( ) testDeleteActionDoesNotExists
testDeleteActionExists ( ) testDeleteActionExists
testDeleteFailsWithPostAndSecureDeleteActive ( ) testDeleteFailsWithPostAndSecureDeleteActive
testDeleteWorksWhenDELETEandSecureDelete ( ) testDeleteWorksWhenDELETEandSecureDelete
testDeleteWorksWithPostAndSecureDeleteActive ( ) testDeleteWorksWithPostAndSecureDeleteDisabled
testDetectPrimaryKeyFieldType ( ) : void Test that detecting the correct validation strategy for validateId works as expected
testDisableAction ( ) testDisableAction
testEditActionGet ( ) testEditActionGet
testEditActionPost ( ) testEditActionPost
testEnableAction ( ) testEnableAction
testEnableRelatedListArrayForIndexAction ( ) : void Test if enableRelatedList works with a normal Crud action
testEnableRelatedListStringForIndexAction ( ) : void Test if enableRelatedList works with a normal Crud action
testFetchRelatedDefaults ( ) : void Tests that by default Crud component will fetch related associations on add and edit actions
testFetchRelatedEvents ( ) : void Tests beforeListRelated and afterListRelated events
testFetchRelatedMapped ( ) : void Tests that by default Crud can select some models for each action to fetch related lists
testFetchRelatedMappedAll ( ) : void Tests that by default Crud can select some models for each action to fetch related lists using mapRelatedList with an 'all' default
testFetchRelatedMappedAllNotEnabled ( ) : void Tests that all default for mapped lists will not apply to not enabled actions
testFetchRelatedMappedMethod ( ) : void Tests that by default Crud can select some models for each action to fetch related lists using mapRelatedList
testFetchRelatedSpecificActionMapped ( ) : void Tests that mammpe actions are not used if you define specific related models for the mapped controller action
testGetIdFromRequest ( ) testGetIdFromRequest
testGetIdFromRequestEmpty ( ) testGetIdFromRequestEmpty
testGetSaveAllOptionsCustomAction ( ) : void Test that defining specific action configuration for saveAll takes precedence over default configurations
testGetSaveAllOptionsDefaults ( ) : void Test default saveAll options works when modified
testIfConditionsPersistetInIndexAction ( )
testIndexAction ( ) testIndexAction
testIndexActionPaginationSettingsCanBeOverwritten ( )
testIndexActionPaginationSettingsNotLost ( )
testIsActionMappedNo ( ) testIsActionMappedNo
testIsActionMappedYes ( ) testIsActionMappedYes
testMapAction ( ) testMapAction
testMapActionView ( ) testMapActionView
testMapActionViewWithArrayIndexAction ( ) : void Test if mapActionView with array yields the expected result
testMapActionViewWithArrayNewAction ( ) : void Test if mapActionView with array yields the expected result
testOnAfterPaginateFullNameString ( ) : void Tests on method for afterPaginate with full event name
testOnAfterPaginateString ( ) : void Tests on method for afterPaginate
testOnBeforePaginateString ( ) : void Tests on method for beforePaginateEvent
testOnBeforePaginateWithPaginatConditionsFromBeforePaginateCallback ( )
testOnBeforePaginateWithPaginatLimitFromBeforePaginateCallback ( )
testOnOnWithArrayComplex ( ) : void Test on method for on() with multiple events
testOnOnWithArraySimple ( ) : void Test on method for on() with multiple events
testPaginationWithIterator ( )
testPersistDirectPaginatorSettingsWillNotBeCopied ( )
testRedirect ( ) testRedirect
testRelatedModelsDefaultFalseAdd ( ) : void Test mapRelatedList with default config to 'false' for the add action
testRelatedModelsDefaultFalseEdit ( ) : void Test mapRelatedList with default config to 'false' for the edit action
testRelatedModelsDefaultTrueAdd ( ) : void Test mapRelatedList with default config to 'true' for the add action
testRelatedModelsDefaultTrueEdit ( ) : void Test mapRelatedList with default config to 'true' for the edit action
testRelatedModelsWithAliasMappedLookup ( ) : void Test mapRelatedList with an action mapped using mapAction
testSetModelPropertiesChangeModelForAction ( ) : void Test that having mapped a custom model for an action, the modelName will be as configured
testSetModelPropertiesChangeModelForActionNotLoadedModel ( ) Test that having mapped a custom model for an action, but the custom model isn't loaded, will throw an exception
testSetModelPropertiesDefault ( ) : void Test that having no mapped model for an action, just use the modelClass from the controller
testViewAction ( ) testViewAction
testvalidateIdIntInvalid ( ) testvalidateIdIntInvalid
testvalidateIdIntValid ( ) testvalidateIdIntValid
testvalidateIdUUIDInvalid ( ) testvalidateIdUUIDInvalid
testvalidateIdUUIDValid ( ) testvalidateIdUUIDValid

Method Details

setUp() public method

Setup the classes the crud component needs to be testable
public setUp ( )

tearDown() public method

tearDown method
public tearDown ( )

testAddActionGet() public method

Add should render the form template
public testAddActionGet ( )

testAddActionPost() public method

Create a post, check that the created row looks about right. Check that there are 4 rows after calling (3 fixtures and one new row)
public testAddActionPost ( )

testAddActionTranslated() public method

testAddActionTranslated
public testAddActionTranslated ( ) : void
return void

testAddActionTranslatedBaseline() public method

testAddActionTranslatedBaseline

testAddActionTranslatedChangedMessage() public method

testAddActionTranslatedChangedName

testAddActionTranslatedChangedName() public method

testAddActionTranslatedChangedName

testAddActionTranslatedDefaultDomain() public method

Simulate the controller's components array having defined the default domain for crud messages Verify that that is the default domain is used for the crud translations

testCrudWillComplainAboutUnmappedAction() public method

Test if crud complains about unmapped actions

testCustomFindChanged() public method

Test if custom finds are changed when re-mapped
public testCustomFindChanged ( ) : void
return void

testCustomFindDefaults() public method

Test the default settings match the expected
public testCustomFindDefaults ( ) : void
return void

testCustomFindDeletePublished() public method

Test if custom finders work in delete

testCustomFindDeleteUnpublished() public method

Test if custom finders work in delete - part 2

testCustomFindEditPublished() public method

Test if custom finders work in edit
public testCustomFindEditPublished ( ) : void
return void

testCustomFindEditUnpublished() public method

Test if custom finders work in edit - part two

testCustomFindPaginationCustomPublished() public method

Test if custom pagination works - for published posts

testCustomFindPaginationCustomUnpublished() public method

Test if custom pagination works - for unpublished posts

testCustomFindPaginationDefaultNoAlias() public method

Test that the default pagination settings match, bot for 2.3 and < 2.2

testCustomFindPaginationDefaultWithAlias() public method

Test that the default pagination settings match, bot for 2.3 and < 2.2

testCustomFindPaginationWithControllerFindMethod() public method

Test if custom pagination works when findType is changed from Controller paginate property

testCustomFindViewPublished() public method

Test if custom finders work in view
public testCustomFindViewPublished ( ) : void
return void

testCustomFindViewUnpublished() public method

Test if custom finders work in view - part 2

testDeleteActionDoesNotExists() public method

If you try to delete something that doesn't exist - it should issue a recordNotFound event TODO it should /not/ issue a beforeDelete event but it currently does

testDeleteActionExists() public method

Add a dummy detector to the request object so it says it's a delete request Check the deleted row doesn't exist after calling delete and that the before + after delete events are triggered

testDeleteFailsWithPostAndSecureDeleteActive() public method

Add a dummy detector to the request object so it says it's a delete request Check the deleted row doesn't exist after calling delete and that the before + after delete events are triggered

testDeleteWorksWhenDELETEandSecureDelete() public method

Add a dummy detector to the request object so it says it's a delete request Check the deleted row doesn't exist after calling delete and that the before + after delete events are triggered

testDeleteWorksWithPostAndSecureDeleteActive() public method

Add a dummy detector to the request object so it says it's a delete request Check the deleted row doesn't exist after calling delete and that the before + after delete events are triggered

testDetectPrimaryKeyFieldType() public method

Test that detecting the correct validation strategy for validateId works as expected

testDisableAction() public method

testDisableAction
public testDisableAction ( )

testEditActionGet() public method

Do we get a call to render the form template?
public testEditActionGet ( )

testEditActionPost() public method

Simulating submitting a post form which just changes the title of the model to the name of the method. Check the update is persisted to the db
public testEditActionPost ( )

testEnableAction() public method

testEnableAction
public testEnableAction ( )

testEnableRelatedListArrayForIndexAction() public method

Test if enableRelatedList works with a normal Crud action

testEnableRelatedListStringForIndexAction() public method

Test if enableRelatedList works with a normal Crud action

testFetchRelatedDefaults() public method

Tests that by default Crud component will fetch related associations on add and edit actions
public testFetchRelatedDefaults ( ) : void
return void

testFetchRelatedEvents() public method

Tests beforeListRelated and afterListRelated events
public testFetchRelatedEvents ( ) : void
return void

testFetchRelatedMapped() public method

Tests that by default Crud can select some models for each action to fetch related lists
public testFetchRelatedMapped ( ) : void
return void

testFetchRelatedMappedAll() public method

Tests that by default Crud can select some models for each action to fetch related lists using mapRelatedList with an 'all' default
public testFetchRelatedMappedAll ( ) : void
return void

testFetchRelatedMappedAllNotEnabled() public method

Tests that all default for mapped lists will not apply to not enabled actions

testFetchRelatedMappedMethod() public method

Tests that by default Crud can select some models for each action to fetch related lists using mapRelatedList
public testFetchRelatedMappedMethod ( ) : void
return void

testFetchRelatedSpecificActionMapped() public method

Tests that mammpe actions are not used if you define specific related models for the mapped controller action

testGetIdFromRequest() public method

Check that numeric and uuids are returned

testGetIdFromRequestEmpty() public method

None of these values should be returned

testGetSaveAllOptionsCustomAction() public method

Test that defining specific action configuration for saveAll takes precedence over default configurations

testGetSaveAllOptionsDefaults() public method

Test default saveAll options works when modified

testIfConditionsPersistetInIndexAction() public method

testIndexAction() public method

Make sure that there is a call to render the index template
public testIndexAction ( )

testIndexActionPaginationSettingsCanBeOverwritten() public method

testIndexActionPaginationSettingsNotLost() public method

testIsActionMappedNo() public method

testIsActionMappedNo

testIsActionMappedYes() public method

testIsActionMappedYes

testMapAction() public method

testMapAction
public testMapAction ( )

testMapActionView() public method

testMapActionView
public testMapActionView ( )

testMapActionViewWithArrayIndexAction() public method

Test if mapActionView with array yields the expected result

testMapActionViewWithArrayNewAction() public method

Test if mapActionView with array yields the expected result

testOnAfterPaginateFullNameString() public method

Tests on method for afterPaginate with full event name

testOnAfterPaginateString() public method

Tests on method for afterPaginate
public testOnAfterPaginateString ( ) : void
return void

testOnBeforePaginateString() public method

Tests on method for beforePaginateEvent
public testOnBeforePaginateString ( ) : void
return void

testOnBeforePaginateWithPaginatConditionsFromBeforePaginateCallback() public method

testOnBeforePaginateWithPaginatLimitFromBeforePaginateCallback() public method

testOnOnWithArrayComplex() public method

Test on method for on() with multiple events
public testOnOnWithArrayComplex ( ) : void
return void

testOnOnWithArraySimple() public method

Test on method for on() with multiple events
public testOnOnWithArraySimple ( ) : void
return void

testPaginationWithIterator() public method

testPersistDirectPaginatorSettingsWillNotBeCopied() public method

testRedirect() public method

TODO this test isn't testing anything
public testRedirect ( )

testRelatedModelsDefaultFalseAdd() public method

Test mapRelatedList with default config to 'false' for the add action

testRelatedModelsDefaultFalseEdit() public method

Test mapRelatedList with default config to 'false' for the edit action

testRelatedModelsDefaultTrueAdd() public method

Test mapRelatedList with default config to 'true' for the add action

testRelatedModelsDefaultTrueEdit() public method

Test mapRelatedList with default config to 'true' for the edit action

testRelatedModelsWithAliasMappedLookup() public method

Test mapRelatedList with an action mapped using mapAction

testSetModelPropertiesChangeModelForAction() public method

Test that having mapped a custom model for an action, the modelName will be as configured

testSetModelPropertiesChangeModelForActionNotLoadedModel() public method

Test that having mapped a custom model for an action, but the custom model isn't loaded, will throw an exception

testSetModelPropertiesDefault() public method

Test that having no mapped model for an action, just use the modelClass from the controller

testViewAction() public method

Make sure that there is a call to render the view template
public testViewAction ( )

testvalidateIdIntInvalid() public method

testvalidateIdIntInvalid

testvalidateIdIntValid() public method

testvalidateIdIntValid

testvalidateIdUUIDInvalid() public method

testvalidateIdUUIDInvalid

testvalidateIdUUIDValid() public method

testvalidateIdUUIDValid

Property Details

$fixtures public property

Use the core posts fixture to have something to work on. What fixture is used is almost irrelevant, was chosen as it is simple
public $fixtures