Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Logger
Test
Unit
MonologTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Logger\Test\Unit
;
7
8
use
Magento\Framework\Logger\Monolog
;
9
use Monolog\Handler\TestHandler;
10
11
class
MonologTest
extends
\PHPUnit\Framework\TestCase
12
{
13
public
function
testAddRecord
()
14
{
15
$logger
=
new
Monolog
(__METHOD__);
16
$handler
=
new
TestHandler();
17
18
$logger
->pushHandler(
$handler
);
19
20
$logger
->addError(
'test'
);
21
list($record) =
$handler
->getRecords();
22
23
$this->assertSame(
'test'
, $record[
'message'
]);
24
}
25
26
public
function
testAddRecordAsException
()
27
{
28
$logger
=
new
Monolog
(__METHOD__);
29
$handler
=
new
TestHandler();
30
31
$logger
->pushHandler(
$handler
);
32
33
$logger
->addError(
new
\Exception(
'Some exception'
));
34
list($record) =
$handler
->getRecords();
35
36
$this->assertInstanceOf(\Exception::class, $record[
'context'
][
'exception'
]);
37
$this->assertSame(
'Some exception'
, $record[
'message'
]);
38
}
39
}
Magento\Framework\Logger\Monolog
Definition:
Monolog.php:11
Magento\Framework\Logger\Test\Unit\MonologTest
Definition:
MonologTest.php:11
Magento\Framework\Logger\Test\Unit\MonologTest\testAddRecordAsException
testAddRecordAsException()
Definition:
MonologTest.php:26
Magento\Framework\Logger\Test\Unit
$logger
$logger
Definition:
health_check.php:20
Magento\Framework\Logger\Test\Unit\MonologTest\testAddRecord
testAddRecord()
Definition:
MonologTest.php:13
$handler
catch(\Exception $e) $handler
Definition:
index.php:30