Documentation

setup_test_db.php

Set up test database for integration tests.

This script creates a test database, applies the baseline schema, and runs all migrations. Run this before running integration tests.

Usage: php tests/setup_test_db.php # Setup test database php tests/setup_test_db.php --drop # Drop and recreate test database php tests/setup_test_db.php --status # Show test database status

PHP version 8.1

Tags
category

Testing

author

LWT Project lwt-project@hotmail.com

license

Unlicense http://unlicense.org/

since
3.0.0

Table of Contents

Functions

output()  : void
Output a message unless quiet mode is enabled.
getTableCount()  : int
Get the count of tables in the test database.
getMigrationCount()  : int
Get the count of applied migrations.
databaseExists()  : bool
Check if database exists.
hasForeignKeys()  : bool
Check if foreign keys are present.

Functions

output()

Output a message unless quiet mode is enabled.

output(string $message, bool $quiet) : void
Parameters
$message : string
$quiet : bool

getTableCount()

Get the count of tables in the test database.

getTableCount(mysqli $conn, string $dbName) : int
Parameters
$conn : mysqli
$dbName : string
Return values
int

getMigrationCount()

Get the count of applied migrations.

getMigrationCount(mysqli $conn, string $dbName) : int
Parameters
$conn : mysqli
$dbName : string
Return values
int

databaseExists()

Check if database exists.

databaseExists(mysqli $conn, string $dbName) : bool
Parameters
$conn : mysqli
$dbName : string
Return values
bool

hasForeignKeys()

Check if foreign keys are present.

hasForeignKeys(mysqli $conn, string $dbName) : bool
Parameters
$conn : mysqli
$dbName : string
Return values
bool

        
On this page

Search results