PHPUnit
PHPUnit TYPO3 extension
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Tx_Phpunit_Framework Class Reference

Public Member Functions

 createRecord ($tableName, array $recordData=array())
 
 createFrontEndPage ($parentId=0, array $recordData=array())
 
 createSystemFolder ($parentId=0, array $recordData=array())
 
 createContentElement ($pageId=0, array $recordData=array())
 
 createTemplate ($pageId, array $recordData=array())
 
 createFrontEndUserGroup (array $recordData=array())
 
 createFrontEndUser ($frontEndUserGroups= '', array $recordData=array())
 
 createAndLoginFrontEndUser ($frontEndUserGroups= '', array $recordData=array())
 
 createBackEndUser (array $recordData=array())
 
 createBackEndUserGroup (array $recordData=array())
 
 changeRecord ($tableName, $uid, array $recordData)
 
 deleteRecord ($tableName, $uid)
 
 createRelation ($tableName, $uidLocal, $uidForeign, $sorting=0)
 
 createRelationAndUpdateCounter ($tableName, $uidLocal, $uidForeign, $columnName)
 
 removeRelation ($tableName, $uidLocal, $uidForeign)
 
 createDummyFile ($fileName= 'test.txt', $content= '')
 
 createDummyZipArchive ($fileName= 'test.zip', array $filesToAddToArchive=array())
 
 deleteDummyFile ($fileName)
 
 createDummyFolder ($folderName)
 
 deleteDummyFolder ($folderName)
 
 setUploadFolderPath ($absolutePath)
 
 getUploadFolderPath ()
 
 getPathRelativeToUploadDirectory ($absolutePath)
 
 getUniqueFileOrFolderPath ($path)
 
 discardFakeFrontEnd ()
 
 hasFakeFrontEnd ()
 
 loginFrontEndUser ($userId)
 
 logoutFrontEndUser ()
 
 isLoggedIn ()
 
 getDummyColumnName ($tableName)
 
 countRecords ($tableName, $whereClause= '')
 
 existsRecord ($tableName, $whereClause= '')
 
 existsRecordWithUid ($tableName, $uid)
 
 existsExactlyOneRecord ($tableName, $whereClause= '')
 
 resetAutoIncrement ($tableName)
 
 resetAutoIncrementLazily ($tableName)
 
 setResetAutoIncrementThreshold ($threshold)
 
 getAutoIncrement ($tableName)
 
 getListOfOwnAllowedTableNames ()
 
 getListOfAdditionalAllowedTableNames ()
 
 markTableAsDirty ($tableNames)
 
 getListOfDirtyTables ()
 
 getListOfDirtySystemTables ()
 
 getRelationSorting ($tableName, $uidLocal)
 
 increaseRelationCounter ($tableName, $uid, $fieldName)
 
 checkForZipArchive ()
 
 purgeHooks ()
 

Public Attributes

const AUTO_INCREMENT_THRESHOLD = 100
 

Protected Member Functions

 determineAndSetAutoIncrementThreshold ()
 
 createRecordWithoutTableNameChecks ($tableName, array $recordData)
 
 createGeneralPageRecord ($documentType, $parentId, array $recordData)
 
 cleanUpTableSet ($useSystemTables, $performDeepCleanUp)
 
 deleteAllDummyFoldersAndFiles ()
 
 addToDummyFileList ($uniqueFileName)
 
 createDummyUploadFolder ()
 
 suppressFrontEndCookies ()
 
 createListOfOwnAllowedTables ()
 
 createListOfAdditionalAllowedTables ()
 
 isOwnTableNameAllowed ($tableName)
 
 isAdditionalTableNameAllowed ($tableName)
 
 isSystemTableNameAllowed ($tableName)
 
 isNoneSystemTableNameAllowed ($tableName)
 
 isTableNameAllowed ($tableName)
 
 getMaximumUidFromTable ($tableName)
 
 getHooks ()
 
 getFrontEnd ()
 

Protected Attributes

 $tablePrefix = ''
 
 $additionalTablePrefixes = array()
 
 $ownAllowedTables = array()
 
 $additionalAllowedTables = array()
 
 $allowedSystemTables
 
 $dirtyTables = array()
 
 $dirtySystemTables = array()
 
 $relationSorting = array()
 
 $resetAutoIncrementThreshold = 0
 
 $dummyFiles = array()
 
 $dummyFolders = array()
 
 $uploadFolderPath = ''
 
 $hasFakeFrontEnd = FALSE
 

Static Protected Attributes

static $fileNameProcessor = NULL
 
static $hooks = array()
 
static $hooksHaveBeenRetrieved = FALSE
 

Member Function Documentation

Tx_Phpunit_Framework::addToDummyFileList (   $uniqueFileName)
protected

Adds a file name to $this->dummyFiles.

Parameters
string$uniqueFileNamefile name to add, must be the unique name of a dummy file, must not be empty
Returns
void
Tx_Phpunit_Framework::changeRecord (   $tableName,
  $uid,
array  $recordData 
)

Changes an existing dummy record and stores the new data for this record. Only fields that get new values in $recordData will be changed, everything else will stay untouched.

The array with the new recordData must contain at least one entry, but must not contain a new UID for the record. If you need to change the UID, you have to create a new record!

Parameters
string$tableNamethe name of the table, must not be empty
int$uidthe UID of the record to change, must not be empty
array$recordDataassociative array containing key => value pairs for those fields of the record that need to be changed, must not be empty
Returns
void
Exceptions
Tx_Phpunit_Framework::checkForZipArchive ( )

Checks whether the ZIPArchive class is provided by the PHP installation.

Note: This function can be used to mark tests as skipped if this class is not available but required for a test to pass succesfully.

Exceptions
Exceptionif the PHP installation does not provide ZIPArchive
Returns
void
Tx_Phpunit_Framework::cleanUpTableSet (   $useSystemTables,
  $performDeepCleanUp 
)
protected

Deletes a set of records that have been added through this framework for a set of tables (either the test tables or the allowed system tables). For this, all records with the "is_dummy_record" flag set to 1 will be deleted from all tables that have been used within this instance of the testing framework.

If you set $performDeepCleanUp to TRUE, it will go through ALL tables to which the current instance of the testing framework has access. Please consider well, whether you want to do this as it's a huge performance issue.

Parameters
bool$useSystemTableswhether to clean up the system tables (TRUE) or the non-system test tables (FALSE)
bool$performDeepCleanUpwhether a deep clean up should be performed
Returns
void
Tx_Phpunit_Framework::countRecords (   $tableName,
  $whereClause = '' 
)

Counts the dummy records in the table given by the first parameter $tableName that match a given WHERE clause.

Parameters
string$tableNamethe name of the table to query, must not be empty
string$whereClausethe WHERE part of the query, may be empty (all records will be counted in that case)
Returns
int the number of records that have been found, will be >= 0
Exceptions
Tx_Phpunit_Framework::createAndLoginFrontEndUser (   $frontEndUserGroups = '',
array  $recordData = array() 
)

Creates and logs in an FE user.

Parameters
string$frontEndUserGroupscomma-separated list of UIDs of the user groups to which the new user belongs, each must be > 0, may contain spaces; if empty a new front-end user group is created
array$recordDataassociative array that contains the data to save in the new user record, may be empty, but must not contain the keys "uid" or "usergroup"
Returns
int the UID of the new FE user, will be > 0
Tx_Phpunit_Framework::createBackEndUser ( array  $recordData = array())

Creates a BE user record.

Parameters
array$recordDataassociative array that contains the data to save in the new user record, may be empty, but must not contain the key "uid"
Returns
int the UID of the new BE user, will be > 0
Exceptions
Tx_Phpunit_Framework::createBackEndUserGroup ( array  $recordData = array())

Creates a BE user group.

Parameters
array$recordDataassociative array that contains the data to save in the new user group record, may be empty, but must not contain the key "uid"
Returns
int the UID of the new user group, will be > 0
Exceptions
Tx_Phpunit_Framework::createContentElement (   $pageId = 0,
array  $recordData = array() 
)

Creates a FE content element on the page with the UID given by the first parameter $pageId.

Created content elements are text elements by default, but the content element's type can be overwritten by setting the key 'CType' in the parameter $recordData.

Parameters
int$pageIdUID of the page on which the content element should be created
array$recordDataassociative array that contains the data to save in the content element, may be empty, but must not contain the keys "uid" or "pid"
Returns
int the UID of the new content element, will be > 0
Exceptions
Tx_Phpunit_Framework::createDummyFile (   $fileName = 'test.txt',
  $content = '' 
)

Creates an empty dummy file with a unique file name in the calling extension's upload directory.

Parameters
string$fileNamepath of the dummy file to create, relative to the calling extension's upload directory, must not be empty
string$contentstring content for the file to create, may be empty
Returns
string the absolute path of the created dummy file, will not be empty
Exceptions
Exception
Tx_Phpunit_Framework::createDummyFolder (   $folderName)

Creates a dummy folder with a unique folder name in the calling extension's upload directory.

Parameters
string$folderNamename of the dummy folder to create relative to $this->uploadFolderPath, must not be empty
Returns
string the absolute path of the created dummy folder, will not be empty
Exceptions
Exception
Tx_Phpunit_Framework::createDummyUploadFolder ( )
protected

Creates the upload folder if it does not exist yet.

Returns
void
Exceptions
Tx_Phpunit_Framework::createDummyZipArchive (   $fileName = 'test.zip',
array  $filesToAddToArchive = array() 
)

Creates a dummy ZIP archive with a unique file name in the calling extension's upload directory.

Parameters
string$fileNamepath of the dummy ZIP archive to create, relative to the calling extension's upload directory, must not be empty
string[]$filesToAddToArchive Absolute paths of the files to add to the ZIP archive. Note that the archives directory structure will be relative to the upload folder path, so only files within this folder or in sub-folders of this folder can be added. The provided array may be empty, but as ZIP archives cannot be empty, a content-less dummy text file will be added to the archive then.
Returns
string the absolute path of the created dummy ZIP archive, will not be empty
Exceptions
Exceptionif the PHP installation does not provide ZIPArchive
Tx_Phpunit_Framework::createFrontEndPage (   $parentId = 0,
array  $recordData = array() 
)

Creates a front-end page on the page with the UID given by the first parameter $parentId.

Parameters
int$parentIdUID of the page on which the page should be created
array$recordDataassociative array that contains the data to save in the new page, may be empty, but must not contain the keys "uid", "pid" or "doktype"
Returns
int the UID of the new page, will be > 0
Tx_Phpunit_Framework::createFrontEndUser (   $frontEndUserGroups = '',
array  $recordData = array() 
)

Creates a FE user record.

Parameters
string$frontEndUserGroupscomma-separated list of UIDs of the user groups to which the new user belongs, each must be > 0, may contain spaces, if empty a new FE user group will be created
array$recordDataassociative array that contains the data to save in the new user record, may be empty, but must not contain the keys "uid" or "usergroup"
Returns
int the UID of the new FE user, will be > 0
Exceptions
Tx_Phpunit_Framework::createFrontEndUserGroup ( array  $recordData = array())

Creates a FE user group.

Parameters
array$recordDataassociative array that contains the data to save in the new user group record, may be empty, but must not contain the key "uid"
Returns
int the UID of the new user group, will be > 0
Exceptions
Tx_Phpunit_Framework::createGeneralPageRecord (   $documentType,
  $parentId,
array  $recordData 
)
protected

Creates a page record with the document type given by the first parameter $documentType.

The record will be created on the page with the UID given by the second parameter $parentId.

Parameters
int$documentTypedocument type of the record to create, must be > 0
int$parentIdUID of the page on which the record should be created
array$recordDataassociative array that contains the data to save in the record, may be empty, but must not contain the keys "uid", "pid" or "doktype"
Returns
int the UID of the new record, will be > 0
Exceptions
Tx_Phpunit_Framework::createListOfAdditionalAllowedTables ( )
protected

Generates a list of additional allowed tables to which this instance of the testing framework has access to create/remove test records.

The generated list is based on the list of all tables that TYPO3 can access (which will be all tables in this database), filtered by the prefixes of additional extensions.

The array with the allowed table names is written directly to $this->additionalAllowedTables.

Returns
void
Tx_Phpunit_Framework::createListOfOwnAllowedTables ( )
protected

Generates a list of allowed tables to which this instance of the testing framework has access to create/remove test records.

The generated list is based on the list of all tables that TYPO3 can access (which will be all tables in this database), filtered by prefix of the extension to test.

The array with the allowed table names is written directly to $this->ownAllowedTables.

Returns
void
Tx_Phpunit_Framework::createRecord (   $tableName,
array  $recordData = array() 
)

Creates a new dummy record for unit tests.

If no record data for the new array is given, an empty record will be created. It will only contain a valid UID and the "is_dummy_record" flag will be set to 1.

Should there be any problem creating the record (wrong table name or a problem with the database), 0 instead of a valid UID will be returned.

Parameters
string$tableNamethe name of the table on which the record should be created, must not be empty
array$recordDataassociative array that contains the data to save in the new record, may be empty, but must not contain the key "uid"
Returns
int the UID of the new record, will be > 0
Exceptions
Tx_Phpunit_Framework::createRecordWithoutTableNameChecks (   $tableName,
array  $recordData 
)
protected

Creates a new dummy record for unit tests without checks for the table name.

If no record data for the new array is given, an empty record will be created. It will only contain a valid UID and the "is_dummy_record" flag will be set to 1.

Should there be any problem creating the record (wrong table name or a problem with the database), 0 instead of a valid UID will be returned.

Parameters
string$tableNamethe name of the table on which the record should be created, must not be empty
array$recordDataassociative array that contains the data to save in the new record, may be empty, but must not contain the key "uid"
Returns
int the UID of the new record, will be > 0
Tx_Phpunit_Framework::createRelation (   $tableName,
  $uidLocal,
  $uidForeign,
  $sorting = 0 
)

Creates a relation between two records on different tables (so called m:n relation).

Parameters
string$tableNamename of the m:n table to which the record should be added, must not be empty
int$uidLocalUID of the local table, must be > 0
int$uidForeignUID of the foreign table, must be > 0
int$sortingsorting value of the relation, the default value is 0, which enables automatic sorting, a value >= 0 overwrites the automatic sorting
Returns
void
Exceptions
Tx_Phpunit_Framework::createRelationAndUpdateCounter (   $tableName,
  $uidLocal,
  $uidForeign,
  $columnName 
)

Creates a relation between two records based on the rules defined in TCA regarding the relation.

Parameters
string$tableNamename of the table from which a relation should be created, must not be empty
int$uidLocalUID of the record in the local table, must be > 0
int$uidForeignUID of the record in the foreign table, must be > 0
string$columnNamename of the column in which the relation counter should be updated, must not be empty
Returns
void
Exceptions
Tx_Phpunit_Framework::createSystemFolder (   $parentId = 0,
array  $recordData = array() 
)

Creates a system folder on the page with the UID given by the first parameter $parentId.

Parameters
int$parentIdUID of the page on which the system folder should be created
array$recordDataassociative array that contains the data to save in the new page, may be empty, but must not contain the keys "uid", "pid" or "doktype"
Returns
int the UID of the new system folder, will be > 0
Tx_Phpunit_Framework::createTemplate (   $pageId,
array  $recordData = array() 
)

Creates a template on the page with the UID given by the first parameter $pageId.

Parameters
int$pageIdUID of the page on which the template should be created, must be > 0
array$recordDataassociative array that contains the data to save in the new template, may be empty, but must not contain the keys "uid" or "pid"
Returns
int the UID of the new template, will be > 0
Exceptions
Tx_Phpunit_Framework::deleteAllDummyFoldersAndFiles ( )
protected

Deletes all dummy files and folders.

Returns
void
Tx_Phpunit_Framework::deleteDummyFile (   $fileName)

Deletes the dummy file specified by the first parameter $fileName.

Parameters
string$fileNamethe path to the file to delete relative to $this->uploadFolderPath, must not be empty
Returns
void
Exceptions
Tx_Phpunit_Framework::deleteDummyFolder (   $folderName)

Deletes the dummy folder specified in the first parameter $folderName. The folder must be empty (no files or subfolders).

Parameters
string$folderNamethe path to the folder to delete relative to $this->uploadFolderPath, must not be empty
Returns
void
Exceptions
Tx_Phpunit_Framework::deleteRecord (   $tableName,
  $uid 
)

Deletes a dummy record from the database.

Important: Only dummy records from non-system tables can be deleted with this method. Should there for any reason exist a real record with that UID, it would not be deleted.

Parameters
string$tableNamename of the table from which the record should be deleted, must not be empty
int$uidUID of the record to delete, must be > 0
Returns
void
Exceptions
Tx_Phpunit_Framework::determineAndSetAutoIncrementThreshold ( )
protected

Determines a good value for the auto increment threshold and sets it.

Returns
void
Tx_Phpunit_Framework::discardFakeFrontEnd ( )

Discards the fake front end.

This function nulls out $GLOBALS['TSFE'] and $GLOBALS['TT']. In addition, any logged-in front-end user will be logged out.

The page record for the current front end will not be deleted by this function, though.

If no fake front end has been created, this function does nothing.

Returns
void
Tx_Phpunit_Framework::existsExactlyOneRecord (   $tableName,
  $whereClause = '' 
)

Checks whether there is exactly one dummy record in the table given by the first parameter $tableName that matches a given WHERE clause.

Parameters
string$tableNamethe name of the table to query, must not be empty
string$whereClausethe WHERE part of the query, may be empty (all records will be counted in that case)
Returns
bool TRUE if there is exactly one matching record, FALSE otherwise
Tx_Phpunit_Framework::existsRecord (   $tableName,
  $whereClause = '' 
)

Checks whether there are any dummy records in the table given by the first parameter $tableName that match a given WHERE clause.

Parameters
string$tableNamethe name of the table to query, must not be empty
string$whereClausethe WHERE part of the query, may be empty (all records will be counted in that case)
Returns
bool TRUE if there is at least one matching record, FALSE otherwise
Tx_Phpunit_Framework::existsRecordWithUid (   $tableName,
  $uid 
)

Checks whether there is a dummy record in the table given by the first parameter $tableName that has the given UID.

Parameters
string$tableNamethe name of the table to query, must not be empty
int$uidthe UID of the record to look up, must be > 0
Returns
bool TRUE if there is a matching record, FALSE otherwise
Exceptions
Tx_Phpunit_Framework::getAutoIncrement (   $tableName)

Reads the current auto increment value for a given table.

This function is only valid for tables that actually have an auto increment value.

Parameters
string$tableNamethe name of the table for which the auto increment value should be retrieved, must not be empty
Returns
int the current auto_increment value of table $tableName, will be > 0
Exceptions
Tx_Phpunit_Framework::getDummyColumnName (   $tableName)

Returns the name of the column that marks a record as a dummy record.

On most tables this is "is_dummy_record", but on system tables like "pages" or "fe_users", the column is called "tx_phpunit_dummy_record".

On additional tables, the column is built using $this->tablePrefix as prefix e.g. "tx_seminars_is_dummy_record" if $this->tablePrefix = "tx_seminars".

Parameters
string$tableNamethe table name to look up, must not be empty
Returns
string the name of the column that marks a record as dummy record
Tx_Phpunit_Framework::getFrontEnd ( )
protected

Returns the current front-end instance.

This method must only be called when there is a front-end instance.

Returns
TypoScriptFrontendController
Tx_Phpunit_Framework::getHooks ( )
protected

Gets all hooks for this class.

Returns
Tx_Phpunit_Interface_FrameworkCleanupHook[] the hook objects, will be empty if no hooks have been set
Tx_Phpunit_Framework::getListOfAdditionalAllowedTableNames ( )

Returns the list of additional allowed table names.

Returns
string[] all additional allowed table names for this instance of the testing framework, may be empty
Tx_Phpunit_Framework::getListOfDirtySystemTables ( )

Returns the list of system tables that contain dummy records from testing. These tables are called "dirty tables" as they need to be cleaned up.

Returns
string[] associative array containing names of system database tables that need to be cleaned up
Tx_Phpunit_Framework::getListOfDirtyTables ( )

Returns the list of tables that contain dummy records from testing. These tables are called "dirty tables" as they need to be cleaned up.

Returns
string[] associative array containing names of database tables that need to be cleaned up
Tx_Phpunit_Framework::getListOfOwnAllowedTableNames ( )

Returns the list of allowed table names.

Returns
string[] all allowed table names for this instance of the testing framework
Tx_Phpunit_Framework::getMaximumUidFromTable (   $tableName)
protected

Reads the highest UID for a database table.

This function may only be called after that the provided table name has been checked to be non-empty, valid and pointing to an existing database table that has the "uid" column.

Parameters
string$tableNamethe name of an existing table that has the "uid" column
Returns
int the highest UID from this table, will be >= 0
Tx_Phpunit_Framework::getPathRelativeToUploadDirectory (   $absolutePath)

Returns the path relative to the calling extension's upload directory for a path given in the first parameter $absolutePath.

throws if the first parameter $absolutePath is not within the calling extension's upload directory

Parameters
string$absolutePaththe absolute path to process, must be within the calling extension's upload directory, must not be empty
Returns
string the path relative to the calling extension's upload directory
Exceptions
Tx_Phpunit_Framework::getRelationSorting (   $tableName,
  $uidLocal 
)

Returns the next sorting value of the relation table which should be used.

Note: This function does not take already existing relations in the database (which were created without using the testing framework) into account. So you always should create new dummy records and create a relation between these two dummy records, so you're sure there are not already relations for a local UID in the database.

Parameters
string$tableNamethe relation table, must not be empty
int$uidLocalUID of the local table, must be > 0
Returns
int the next sorting value to use (> 0)
See also
https://bugs.oliverklee.com/show_bug.cgi?id=1423
Tx_Phpunit_Framework::getUniqueFileOrFolderPath (   $path)

Returns a unique absolute path of a file or folder.

Parameters
string$paththe path of a file or folder relative to the calling extension's upload directory, must not be empty
Returns
string the unique absolute path of a file or folder
Exceptions
Tx_Phpunit_Framework::getUploadFolderPath ( )

Returns the absolute path to the upload folder of the extension to test.

Returns
string the absolute path to the upload folder of the extension to test, including the trailing slash
Tx_Phpunit_Framework::hasFakeFrontEnd ( )

Returns whether this testing framework instance has a fake front end.

Returns
bool TRUE if this instance has a fake front end, FALSE otherwise
Tx_Phpunit_Framework::increaseRelationCounter (   $tableName,
  $uid,
  $fieldName 
)

Updates an int field of a database table by one. This is mainly needed for counting up the relation counter when creating a database relation.

The field to update must be of type int.

Parameters
string$tableNamename of the table, must not be empty
int$uidthe UID of the record to modify, must be > 0
string$fieldNamethe field name of the field to modify, must not be empty
Returns
void
Exceptions
Tx_Phpunit_Framework::isAdditionalTableNameAllowed (   $tableName)
protected

Checks whether the given table name is in the list of additional allowed tables for this instance of the testing framework.

Parameters
string$tableNamethe name of the table to check, must not be empty
Returns
bool TRUE if the name of the table is in the list of additional allowed tables, FALSE otherwise
Tx_Phpunit_Framework::isLoggedIn ( )

Checks whether a FE user is logged in.

Exceptions
Exceptionif no front end has been created
Returns
bool TRUE if a FE user is logged in, FALSE otherwise
Tx_Phpunit_Framework::isNoneSystemTableNameAllowed (   $tableName)
protected

Checks whether the given table name is in the list of allowed tables or additional allowed tables for this instance of the testing framework.

Parameters
string$tableNamethe name of the table to check, must not be empty
Returns
bool TRUE if the name of the table is in the list of allowed tables or additional allowed tables, FALSE otherwise
Tx_Phpunit_Framework::isOwnTableNameAllowed (   $tableName)
protected

Checks whether the given table name is in the list of allowed tables for this instance of the testing framework.

Parameters
string$tableNamethe name of the table to check, must not be empty
Returns
bool TRUE if the name of the table is in the list of allowed tables, FALSE otherwise
Tx_Phpunit_Framework::isSystemTableNameAllowed (   $tableName)
protected

Checks whether the given table name is in the list of allowed system tables for this instance of the testing framework.

Parameters
string$tableNamethe name of the table to check, must not be empty
Returns
bool TRUE if the name of the table is in the list of allowed system tables, FALSE otherwise
Tx_Phpunit_Framework::isTableNameAllowed (   $tableName)
protected

Checks whether the given table name is in the list of allowed tables, additional allowed tables or allowed system tables.

Parameters
string$tableNamethe name of the table to check, must not be empty
Returns
bool TRUE if the name of the table is in the list of allowed tables, additional allowed tables or allowed system tables, FALSE otherwise
Tx_Phpunit_Framework::loginFrontEndUser (   $userId)

Fakes that a front-end user has logged in.

If a front-end user currently is logged in, he/she will be logged out first.

Note: To set the logged-in users group data properly, the front-end user and his groups must actually exist in the database.

Parameters
int$userIdUID of the FE user, must not necessarily exist in the database, must be > 0
Returns
void
Exceptions
Exceptionif no front end has been created
Tx_Phpunit_Framework::logoutFrontEndUser ( )

Logs out the current front-end user.

If no front-end user is logged in, this function does nothing.

Exceptions
Exceptionif no front end has been created
Returns
void
Tx_Phpunit_Framework::markTableAsDirty (   $tableNames)

Puts one or multiple table names on the list of dirty tables (which represents a list of tables that were used for testing and contain dummy records and thus are called "dirty" until the next clean up).

Parameters
string$tableNamesthe table name or a comma-separated list of table names to put on the list of dirty tables, must not be empty
Returns
void
Exceptions
Tx_Phpunit_Framework::purgeHooks ( )

Purges the cached hooks.

Returns
void
Tx_Phpunit_Framework::removeRelation (   $tableName,
  $uidLocal,
  $uidForeign 
)

Deletes a dummy relation from an m:n table in the database.

Important: Only dummy records can be deleted with this method. Should there for any reason exist a real record with that combination of local and foreign UID, it would not be deleted!

Parameters
string$tableNamename of the table from which the record should be deleted, must not be empty
int$uidLocalUID on the local table, must be > 0
int$uidForeignUID on the foreign table, must be > 0
Returns
void
Exceptions
Tx_Phpunit_Framework::resetAutoIncrement (   $tableName)

Eagerly resets the auto increment value for a given table to the highest existing UID + 1.

Parameters
string$tableNamethe name of the table on which we're going to reset the auto increment entry, must not be empty
See also
resetAutoIncrementLazily
Returns
void
Exceptions
Tx_Phpunit_Framework::resetAutoIncrementLazily (   $tableName)

Resets the auto increment value for a given table to the highest existing UID + 1 if the current auto increment value is higher than a certain threshold over the current maximum UID.

The threshold is 100 by default and can be set using setResetAutoIncrementThreshold.

Parameters
string$tableNamethe name of the table on which we're going to reset the auto increment entry, must not be empty
See also
resetAutoIncrement
Returns
void
Exceptions
Tx_Phpunit_Framework::setResetAutoIncrementThreshold (   $threshold)

Sets the threshold for resetAutoIncrementLazily.

Parameters
int$thresholdthreshold, must be > 0
See also
resetAutoIncrementLazily
Returns
void
Exceptions
Tx_Phpunit_Framework::setUploadFolderPath (   $absolutePath)

Sets the upload folder path.

Parameters
string$absolutePathabsolute path to the folder where to work on during the tests, can be either an existing folder which will be cleaned up after the tests or a path of a folder to be created as soon as it is needed and deleted during cleanUp, must end with a trailing slash
Returns
void
Exceptions
Exceptionif there are dummy files within the current upload folder as these files could not be deleted if the upload folder path has changed
Tx_Phpunit_Framework::suppressFrontEndCookies ( )
protected

Makes sure that no FE login cookies will be sent.

Returns
void

Member Data Documentation

Tx_Phpunit_Framework::$allowedSystemTables
protected
Initial value:
= array(
'be_users', 'fe_groups', 'fe_users', 'pages', 'sys_template', 'tt_content', 'be_groups', 'sys_file',
'sys_file_collection', 'sys_file_reference', 'sys_category', 'sys_category_record_mm'
)

The documentation for this class was generated from the following file: