Behat


Behat\Behat\Formatter\ConsoleFormatter
Behat/Behat/Formatter/ConsoleFormatter.php at line 29

Class ConsoleFormatter

ConsoleFormatter
All Known Subclasses:
FailedScenariosFormatter JUnitFormatter ProgressFormatter

public abstract class ConsoleFormatter

Console formatter.

Author:
Konstantin Kudryashov

Constructor Summary
void

__construct()

Initialize formatter.

Method Summary
final void

setTranslator(Translator translator)

Set formatter translator.

protected abstract array

getDefaultParameters()

Returns default parameters to construct ParameterBag.

final Boolean

hasParameter(string name)

Checks if current formatter has parameter.

final void

setParameter(string name, mixed value)

Sets formatter parameter.

final mixed

getParameter(string name)

Returns parameter value.

protected final string

getResultColorCode(integer result)

Returns color code from tester result status code.

protected final void

write(string|array messages, Boolean newline)

Writes message(s) to output console.

protected final void

writeln(string|array messages)

Writes newlined message(s) to output console.

protected final StreamOutput

getWritingConsole()

Returns console instance, prepared to write.

protected resource

createOutputStream()

Returns new output stream for console.

protected StreamOutput

createOutputConsole()

Returns new output console.

protected void

configureOutputConsole(StreamOutput console)

Configure output console parameters.

protected final void

flushOutputConsole()

Clear output console, so on next write formatter will need to init (create) it again.

protected final string

translate(string message, array parameters)

Translates message to output language.

protected final string

translateChoice(string message, string number, array parameters)

Translates numbered message to output language.

protected void

exceptionToString($exception \Exception, Exception exception)

Creates a user-presentable string describing the given exception.

Constructor Detail

Behat/Behat/Formatter/ConsoleFormatter.php at line 46

__construct

public void __construct()

Initialize formatter.

Uses:
getDefaultParameters()

Method Detail

Behat/Behat/Formatter/ConsoleFormatter.php at line 77

setTranslator

public final void setTranslator(Translator translator)

Set formatter translator.


Behat/Behat/Formatter/ConsoleFormatter.php at line 87

getDefaultParameters

protected abstract array getDefaultParameters()

Returns default parameters to construct ParameterBag.


Behat/Behat/Formatter/ConsoleFormatter.php at line 96

hasParameter

public final Boolean hasParameter(string name)

Checks if current formatter has parameter.


Behat/Behat/Formatter/ConsoleFormatter.php at line 107

setParameter

public final void setParameter(string name, mixed value)

Sets formatter parameter.


Behat/Behat/Formatter/ConsoleFormatter.php at line 119

getParameter

public final mixed getParameter(string name)

Returns parameter value.


Behat/Behat/Formatter/ConsoleFormatter.php at line 131

getResultColorCode

protected final string getResultColorCode(integer result)

Returns color code from tester result status code.

Parameters:
result - tester result status code
Returns:
passed|pending|skipped|undefined|failed

Behat/Behat/Formatter/ConsoleFormatter.php at line 150

write

protected final void write(string|array messages, Boolean newline)

Writes message(s) to output console.

Parameters:
messages - message or array of messages
newline - do we need to append newline after messages
Uses:
getWritingConsole()

Behat/Behat/Formatter/ConsoleFormatter.php at line 160

writeln

protected final void writeln(string|array messages)

Writes newlined message(s) to output console.

Parameters:
messages - message or array of messages

Behat/Behat/Formatter/ConsoleFormatter.php at line 173

getWritingConsole

protected final StreamOutput getWritingConsole()

Returns console instance, prepared to write.

Uses:
createOutputConsole()
configureOutputConsole()

Behat/Behat/Formatter/ConsoleFormatter.php at line 192

createOutputStream

protected resource createOutputStream()

Returns new output stream for console.

Override this method & call flushOutputConsole() to write output in another stream

Throws:
FormatterException

Behat/Behat/Formatter/ConsoleFormatter.php at line 221

createOutputConsole

protected StreamOutput createOutputConsole()

Returns new output console.

Uses:
createOutputStream()

Behat/Behat/Formatter/ConsoleFormatter.php at line 253

configureOutputConsole

protected void configureOutputConsole(StreamOutput console)

Configure output console parameters.


Behat/Behat/Formatter/ConsoleFormatter.php at line 268

flushOutputConsole

protected final void flushOutputConsole()

Clear output console, so on next write formatter will need to init (create) it again.

See Also:
createOutputConsole()

Behat/Behat/Formatter/ConsoleFormatter.php at line 281

translate

protected final string translate(string message, array parameters)

Translates message to output language.

Parameters:
message - message to translate
parameters - message parameters

Behat/Behat/Formatter/ConsoleFormatter.php at line 297

translateChoice

protected final string translateChoice(string message, string number, array parameters)

Translates numbered message to output language.

Parameters:
message - message specification to translate
number - choice number
parameters - message parameters

Behat/Behat/Formatter/ConsoleFormatter.php at line 309

exceptionToString

protected void exceptionToString($exception \Exception, Exception exception)

Creates a user-presentable string describing the given exception.

Parameters:
\Exception - The exception to describe

Behat