PHPUnit
PHPUnit TYPO3 extension
 All Classes Namespaces Functions
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Tx_Phpunit_Database_TestCase Class Reference
Inheritance diagram for Tx_Phpunit_Database_TestCase:
Tx_Phpunit_TestCase

Public Member Functions

 __construct ($name=NULL, array $data=array(), $dataName= '')
 

Protected Member Functions

 switchToTypo3Database ()
 
 selectDatabase ($databaseName, t3lib_DB $database)
 
 importExtensions (array $extensions, $importDependencies=FALSE, array &$skipDependencies=array())
 
 getDatabaseTables ($databaseName=NULL)
 
 importStdDb ()
 
- Protected Member Functions inherited from Tx_Phpunit_TestCase
 getAccessibleMock ($originalClassName, array $methods=array(), array $arguments=array(), $mockClassName= '', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)
 
 buildAccessibleProxy ($className)
 

Protected Attributes

 $testDatabase = ''
 
- Protected Attributes inherited from Tx_Phpunit_TestCase
 $backupGlobals = FALSE
 
 $backupStaticAttributes = FALSE
 

Constructor & Destructor Documentation

Tx_Phpunit_Database_TestCase::__construct (   $name = NULL,
array  $data = array(),
  $dataName = '' 
)

Constructs a test case with the given name.

Parameters
string$namethe name of a testcase
array$data?
string$dataName?

Member Function Documentation

Tx_Phpunit_Database_TestCase::getDatabaseTables (   $databaseName = NULL)
protected

Gets the names of all tables in the database with the given name.

Parameters
string$databaseNamethe name of the database from which to retrieve the table names, if none is provided, the name of the current TYPO3 database plus a suffix "_test" is used
Returns
array<string> the names of all tables in the database $databaseName, might be empty
Tx_Phpunit_Database_TestCase::importExtensions ( array  $extensions,
  $importDependencies = FALSE,
array &  $skipDependencies = array() 
)
protected

Imports the ext_tables.sql statements from the given extensions.

Parameters
array$extensionskeys of the extensions to import, may be empty
boolean$importDependencieswhether to import dependency extensions on which the given extensions depend as well
array&$skipDependencieskeys of the extensions to skip, may be empty, will be modified
Returns
void
Tx_Phpunit_Database_TestCase::importStdDb ( )
protected

Imports the data from the stddb tables.sql file.

Example/intended usage:

public function setUp() {
  $this->createDatabase();
  $db = $this->useTestDatabase();
  $this->importStdDB();
  $this->importExtensions(array('cms', 'static_info_tables', 'templavoila'));
}
Returns
void
Tx_Phpunit_Database_TestCase::selectDatabase (   $databaseName,
t3lib_DB  $database 
)
protected

Selects the database depending on TYPO3 version.

Parameters
string$databaseNamethe name of the database to select
t3lib_DB$databasedatabase object to process the change
Returns
boolean
Tx_Phpunit_Database_TestCase::switchToTypo3Database ( )
protected

Selects the TYPO3 database (again).

If you have selected any non-TYPO3 in your unit tests, you need to call this function in tearDown() in order to avoid problems with the following unit tests and the TYPO3 back-end.

Returns
void

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