class QueryBuilderTester (View source)

Utility class to help making test assertions on the query builders nodes easier.

Properties

protected $qb

Methods

__construct(QueryBuilder $qb)

No description

getNode(string $path)

Return the query builder node found at the given path.

string
dumpPaths(AbstractNode $node = null)

Dump the path of each node in the query builder tree.

string
getPath(AbstractNode $node)

Get path of given node.

getAllNodes(AbstractNode $node = null)

Return all the nodes in the query builder.

Details

__construct(QueryBuilder $qb)

Parameters

QueryBuilder $qb

AbstractNode getNode(string $path)

Return the query builder node found at the given path.

Paths are made from a series of $nodeType[$index], e.g.

$qb->where()->andX()->eq()->field('f.foo')->literal('Foo');

The following path will retrieve the "literal" node:

where.constraint.constraint[1].operand_static

Parameters

string $path

Return Value

AbstractNode

Exceptions

BadMethodCallException

string dumpPaths(AbstractNode $node = null)

Dump the path of each node in the query builder tree.

Note that paths here do not include indexes. They need to be inferred mentally.

Parameters

AbstractNode $node

Return Value

string

string getPath(AbstractNode $node)

Get path of given node.

Parameters

AbstractNode $node

Return Value

string

AbstractNode[] getAllNodes(AbstractNode $node = null)

Return all the nodes in the query builder.

Parameters

AbstractNode $node

Return Value

AbstractNode[]