PHP Class eZ\Publish\Core\Persistence\Legacy\Tests\TestCase

Inheritance: extends PHPUnit_Framework_TestCas\PHPUnit_Framework_TestCase
Afficher le fichier Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Свойство Type Description
$connection Doctrine\DBAL\Connection Doctrine Database connection -- to not be constructed twice for one test.
$db string Name of the DB, extracted from DSN.
$dsn string DSN used for the DB backend.
$handler eZ\Publish\Core\Persistence\Database\DatabaseHandler Database handler -- to not be constructed twice for one test.
$initial Property which holds the state if this is the initial test run, so that we should set up the database, or if this is any of the following test runs, where it is sufficient to reset the database.

Méthodes publiques

Méthode Description
assertQueryResult ( array $expectation, eZ\Publish\Core\Persistence\Database\SelectQuery $query, string $message = null ) Assert query result as correct.
getDatabaseConnection ( ) : Doctrine\DBAL\Connection Get native Doctrine database connection.
getDatabaseHandler ( ) : ConnectionHandler Get a eZ Doctrine database connection handler.
resetSequences ( ) Reset DB sequences.
setUp ( ) Resets the database on test setup, so we always operate on a clean database.

Méthodes protégées

Méthode Description
assertPropertiesCorrect ( array $properties, object $object ) Asserts correct property values on $object.
assertStructsEqual ( object $expStruct, object $actStruct, array $propertyNames = null ) Asserts $expStruct equals $actStruct in at least $propertyNames.
getDsn ( ) : string Get data source name.
getInstallationDir ( ) : string
getPublicPropertyNames ( object $object ) : array Returns public property names in $object.
getResultTextRepresentation ( array $result ) : string Get a text representation of a result set.
insertDatabaseFixture ( string $file ) Inserts database fixture from $file.
tearDown ( )

Method Details

assertPropertiesCorrect() protected méthode

Asserts that for all keys in $properties a corresponding property exists in $object with the *same* value as in $properties.
protected assertPropertiesCorrect ( array $properties, object $object )
$properties array
$object object

assertQueryResult() public static méthode

Builds text representations of the asserted and fetched query result, based on a eZ\Publish\Core\Persistence\Database\SelectQuery object. Compares them using classic diff for maximum readability of the differences between expectations and real results. The expectation MUST be passed as a two dimensional array containing rows of columns.
public static assertQueryResult ( array $expectation, eZ\Publish\Core\Persistence\Database\SelectQuery $query, string $message = null )
$expectation array
$query eZ\Publish\Core\Persistence\Database\SelectQuery
$message string

assertStructsEqual() protected méthode

Asserts that properties of $actStruct equal properties of $expStruct (not vice versa!). If $propertyNames is null, all properties are checked. Otherwise, $propertyNames provides a white list.
protected assertStructsEqual ( object $expStruct, object $actStruct, array $propertyNames = null )
$expStruct object
$actStruct object
$propertyNames array

getDatabaseConnection() public méthode

Get native Doctrine database connection.
public getDatabaseConnection ( ) : Doctrine\DBAL\Connection
Résultat Doctrine\DBAL\Connection

getDatabaseHandler() public méthode

Get a ConnectionHandler, which can be used to interact with the configured database. The database connection string is read from an optional environment variable "DATABASE" and defaults to an in-memory SQLite database.
public getDatabaseHandler ( ) : ConnectionHandler
Résultat eZ\Publish\Core\Persistence\Doctrine\ConnectionHandler

getDsn() protected méthode

The database connection string is read from an optional environment variable "DATABASE" and defaults to an in-memory SQLite database.
protected getDsn ( ) : string
Résultat string

getInstallationDir() protected static méthode

protected static getInstallationDir ( ) : string
Résultat string

getPublicPropertyNames() protected méthode

Returns public property names in $object.
protected getPublicPropertyNames ( object $object ) : array
$object object
Résultat array

getResultTextRepresentation() protected static méthode

Get a text representation of a result set.
protected static getResultTextRepresentation ( array $result ) : string
$result array
Résultat string

insertDatabaseFixture() protected méthode

Inserts database fixture from $file.
protected insertDatabaseFixture ( string $file )
$file string

resetSequences() public méthode

Reset DB sequences.
public resetSequences ( )

setUp() public méthode

Resets the database on test setup, so we always operate on a clean database.
public setUp ( )

tearDown() protected méthode

protected tearDown ( )

Property Details

$connection protected_oe property

Doctrine Database connection -- to not be constructed twice for one test.
protected Connection,Doctrine\DBAL $connection
Résultat Doctrine\DBAL\Connection

$db protected_oe property

Name of the DB, extracted from DSN.
protected string $db
Résultat string

$dsn protected_oe property

DSN used for the DB backend.
protected string $dsn
Résultat string

$handler protected_oe property

Database handler -- to not be constructed twice for one test.
protected DatabaseHandler,eZ\Publish\Core\Persistence\Database $handler
Résultat eZ\Publish\Core\Persistence\Database\DatabaseHandler

$initial protected_oe static_oe property

Property which holds the state if this is the initial test run, so that we should set up the database, or if this is any of the following test runs, where it is sufficient to reset the database.
protected static $initial