mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-06-25 23:02:55 +00:00
Add support for catching JLog messages on a unit test run
This commit is contained in:
parent
0f7b6cc561
commit
7ae08599dc
|
@ -8,6 +8,7 @@
|
|||
<const name="JTEST_DATABASE_POSTGRESQL_DSN" value="host=localhost;port=5432;dbname=joomla_ut;user=utuser;pass=ut1234" />
|
||||
<const name="JTEST_DATABASE_SQLSRV_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
|
||||
<const name="JTEST_HTTP_STUB" value="http://localhost/joomla-cms/tests/unit/stubs/jhttp_stub.php" />
|
||||
<const name="JOOMLA_TEST_LOGGING" value="yes" />
|
||||
</php>
|
||||
-->
|
||||
|
||||
|
|
|
@ -117,3 +117,6 @@ JLoader::registerPrefix('Test', __DIR__ . '/core');
|
|||
|
||||
// Register the deprecation handler
|
||||
TestHelper::registerDeprecationHandler();
|
||||
|
||||
// Register the logger if enabled
|
||||
TestHelper::registerLogger();
|
||||
|
|
|
@ -163,6 +163,21 @@ class TestHelper
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds optional logging support for the unit test run
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.5
|
||||
*/
|
||||
public static function registerLogger()
|
||||
{
|
||||
if (defined('JOOMLA_TEST_LOGGING') && JOOMLA_TEST_LOGGING === 'yes')
|
||||
{
|
||||
JLog::addLogger(array('logger' => 'formattedtext', 'text_file' => 'unit_test.php', 'text_file_path' => JPATH_ROOT . '/logs'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects if the CLI output supports color codes
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user