You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the removal of --printer, using PHPUnit with Eclipse has been broken. This isn’t your problem but I’ve been considering a solution. It seems that currently there isn’t a way to provide PHPUnit with an external printer/logger/event handler. Can you confirm that is the case, or am I missing something?
From what I have been able to glean from the code so far it seems like, if one could create a class with a constructor that takes a Printer and a Façade, this would be the start of returning the --printer functionality. Then Application::registerLogfileWriters() could check if a configuration exists (e.g. --eventListener), confirm that it refers to a class that implements an interface that defines that constructor, and if so then create an instance of the class. Having a constructor in an interface isn’t ideal but it seems it would be necessary in this case as otherwise you’d have no idea how to construct an instance.
Does this make any sense, or am I heading off in the wrong direction?
interface EventLoggerIntf
{
public static function createInstance(Printer $printer, Facade $facade);
}
The text was updated successfully, but these errors were encountered:
Added support for both XML and CLI definition of an external logger.
This --log-external option adds simialar functionality that existed with
the --printer option in 9.x and earlier.
Implementations of an external logger do need to implement the
\PHPUnit\Logger\ExternalLogger interface and must use the PHPUnit 10.x
and later event mechanism for capturing logging events.
You could write an extension that parses the command line ($_SERVER) and register the printer so parsed with PHPUnit\Runner\Extension\Facade. Your bigger problem is that any older printer would need to be rewritten to support the new extension architecture.
With the removal of --printer, using PHPUnit with Eclipse has been broken. This isn’t your problem but I’ve been considering a solution. It seems that currently there isn’t a way to provide PHPUnit with an external printer/logger/event handler. Can you confirm that is the case, or am I missing something?
From what I have been able to glean from the code so far it seems like, if one could create a class with a constructor that takes a Printer and a Façade, this would be the start of returning the --printer functionality. Then Application::registerLogfileWriters() could check if a configuration exists (e.g. --eventListener), confirm that it refers to a class that implements an interface that defines that constructor, and if so then create an instance of the class. Having a constructor in an interface isn’t ideal but it seems it would be necessary in this case as otherwise you’d have no idea how to construct an instance.
Does this make any sense, or am I heading off in the wrong direction?
interface EventLoggerIntf
{
public static function createInstance(Printer $printer, Facade $facade);
}
The text was updated successfully, but these errors were encountered: