Merged in bugfix/PMCORE-2297 (pull request #7508)
PMCORE-2297 The server response a 500 error by trying to login with SAML plugin Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
59a3b65cc8
@@ -2731,4 +2731,67 @@ class Bootstrap
|
|||||||
}
|
}
|
||||||
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_DATA_SITE);
|
set_include_path(get_include_path() . PATH_SEPARATOR . PATH_DATA_SITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.5.3
|
||||||
|
*/
|
||||||
|
public static function registerMonolog(
|
||||||
|
$channel,
|
||||||
|
$level,
|
||||||
|
$message,
|
||||||
|
$context,
|
||||||
|
$workspace = '',
|
||||||
|
$file = 'processmaker.log',
|
||||||
|
$readLoggingLevel = true
|
||||||
|
)
|
||||||
|
{
|
||||||
|
$level = intval($level);
|
||||||
|
$context = is_array($context) ? $context : [];
|
||||||
|
switch ($level) {
|
||||||
|
case 100:
|
||||||
|
Log::channel(':' . $channel)->debug($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
default://200
|
||||||
|
Log::channel(':' . $channel)->info($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
case 250:
|
||||||
|
Log::channel(':' . $channel)->notice($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
case 300:
|
||||||
|
Log::channel(':' . $channel)->warning($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
case 400:
|
||||||
|
Log::channel(':' . $channel)->error($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
case 500:
|
||||||
|
Log::channel(':' . $channel)->critical($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
case 550:
|
||||||
|
Log::channel(':' . $channel)->alert($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
case 600:
|
||||||
|
Log::channel(':' . $channel)->emergency($message, Bootstrap::context($context));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.5.3
|
||||||
|
*/
|
||||||
|
public static function getDefaultContextLog()
|
||||||
|
{
|
||||||
|
return self::context();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.5.3
|
||||||
|
*/
|
||||||
|
public static function registerMonologPhpUploadExecution($channel, $level, $message, $fileName)
|
||||||
|
{
|
||||||
|
$context = [
|
||||||
|
'filename' => $fileName,
|
||||||
|
'url' => $_SERVER["REQUEST_URI"] ?? ''
|
||||||
|
];
|
||||||
|
self::registerMonolog($channel, $level, $message, $context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ namespace Tests\unit\gulliver\system;
|
|||||||
|
|
||||||
use Bootstrap;
|
use Bootstrap;
|
||||||
use Faker\Factory;
|
use Faker\Factory;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
use ProcessMaker\Core\System;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class BootstrapTest extends TestCase
|
class BootstrapTest extends TestCase
|
||||||
@@ -62,4 +64,78 @@ class BootstrapTest extends TestCase
|
|||||||
//add more assertions
|
//add more assertions
|
||||||
$this->assertRegexp("/{$filename}/", $result);
|
$this->assertRegexp("/{$filename}/", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return logging level code.
|
||||||
|
*/
|
||||||
|
public function levelCode()
|
||||||
|
{
|
||||||
|
//the level record depends on env.ini, by default the records are shown
|
||||||
|
//starting from info (200) and the debug level (100) is excluded.
|
||||||
|
return[
|
||||||
|
[200],
|
||||||
|
[250],
|
||||||
|
[300],
|
||||||
|
[400],
|
||||||
|
[500],
|
||||||
|
[550],
|
||||||
|
[600]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the registerMonolog method.
|
||||||
|
* @test
|
||||||
|
* @covers Bootstrap::registerMonolog()
|
||||||
|
* @dataProvider levelCode
|
||||||
|
*/
|
||||||
|
public function it_should_test_registerMonolog_method($level)
|
||||||
|
{
|
||||||
|
$channel = 'test';
|
||||||
|
$message = 'test';
|
||||||
|
$context = [];
|
||||||
|
Bootstrap::registerMonolog($channel, $level, $message, $context);
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
$files = File::allFiles(PATH_DATA_SITE . '/log');
|
||||||
|
foreach ($files as $value) {
|
||||||
|
$result = $result . File::get($value->getPathname());
|
||||||
|
}
|
||||||
|
$this->assertRegExp("/{$channel}/", $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the getDefaultContextLog method.
|
||||||
|
* @test
|
||||||
|
* @covers Bootstrap::getDefaultContextLog()
|
||||||
|
*/
|
||||||
|
public function it_should_test_getDefaultContextLog_method()
|
||||||
|
{
|
||||||
|
$result = Bootstrap::getDefaultContextLog();
|
||||||
|
$this->assertArrayHasKey('ip', $result);
|
||||||
|
$this->assertArrayHasKey('workspace', $result);
|
||||||
|
$this->assertArrayHasKey('timeZone', $result);
|
||||||
|
$this->assertArrayHasKey('usrUid', $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test the registerMonologPhpUploadExecution method.
|
||||||
|
* @test
|
||||||
|
* @covers Bootstrap::registerMonologPhpUploadExecution()
|
||||||
|
* @dataProvider levelCode
|
||||||
|
*/
|
||||||
|
public function it_should_test_registerMonologPhpUploadExecution_method($level)
|
||||||
|
{
|
||||||
|
$channel = 'test';
|
||||||
|
$message = 'test';
|
||||||
|
$fileName = 'test';
|
||||||
|
Bootstrap::registerMonologPhpUploadExecution($channel, $level, $message, $fileName);
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
$files = File::allFiles(PATH_DATA_SITE . '/log');
|
||||||
|
foreach ($files as $value) {
|
||||||
|
$result = $result . File::get($value->getPathname());
|
||||||
|
}
|
||||||
|
$this->assertRegExp("/{$channel}/", $result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user