\JLogTest
Test class for JLog.
Synopsis
class JLogTest
extends PHPUnit_Framework_TestCase
{
- // methods
- protected void tearDown()
- public void testAddLogEntry()
- public void testAddLoggerAutoInstantiation()
- public void testAddLoggerAutoInstantiationInvalidLogger()
- public void testFindLoggersByCategory()
- public void testFindLoggersByNotCategory()
- public void testFindLoggersByPriority()
- public void testFindLoggersByPriorityAndCategory()
- public void testSetInstance()
Hierarchy
Extends
Tasks
Tasks
Line | Task |
---|---|
140 | remove: var_dump($log->lookup); |
337 | remove: var_dump($log->lookup); |
421 | remove: var_dump($log->lookup); |
Methods
protected
- tearDown() — Overrides the parent tearDown method.
public
- testAddLogEntry() — Test the JLog::addLogEntry method to verify that if called directly it will route the entry to the appropriate loggers. We use the echo logger here for easy testing using the PHP output buffer.
- testAddLoggerAutoInstantiation() — Test that if JLog::addLogger is called and no JLog instance has been instantiated yet, that one will be instantiated automatically and the logger will work accordingly. We use the echo logger here for easy testing using the PHP output buffer.
- testAddLoggerAutoInstantiationInvalidLogger() — Test that if JLog::addLogger is called and no JLog instance has been instantiated yet, that one will be instantiated automatically and the logger will work accordingly. We use the echo logger here for easy testing using the PHP output buffer.
- testFindLoggersByCategory() — Test the JLog::findLoggers method to make sure given a category we are finding the correct loggers that have been added to JLog. It is important to note that if a logger was added with no category, then it will be returned for all categories.
- testFindLoggersByNotCategory() — Test the JLog::findLoggers method to make sure given a category we are finding the correct loggers that have been added to JLog (using exclusion). It is important to note that empty category can also be excluded.
- testFindLoggersByPriority() — Test the JLog::findLoggers method to make sure given a priority we are finding the correct loggers that have been added to JLog. It is important to test not only straight values but also bitwise combinations and the catch all JLog::ALL as registered loggers.
- testFindLoggersByPriorityAndCategory() — Test the JLog::findLoggers method to make sure given a priority and category we are finding the correct loggers that have been added to JLog.
- testSetInstance() — Test the JLog::setInstance method to make sure that if we set a logger instance JLog is actually going to use it. We accomplish this by setting an instance of JLogInspector and then performing some operations using JLog::addLogger() to alter the state of the internal instance. We then check that the JLogInspector instance we created (and set) has the same values we would expect for lookup and configuration so we can assert that the operations we performed using JLog::addLogger() were actually performed on our instance of JLogInspector that was set.