DatabaseManager

Helper class for building a database connection in the test environment

since

2.0.0

package

Joomla Framework

Methods

__construct

DatabaseManager constructor.

__construct() : mixed
since

2.0.0

Response

mixed

clearTables

Clears the database tables of all data

clearTables() : void
since

2.0.0

throws

\Joomla\Test\Exception\DatabaseConnectionNotInitialised

createConnection

Create the DatabaseDriver object

createConnection() : void
since

2.0.0

createDatabase

Creates the database for the test environment

createDatabase() : void
since

2.0.0

throws

\Joomla\Test\Exception\DatabaseConnectionNotInitialised

\Joomla\Database\Exception\ExecutionFailureException

dropDatabase

Destroys the database for the test environment

dropDatabase() : void
since

2.0.0

throws

\Joomla\Test\Exception\DatabaseConnectionNotInitialised

\Joomla\Database\Exception\ExecutionFailureException

getConnection

Fetches the database driver, creating it if not yet set up

getConnection() : \Joomla\Database\DatabaseInterface
since

2.0.0

Response

\Joomla\Database\DatabaseInterface

getDbName

Fetch the name of the database to use

getDbName() : string
since

2.0.0

Response

string

initialiseParams

Initialize the parameter storage for the database connection

initialiseParams() : void
since

2.0.0

throws

\Joomla\Test\Exception\MissingDatabaseCredentials

Properties

connection

The database connection for the test environment

since

2.0.0

Type(s)

\Joomla\Database\DatabaseInterface|null

dbFactory

The database factory

since

2.0.0

Type(s)

\Joomla\Database\DatabaseFactory

params

The database connection parameters from the environment configuration

By default, this is seeded by a set of environment vars that you can set in your operating system environment or phpunit.xml configuration file. You may also customise the parameter configuration behavior for your environment if need be by extending the initialiseParams() method.

since

2.0.0

Type(s)

array