fusionspim / monolog-logdna

A Monolog handler and formatter for LogDNA
MIT License
7 stars 2 forks source link

Test failures with monolog/monolog:2.40 #104

Closed maxakropolis closed 1 year ago

maxakropolis commented 2 years ago

Steps to reproduce

composer update monolog/monolog  -W
phpunit

Results

PHPUnit 9.5.20 

.EEEFF                                                              6 / 6 (100%)

Time: 00:00.206, Memory: 6.00 MB

There were 3 errors:

1) Fusions\Test\Monolog\LogDna\Formatter\SmartJsonFormatterTest::test_format
Undefined array key "trace"

/app/tests/Formatter/SmartJsonFormatterTest.php:41

2) Fusions\Test\Monolog\LogDna\Formatter\SmartJsonFormatterTest::test_format_filter_ignore_paths
Undefined array key "trace"

/app/tests/Formatter/SmartJsonFormatterTest.php:95

3) Fusions\Test\Monolog\LogDna\Formatter\SmartJsonFormatterTest::test_format_map_redact_arguments
Undefined array key "trace"

/app/tests/Formatter/SmartJsonFormatterTest.php:188

--

There were 2 failures:

1) Fusions\Test\Monolog\LogDna\Handler\LogDnaHandlerTest::test_write
Failed asserting that '{"lines":[{"timestamp":"--IGNORED--","line":"This is a test message","app":"test","level":"INFO","meta":{"exception":{"class":"Fusions\\Test\\Monolog\\LogDna\\StackTraceTestException","message":"","code":0,"file":"--IGNORED--"}}}]}' matches JSON string "{
  "lines": [
    {
      "timestamp": "--IGNORED--",
      "line": "This is a test message",
      "app": "test",
      "level": "INFO",
      "meta": {
        "exception": {
          "class": "Fusions\\Test\\Monolog\\LogDna\\StackTraceTestException",
          "message": "",
          "code": 0,
          "file": "--IGNORED--",
          "trace": [
            {
              "class": "MyClass",
              "function": "baz",
              "args": [
                "bool(true)",
                "bool(false)",
                "int(42)",
                "float(42.42)",
                "string(FOO)",
                "array(2)",
                "stdClass"
              ],
              "type": "method",
              "file": "--IGNORED--",
              "line": 256
            },
            {
              "class": "MyNestedClass",
              "function": "bar",
              "args": [
                "string(FOO)",
                "string(BAR)"
              ],
              "type": "static",
              "file": "--IGNORED--",
              "line": 512
            },
            {
              "class": "MyVendorClass",
              "function": "foo",
              "args": [],
              "type": "method",
              "file": "--IGNORED--",
              "line": 123
            },
            {
              "class": "",
              "function": "require",
              "args": [],
              "type": "function",
              "file": "--IGNORED--",
              "line": 42
            }
          ]
        }
      }
    }
  ]
}
".
--- Expected
+++ Actual
@@ @@
                     "class": "Fusions\\Test\\Monolog\\LogDna\\StackTraceTestException",
                     "code": 0,
                     "file": "--IGNORED--",
-                    "message": "",
-                    "trace": [
-                        {
-                            "args": [
-                                "bool(true)",
-                                "bool(false)",
-                                "int(42)",
-                                "float(42.42)",
-                                "string(FOO)",
-                                "array(2)",
-                                "stdClass"
-                            ],
-                            "class": "MyClass",
-                            "file": "--IGNORED--",
-                            "function": "baz",
-                            "line": 256,
-                            "type": "method"
-                        },
-                        {
-                            "args": [
-                                "string(FOO)",
-                                "string(BAR)"
-                            ],
-                            "class": "MyNestedClass",
-                            "file": "--IGNORED--",
-                            "function": "bar",
-                            "line": 512,
-                            "type": "static"
-                        },
-                        {
-                            "args": [],
-                            "class": "MyVendorClass",
-                            "file": "--IGNORED--",
-                            "function": "foo",
-                            "line": 123,
-                            "type": "method"
-                        },
-                        {
-                            "args": [],
-                            "class": "",
-                            "file": "--IGNORED--",
-                            "function": "require",
-                            "line": 42,
-                            "type": "function"
-                        }
-                    ]
+                    "message": ""
                 }
             },
             "timestamp": "--IGNORED--"

/app/tests/Handler/LogDnaHandlerTest.php:133
/app/tests/Handler/LogDnaHandlerTest.php:62

2) Fusions\Test\Monolog\LogDna\Handler\LogDnaHandlerTest::test_shorten_long_exceptions
Failed asserting that '{"lines":[{"timestamp":"--IGNORED--","line":"This is a test message","app":"test","level":"INFO","meta":{"exception":{"class":"Fusions\\Test\\Monolog\\LogDna\\StackTraceTestException","message":"This is a test exception","code":42,"file":"--IGNORED--"}}}]}' matches JSON string "{
  "lines": [
    {
      "timestamp": "--IGNORED--",
      "line": "This is a test message",
      "app": "test",
      "level": "INFO",
      "meta": {
        "truncated": "--IGNORED--"
      }
    }
  ]
}
".
--- Expected
+++ Actual
@@ @@
             "level": "INFO",
             "line": "This is a test message",
             "meta": {
-                "truncated": "--IGNORED--"
+                "exception": {
+                    "class": "Fusions\\Test\\Monolog\\LogDna\\StackTraceTestException",
+                    "code": 42,
+                    "file": "--IGNORED--",
+                    "message": "This is a test exception"
+                }
             },
             "timestamp": "--IGNORED--"
         }
     ]
 }

/app/tests/Handler/LogDnaHandlerTest.php:133
/app/tests/Handler/LogDnaHandlerTest.php:122
weshooper commented 1 year ago

Closing as we dropped SmartJsonFormatterTest and are on monolog 2.8.