PHP Class Craft\ImportServiceTest

Author: Bob Olde Hampsink ([email protected])
Inheritance: extends craft\BaseTest
Datei anzeigen Open project: boboldehampsink/import

Public Methods

Method Description
provideValidFieldTypeData ( ) : array
setUp ( ) Setup mock localization service.
setUpBeforeClass ( )
testColumnsShouldReturnColumnRow ( )
testDataShouldReturnDataRows ( )
testFinishShouldMailResults ( )
testGetCustomOptionShouldReturnFalseWhenNoCustomOptionFound ( )
testGetCustomOptionShouldReturnOptionWhenFound ( )
testPrepForFieldType ( string $fieldType, string $data, array $settingsMap, string $criteria, string $expectedResult ) Test preparing value for field type.
testRowShouldCallCallbackWhenSaveSucceeds ( )
testRowShouldCatchExceptions ( )
testRowShouldLogErrorWhenColumnsAndDataDoNotMatch ( )
testRowShouldLogErrorWhenSaveFails ( )
testRowShouldThrowExceptionWhenTypeUnknown ( )
testRowUniqueReplaceOrDeleteShouldDeleteExistingElement ( )
testRowUniqueReplaceOrDeleteShouldDoNothingWhenNoResultFound ( )
testRowUniqueReplaceOrDeleteShouldFindExistingElement ( )
testRowUniqueReplaceOrDeleteShouldLogErrorWhenDeleteFails ( )
testRowUniqueReplaceOrDeleteShouldLogErrorWhenFieldValueEmpty ( )
testRowUniqueReplaceOrDeleteShouldThrowExceptionWhenPermissionDenied ( )
testSlugifyShouldSlugifyString ( )

Protected Methods

Method Description
getMockAssetFileModel ( string $file ) : craft\AssetFileModel Get mock asset file model.
getMockAssetSourceModel ( string $file ) : craft\AssetSourceModel Get mock asset source model.
getMockTag ( ) : PHPUnit_Framework_MockObject_MockObject
setMockAssetsService ( string $file ) Set mock assets service.
setMockCategoriesService ( ) Set mock categories service getGroupLocales.
setMockElementsServiceForFieldType ( array $criteria )
setMockTagsService ( PHPUnit_Framework_MockObject_MockObject $mockTag )

Private Methods

Method Description
getMockCriteria ( ) : PHPUnit_Framework_MockObject_MockObject | craft\ElementCriteriaModel
getMockEntry ( ) : PHPUnit_Framework_MockObject_MockObject | craft\ElementCriteriaModel
getMockLocalAssetSourceType ( string $file ) : craft\AssetSourceModel Mock LocalAssetSourceType.
getMockUser ( ) : PHPUnit_Framework_MockObject_MockObject
setMockFieldsService ( string $fieldHandle, PHPUnit_Framework_MockObject_MockObject $mockField )
setMockImportEntryService ( array $settings, PHPUnit_Framework_MockObject_MockObject $mockEntry, array $fields, boolean $saveSuccess = null ) : PHPUnit_Framework_MockObject_MockObject | craft\Import_EntryService
setMockImportHistoryService ( integer $historyId, integer $row, string $message )
setMockLocalizationService ( ) Mock LocalizationService.
setMockSettings ( array $settingsMap, PHPUnit_Framework_MockObject_MockObject $mockField )
setMockUserSession ( PHPUnit_Framework_MockObject_MockObject $mockUser )
setMockUsersService ( PHPUnit_Framework_MockObject_MockObject $mockUser )

Method Details

getMockAssetFileModel() protected method

Get mock asset file model.
protected getMockAssetFileModel ( string $file ) : craft\AssetFileModel
$file string
return craft\AssetFileModel

getMockAssetSourceModel() protected method

Get mock asset source model.
protected getMockAssetSourceModel ( string $file ) : craft\AssetSourceModel
$file string
return craft\AssetSourceModel

getMockTag() protected method

protected getMockTag ( ) : PHPUnit_Framework_MockObject_MockObject
return PHPUnit_Framework_MockObject_MockObject

provideValidFieldTypeData() public method

public provideValidFieldTypeData ( ) : array
return array

setMockAssetsService() protected method

Set mock assets service.
protected setMockAssetsService ( string $file )
$file string

setMockCategoriesService() protected method

Set mock categories service getGroupLocales.
protected setMockCategoriesService ( )

setMockElementsServiceForFieldType() protected method

protected setMockElementsServiceForFieldType ( array $criteria )
$criteria array

setMockTagsService() protected method

protected setMockTagsService ( PHPUnit_Framework_MockObject_MockObject $mockTag )
$mockTag PHPUnit_Framework_MockObject_MockObject

setUp() public method

Setup mock localization service.
public setUp ( )

setUpBeforeClass() public static method

public static setUpBeforeClass ( )

testColumnsShouldReturnColumnRow() public method

testDataShouldReturnDataRows() public method

testFinishShouldMailResults() public method

testGetCustomOptionShouldReturnFalseWhenNoCustomOptionFound() public method

testGetCustomOptionShouldReturnOptionWhenFound() public method

testPrepForFieldType() public method

Test preparing value for field type.
public testPrepForFieldType ( string $fieldType, string $data, array $settingsMap, string $criteria, string $expectedResult )
$fieldType string
$data string
$settingsMap array
$criteria string
$expectedResult string

testRowShouldCallCallbackWhenSaveSucceeds() public method

testRowShouldCatchExceptions() public method

testRowShouldLogErrorWhenColumnsAndDataDoNotMatch() public method

testRowShouldLogErrorWhenSaveFails() public method

testRowShouldThrowExceptionWhenTypeUnknown() public method

testRowUniqueReplaceOrDeleteShouldDeleteExistingElement() public method

testRowUniqueReplaceOrDeleteShouldDoNothingWhenNoResultFound() public method

testRowUniqueReplaceOrDeleteShouldFindExistingElement() public method

testRowUniqueReplaceOrDeleteShouldLogErrorWhenDeleteFails() public method

testRowUniqueReplaceOrDeleteShouldLogErrorWhenFieldValueEmpty() public method

testRowUniqueReplaceOrDeleteShouldThrowExceptionWhenPermissionDenied() public method

testSlugifyShouldSlugifyString() public method