diff --git a/tests/Debug/Collector/SimpleCacheTest.php b/tests/Debug/Collector/SimpleCacheTest.php
index b602551a..9d8cacc8 100644
--- a/tests/Debug/Collector/SimpleCacheTest.php
+++ b/tests/Debug/Collector/SimpleCacheTest.php
@@ -208,9 +208,9 @@ public function testGetLoggedActions()
$this->assertSame(array(
'duration',
'exception',
+ 'keyOrKeys',
'memoryUsage',
'method',
- 'keyOrKeys',
), \array_keys(\reset($loggedActions)->__debugInfo()));
}
diff --git a/tests/Debug/DebugTest.php b/tests/Debug/DebugTest.php
index ec0c778b..0d778e1d 100644
--- a/tests/Debug/DebugTest.php
+++ b/tests/Debug/DebugTest.php
@@ -115,6 +115,7 @@ public function testPublishBubbleEvent()
\t- foo=><b>bar&baz</b>
\t- type=>someCustomValueType
+\t- value=>null
)';
$expect = \str_replace('\\t', "\t", $expect);
$dumped = $this->debug->getDump('html')->valDumper->dump($val);
diff --git a/tests/Debug/DebugTestFramework.php b/tests/Debug/DebugTestFramework.php
index e32a1064..f7314298 100644
--- a/tests/Debug/DebugTestFramework.php
+++ b/tests/Debug/DebugTestFramework.php
@@ -674,7 +674,7 @@ private function tstMethodTest($test, LogEntry $logEntry, $outputExpect, $output
if (isset($outputExpect['contains'])) {
$message = "\e[1m" . $test . " doesn't contain\e[0m";
if ($test === 'streamAnsi') {
- $message .= "\nactual: " . \str_replace(array("\e","\n"), array('\e','\n'), $output);
+ $message .= "\nactual: " . \str_replace("\e", '\e', $output);
}
if (\is_string($output)) {
$this->assertStringContainsString($outputExpect['contains'], $output, $message);
@@ -701,10 +701,16 @@ private function tstMethodTest($test, LogEntry $logEntry, $outputExpect, $output
$output = \str_replace("\r", '[\\r]', $output);
$outputExpect = \str_replace("\r", '[\\r]', $outputExpect);
$message = "\e[1m" . $test . " not same\e[0m";
- if ($test === 'streamAnsi') {
- $message .= "\nexpect: " . \str_replace(array("\e", "\n"), array('\e', '\n'), $outputExpect) . "\n";
- $message .= "\nactual: " . \str_replace(array("\e", "\n"), array('\e', '\n'), $output);
+ try {
+ $this->assertStringMatchesFormat(\trim($outputExpect), \trim($output), $message);
+ } catch (\Exception $e) {
+ echo $test . ':' . "\n";
+ echo $test === 'textAnsi'
+ ? 'expect: ' . \str_replace("\e", '\e', $outputExpect) . "\n"
+ . 'actual: ' . \str_replace("\e", '\e', $output) . "\n"
+ : 'expect: ' . $outputExpect . "\n"
+ . 'actual: ' . $output . "\n";
+ throw new \PHPUnit\Framework\AssertionFailedError($test . ' has failed');
}
- $this->assertStringMatchesFormat(\trim($outputExpect), \trim($output), $message);
}
}
diff --git a/tests/Debug/Fixture/TestBase.php b/tests/Debug/Fixture/TestBase.php
index 19effd83..07afb656 100644
--- a/tests/Debug/Fixture/TestBase.php
+++ b/tests/Debug/Fixture/TestBase.php
@@ -38,6 +38,19 @@ public function __get($key)
{
}
+ /**
+ * set magic method
+ *
+ * @param string $key what we're setting
+ * @param mixed $val value
+ *
+ * @return void
+ */
+ public function __set($key, $val)
+ {
+ $this->{$key} = $val;
+ }
+
/**
* call magic method
*
diff --git a/tests/Debug/Helper.php b/tests/Debug/Helper.php
index 18ba40e7..89706eca 100644
--- a/tests/Debug/Helper.php
+++ b/tests/Debug/Helper.php
@@ -58,15 +58,16 @@ public static function crate($val)
/**
* Convert data log log entries into simple arrays
*
- * @param array $data log data
- * @param bool $withKeys whether log entries should be returned with keys or as a list
+ * @param array $data log data
+ * @param bool $withKeys whether log entries should be returned with keys or as a list
+ * @param bool $dropEmptyMeta whether to omit meta if empty
*
* @return array
*/
- public static function deObjectifyData($data, $withKeys = true)
+ public static function deObjectifyData($data, $withKeys = true, $dropEmptyMeta = false)
{
if ($data instanceof LogEntry) {
- return self::logEntryToArray($data, $withKeys);
+ return self::logEntryToArray($data, $withKeys, $dropEmptyMeta);
}
if ($data instanceof Abstraction) {
return self::crate($data);
@@ -75,7 +76,7 @@ public static function deObjectifyData($data, $withKeys = true)
return $data;
}
foreach ($data as $i => $v) {
- $data[$i] = self::deObjectifyData($v, $withKeys);
+ $data[$i] = self::deObjectifyData($v, $withKeys, $dropEmptyMeta);
}
return $data;
}
@@ -153,7 +154,7 @@ public static function setProp($obj, $prop, $val)
*
* @return array|null
*/
- public static function logEntryToArray($logEntry, $withKeys = true)
+ public static function logEntryToArray($logEntry, $withKeys = true, $dropEmptyMeta = false)
{
if (\is_array($logEntry) && \array_keys($logEntry) === array('method','args','meta')) {
return $logEntry;
@@ -164,6 +165,9 @@ public static function logEntryToArray($logEntry, $withKeys = true)
$return = $logEntry->export();
$return['args'] = self::crate($return['args']);
\ksort($return['meta']);
+ if ($dropEmptyMeta && empty($return['meta'])) {
+ unset($return['meta']);
+ }
if (!$withKeys) {
return \array_values($return);
}
@@ -214,16 +218,17 @@ public static function stderr()
{
$isCli = self::isCli();
$dumper = Debug::getInstance()->getDump($isCli ? 'textAnsi' : 'text');
- $args = \array_map(function ($val) use ($dumper) {
- $new = 'null';
- if ($val !== null) {
- $new = $dumper->valDumper->dump($val);
+ $args = \array_map(static function ($val) use ($dumper, $isCli) {
+ $new = $dumper->valDumper->dump($val);
+ if ($isCli) {
$dumper->valDumper->escapeReset = "\e[0m";
- $dumper->valDumper->setValDepth(0);
}
+ $dumper->valDumper->setValDepth(0);
+ /*
if (\json_last_error() !== JSON_ERROR_NONE) {
$new = \var_export($val, true);
}
+ */
return $new;
}, \func_get_args());
$glue = \func_num_args() > 2
@@ -234,6 +239,19 @@ public static function stderr()
\fwrite(STDERR, $outStr . "\n");
return;
}
- echo '
' . \htmlspecialchars($outStr) . '
' . "\n";
+ echo '
' . \htmlspecialchars($outStr) . '
' . "\n";
+ }
+
+ private function varDump($val)
+ {
+ \ini_set('xdebug.var_display_max_depth', 8);
+ \ob_start();
+ \var_dump($val);
+ $new = \ob_get_clean();
+ $new = \preg_replace('/^\S+:\d+[\r\n]/', '', $new);
+ $new = \preg_replace('/=>\n\s+/', '=> ', $new);
+ $new = \preg_replace('/string\(\d+\) /', '', $new);
+ $new = \preg_replace('/array\(0\) \{\n\s*\}/', 'array()', $new);
+ return \trim($new);
}
}
diff --git a/tests/Debug/InternalEventsTest.php b/tests/Debug/InternalEventsTest.php
index 74f9eb22..2ff93989 100644
--- a/tests/Debug/InternalEventsTest.php
+++ b/tests/Debug/InternalEventsTest.php
@@ -28,6 +28,7 @@ public function testDumpCustom()
\t- foo=><b>bar&baz</b>
\t- type=>someCustomValueType
+\t- value=>null
)';
$expect = \str_replace('\\t', "\t", $expect);
$dumped = $this->debug->getDump('html')->valDumper->dump($val);
diff --git a/tests/Debug/Method/ClearTest.php b/tests/Debug/Method/ClearTest.php
index b6603aee..b93cc1da 100644
--- a/tests/Debug/Method/ClearTest.php
+++ b/tests/Debug/Method/ClearTest.php
@@ -31,9 +31,9 @@ public function testClearDefault()
'alerts' => false,
'log' => true,
'logErrors' => false,
+ 'silent' => false,
'summary' => false,
'summaryErrors' => false,
- 'silent' => false,
),
'line' => $this->line,
),
@@ -105,9 +105,9 @@ public function testClearAlerts()
'alerts' => true,
'log' => false,
'logErrors' => false,
+ 'silent' => false,
'summary' => false,
'summaryErrors' => false,
- 'silent' => false,
),
'line' => $this->line,
),
@@ -155,9 +155,9 @@ public function testClearSummary()
'alerts' => false,
'log' => false,
'logErrors' => false,
+ 'silent' => false,
'summary' => true,
'summaryErrors' => false,
- 'silent' => false,
),
'line' => $this->line,
),
@@ -215,9 +215,9 @@ public function testClearErrors()
'alerts' => false,
'log' => false,
'logErrors' => true,
+ 'silent' => false,
'summary' => false,
'summaryErrors' => false,
- 'silent' => false,
),
'line' => $this->line,
),
@@ -275,9 +275,9 @@ public function testClearAll()
'alerts' => true,
'log' => true,
'logErrors' => true,
+ 'silent' => false,
'summary' => true,
'summaryErrors' => true,
- 'silent' => false,
),
'line' => $this->line,
),
@@ -334,9 +334,9 @@ public function testClearSummaryInclErrors()
'alerts' => false,
'log' => false,
'logErrors' => false,
+ 'silent' => false,
'summary' => true,
'summaryErrors' => true,
- 'silent' => false,
),
'line' => $this->line,
),
@@ -393,9 +393,9 @@ public function testClearSummaryErrors()
'alerts' => false,
'log' => false,
'logErrors' => false,
+ 'silent' => false,
'summary' => false,
'summaryErrors' => true,
- 'silent' => false,
),
'line' => $this->line,
),
@@ -468,9 +468,9 @@ public function testClearCollectFalse()
'alerts' => false,
'log' => true,
'logErrors' => false,
+ 'silent' => false,
'summary' => false,
'summaryErrors' => false,
- 'silent' => false,
),
'line' => $this->line,
),
diff --git a/tests/Debug/Method/GroupTest.php b/tests/Debug/Method/GroupTest.php
index 22415f61..98899535 100644
--- a/tests/Debug/Method/GroupTest.php
+++ b/tests/Debug/Method/GroupTest.php
@@ -23,6 +23,7 @@ function myFunctionThatCallsGroup()
* PHPUnit tests for Debug Group Methods
*
* @covers \bdk\Debug
+ * @covers \bdk\Debug\Abstraction\Abstracter
* @covers \bdk\Debug\Dump\Base
* @covers \bdk\Debug\Dump\Html
* @covers \bdk\Debug\Dump\Text
@@ -106,7 +107,7 @@ public function testGroupArgs()
$dateTime
);
$logEntry = $this->debug->data->get('log/0');
- $logEntry = $this->helper->logEntryToArray($logEntry);
+ $logEntryArray = $this->helper->logEntryToArray($logEntry);
$cfgAbsBak = $this->debug->abstracter->setCfg(array(
'brief' => true,
'caseCollect' => false,
@@ -133,17 +134,17 @@ public function testGroupArgs()
'meta' => array(),
), $logEntry);
*/
- $this->assertSame('string', $logEntry['args'][0]);
- $this->assertSame(42, $logEntry['args'][1]);
- $this->assertSame(null, $logEntry['args'][2]);
- $this->assertSame(false, $logEntry['args'][3]);
- $this->assertSame($objExpect, $logEntry['args'][4]);
- $this->assertTrue(($logEntry['args'][5]['cfgFlags'] & AbstractObject::BRIEF) === AbstractObject::BRIEF);
+ $this->assertSame('string', $logEntryArray['args'][0]);
+ $this->assertSame(42, $logEntryArray['args'][1]);
+ $this->assertSame(null, $logEntryArray['args'][2]);
+ $this->assertSame(false, $logEntryArray['args'][3]);
+ $this->assertSame($objExpect, $logEntryArray['args'][4]);
+ $this->assertTrue(($logEntryArray['args'][5]['cfgFlags'] & AbstractObject::BRIEF) === AbstractObject::BRIEF);
$this->assertSame(array(
'returnValue' => 'toStringVal',
'visibility' => 'public',
), $logEntry['args'][5]['methods']['__toString']);
- $this->assertTrue(($logEntry['args'][6]['cfgFlags'] & AbstractObject::BRIEF) === AbstractObject::BRIEF);
+ $this->assertTrue(($logEntryArray['args'][6]['cfgFlags'] & AbstractObject::BRIEF) === AbstractObject::BRIEF);
}
public function testGroupHideIfEmpty()
@@ -816,6 +817,7 @@ public function testGroupsLeftOpen()
This also tests that the values returned by getData have been dereferenced
*/
+ $groupStack = $this->getSharedVar('reflectionProperties')['groupStack'];
$this->debug->groupSummary(1);
$this->debug->log('in summary');
@@ -826,7 +828,6 @@ public function testGroupsLeftOpen()
collect some info before outputing
confirm nothing has been closed yet
*/
- $groupStack = $this->getSharedVar('reflectionProperties')['groupStack'];
$onOutputVals['groupPriorityStackA'] = $this->getSharedVar('reflectionProperties')['groupPriorityStack']->getValue($groupStack);
$onOutputVals['groupStacksA'] = \array_map(function ($stack) {
return \count($stack);
diff --git a/tests/Debug/Method/MethodTest.php b/tests/Debug/Method/MethodTest.php
index ce79f58c..5080bc76 100644
--- a/tests/Debug/Method/MethodTest.php
+++ b/tests/Debug/Method/MethodTest.php
@@ -223,7 +223,7 @@ public function testMethodSetsCfg()
$this->debug->log(new \bdk\Test\Debug\Fixture\TestObj(), $this->debug->meta('cfg', 'methodCollect', false));
$methodCollect = $this->debug->data->get('log/__end__/args/0/cfgFlags') & \bdk\Debug\Abstraction\AbstractObject::METHOD_COLLECT;
$this->assertSame(0, $methodCollect);
- $this->assertCount(2, $this->debug->data->get('log/__end__/args/0/methods'));
+ $this->assertCount(3, $this->debug->data->get('log/__end__/args/0/methods'));
$this->assertTrue($this->debug->getCfg('methodCollect'));
}
diff --git a/tests/Debug/Method/PluginMethodGeneralTest.php b/tests/Debug/Method/PluginMethodGeneralTest.php
index 42ded69b..4845fce7 100644
--- a/tests/Debug/Method/PluginMethodGeneralTest.php
+++ b/tests/Debug/Method/PluginMethodGeneralTest.php
@@ -52,19 +52,19 @@ public function testErrorStats()
$this->debug->errorHandler->handleError(E_NOTICE, 'we tried to warn you', __FILE__, __LINE__);
$this->assertSame(array(
- 'inConsole' => 1,
- 'inConsoleCategories' => array(
- 'warning',
- ),
- 'notInConsole' => 1,
'counts' => array(
- 'fatal' => array('inConsole' => 0, 'notInConsole' => 0, 'suppressed' => 0, ),
- 'error' => array('inConsole' => 0, 'notInConsole' => 0, 'suppressed' => 0, ),
- 'warning' => array('inConsole' => 1, 'notInConsole' => 0, 'suppressed' => 0, ),
'deprecated' => array('inConsole' => 0, 'notInConsole' => 0, 'suppressed' => 0, ),
+ 'error' => array('inConsole' => 0, 'notInConsole' => 0, 'suppressed' => 0, ),
+ 'fatal' => array('inConsole' => 0, 'notInConsole' => 0, 'suppressed' => 0, ),
'notice' => array('inConsole' => 0, 'notInConsole' => 1, 'suppressed' => 0, ),
'strict' => array('inConsole' => 0, 'notInConsole' => 0, 'suppressed' => 0, ),
+ 'warning' => array('inConsole' => 1, 'notInConsole' => 0, 'suppressed' => 0, ),
+ ),
+ 'inConsole' => 1,
+ 'inConsoleCategories' => array(
+ 'warning',
),
+ 'notInConsole' => 1,
), $this->debug->errorStats());
}
diff --git a/tests/Debug/Plugin/LogFilesTest.php b/tests/Debug/Plugin/LogFilesTest.php
index 7f8a2d2d..8ed70873 100644
--- a/tests/Debug/Plugin/LogFilesTest.php
+++ b/tests/Debug/Plugin/LogFilesTest.php
@@ -119,8 +119,8 @@ public function testOnOutput()
),
array(
'attribs' => array(
- 'data-file' => '/var/www/bootstrap.php',
'class' => array(),
+ 'data-file' => '/var/www/bootstrap.php',
),
'debug' => Abstracter::ABSTRACTION,
'type' => 'string',
@@ -128,8 +128,8 @@ public function testOnOutput()
),
array(
'attribs' => array(
- 'data-file' => '/var/www/index.php',
'class' => array(),
+ 'data-file' => '/var/www/index.php',
),
'debug' => Abstracter::ABSTRACTION,
'type' => 'string',
diff --git a/tests/Debug/Plugin/RedactionTest.php b/tests/Debug/Plugin/RedactionTest.php
index 8453114c..dca108d5 100644
--- a/tests/Debug/Plugin/RedactionTest.php
+++ b/tests/Debug/Plugin/RedactionTest.php
@@ -64,7 +64,7 @@ public static function providerTestMethod()
),
array(
'entry' => static function (LogEntry $logEntry) use ($base64snip) {
- $jsonExpect = '{"method":"log","args":[{"brief":false,"strlen":null,"typeMore":"base64","value":"' . $base64snip . '","valueDecoded":{"brief":false,"strlen":null,"typeMore":"json","value":"{\n \"poop\": \"\\\\ud83d\\\\udca9\",\n \"int\": 42,\n \"password\": \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\"\n}","valueDecoded":{"poop":"\ud83d\udca9","int":42,"password":"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"},"type":"string","attribs":{"class":["highlight","language-json"]},"addQuotes":false,"contentType":"application\/json","prettified":true,"prettifiedTag":true,"visualWhiteSpace":false,"debug":"\u0000debug\u0000"},"type":"string","debug":"\u0000debug\u0000"}],"meta":{"redact":true}}';
+ $jsonExpect = '{"method":"log","args":[{"brief":false,"strlen":null,"type":"string","typeMore":"base64","value":"' . $base64snip . '","valueDecoded":{"addQuotes":false,"attribs":{"class":["highlight","language-json"]},"brief":false,"contentType":"application\/json","prettified":true,"prettifiedTag":true,"strlen":null,"type":"string","typeMore":"json","value":"{\n \"poop\": \"\\\\ud83d\\\\udca9\",\n \"int\": 42,\n \"password\": \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\"\n}","valueDecoded":{"poop":"\ud83d\udca9","int":42,"password":"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"},"visualWhiteSpace":false,"debug":"\u0000debug\u0000"},"debug":"\u0000debug\u0000"}],"meta":{"redact":true}}';
$jsonified = \json_encode($logEntry);
self::assertSame($jsonExpect, $jsonified);
},
@@ -87,10 +87,6 @@ public static function providerTestMethod()
$obj = $logEntry['args'][0];
self::assertSame(null, $obj['stringified']);
self::assertSame('foo=bar&password=âââââââââ&ding=dong', $obj['methods']['__toString']['returnValue']);
- // $this->helper->stderr($logEntry);
- // $jsonExpect = '{"method":"log","args":[{"strlen":null,"typeMore":"base64","value":"' . $base64snip . '","valueDecoded":{"strlen":null,"typeMore":"json","valueDecoded":{"poop":"\ud83d\udca9","int":42,"password":"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"},"value":"{\n \"poop\": \"\\\\ud83d\\\\udca9\",\n \"int\": 42,\n \"password\": \"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\"\n}","type":"string","attribs":{"class":["highlight","language-json"]},"addQuotes":false,"contentType":"application\/json","prettified":true,"prettifiedTag":true,"visualWhiteSpace":false,"debug":"\u0000debug\u0000"},"type":"string","debug":"\u0000debug\u0000"}],"meta":{"redact":true}}';
- // $jsonified = \json_encode($logEntry);
- // $this->assertSame($jsonExpect, $jsonified);
},
),
),
diff --git a/tests/Debug/Route/EmailTest.php b/tests/Debug/Route/EmailTest.php
index f8107732..d0e6660d 100644
--- a/tests/Debug/Route/EmailTest.php
+++ b/tests/Debug/Route/EmailTest.php
@@ -30,8 +30,8 @@ public function testEmail()
$this->assertStringContainsString($stringExpect, $this->emailInfo['body']);
$data = \bdk\Debug\Utility\SerializeLog::unserialize($this->emailInfo['body']);
$this->assertSame(array(
- 'version',
'config',
+ 'version',
'alerts',
'log',
'logSummary',
diff --git a/tests/Debug/SubstitutionTest.php b/tests/Debug/SubstitutionTest.php
index 3826ed1f..9c9fc309 100644
--- a/tests/Debug/SubstitutionTest.php
+++ b/tests/Debug/SubstitutionTest.php
@@ -294,7 +294,7 @@ public function testMarkupSanitizeFirstFalse()
'',
'
sub bold',
'extra',
- $this->debug->meta('sanitizeFirst', false)
+ $this->debug->meta('sanitizeFirst', false),
);
$this->doTestSubstitution(
@@ -377,13 +377,13 @@ public function doTestSubstitution($method, $args, $tests)
$test[0] = \array_map(function ($val) {
return $this->debug->getDump('base')->valDumper->dump($val);
}, $test[0]);
- $test[1] = \in_array($method, array('error','warn'))
+ $test[1] = \in_array($method, array('error','warn'), true)
? $this->file . ': ' . $this->line
: null;
- $test[2] = \in_array($method, array('alert','log'))
+ $test[2] = \in_array($method, array('alert','log'), true)
? ''
: $method;
- } elseif ($name === 'entry') {
+ } elseif ($name === 'entry' && \is_array($test)) {
$test['method'] = $method;
if ($method === 'alert') {
$test['meta']['dismissible'] = false;
@@ -477,9 +477,9 @@ public function doTestSubstitution($method, $args, $tests)
$prefixes = array(
'alert' => '',
'assert' => 'â ',
- 'log' => '',
'error' => 'âĻģ ',
'info' => 'âš ',
+ 'log' => '',
'warn' => 'â ',
);
$test = $prefixes[$method] . $test;
@@ -500,11 +500,6 @@ public function doTestSubstitution($method, $args, $tests)
}
$tests[$name] = $test;
}
- /*
- if ($method === 'alert') {
- echo 'chromeLogger alert test ' . \print_r($tests['chromeLogger'], true) . "\n\n";
- }
- */
$this->testMethod($method, $args, $tests);
if ($method === 'assert') {
\array_shift($args);
diff --git a/tests/Debug/Type/ArrayTest.php b/tests/Debug/Type/ArrayTest.php
index 4622df42..306a8b44 100644
--- a/tests/Debug/Type/ArrayTest.php
+++ b/tests/Debug/Type/ArrayTest.php
@@ -12,6 +12,7 @@
* @covers \bdk\Debug\Dump\BaseValue
* @covers \bdk\Debug\Dump\Text
* @covers \bdk\Debug\Dump\Html
+ * @covers \bdk\Debug\Dump\Html\Value
* @covers \bdk\Debug\Dump\TextAnsiValue
* @covers \bdk\Debug\Dump\TextValue
* @covers \bdk\Debug\Abstraction\Abstracter
diff --git a/tests/Debug/Type/BasicTest.php b/tests/Debug/Type/BasicTest.php
index 1e0ca2c7..38adb350 100644
--- a/tests/Debug/Type/BasicTest.php
+++ b/tests/Debug/Type/BasicTest.php
@@ -141,9 +141,9 @@ static function ($foo, $bar) {
self::assertSame('Closure', $values['className']);
$line = __LINE__ - 10;
self::assertSame(array(
+ 'extensionName' => false,
'fileName' => __FILE__,
'startLine' => $line,
- 'extensionName' => false,
), $values['definition']);
\array_walk($values['properties'], static function ($propInfo, $propName) use ($line) {
// echo \json_encode($propInfo, JSON_PRETTY_PRINT);
diff --git a/tests/Debug/Type/EnumTest.php b/tests/Debug/Type/EnumTest.php
index 38439bd9..7305d54f 100644
--- a/tests/Debug/Type/EnumTest.php
+++ b/tests/Debug/Type/EnumTest.php
@@ -12,6 +12,7 @@
*
* @covers \bdk\Debug\Abstraction\AbstractObject
* @covers \bdk\Debug\Abstraction\AbstractObjectConstants
+ * @covers \bdk\Debug\Abstraction\AbstractObjectMethodParams
* @covers \bdk\Debug\Dump\Html\HtmlObject
* @covers \bdk\Debug\Dump\Html\ObjectConstants
*/
@@ -26,7 +27,7 @@ public static function providerTestMethod()
);
}
- // $regexTrim = '#^\s+#m';
+ // @phpcs:ignore SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys.IncorrectKeyOrder
return array(
'basic' => array(
'log',
@@ -139,7 +140,7 @@ public static function providerTestMethod()
},
'html' => '%a
public REGULAR_CONSTANT = test
properties%a',
- )
+ ),
),
'backed' => array(
diff --git a/tests/Debug/Type/ObjectTest.php b/tests/Debug/Type/ObjectTest.php
index 3cfd6a56..14327bfe 100644
--- a/tests/Debug/Type/ObjectTest.php
+++ b/tests/Debug/Type/ObjectTest.php
@@ -78,7 +78,7 @@ public static function providerTestMethod()
(⨠magic excluded) magicProp
(debug) debugValue = "This property is debug only"
Methods:
- public: 8
+ public: 9
protected: 1
private: 1
magic: 2
@@ -99,8 +99,8 @@ public static function providerTestMethod()
\e[38;5;245m)\e[0m
\e[38;5;250m(protected ⨠magic-read)\e[0m \e[38;5;83mmagicReadProp\e[0m \e[38;5;130m=\e[0m \e[38;5;250m"\e[0mnot null\e[38;5;250m"\e[0m
\e[38;5;250m(protected)\e[0m \e[38;5;83mpropProtected\e[0m \e[38;5;130m=\e[0m \e[38;5;250m"\e[0mdefined only in TestBase (protected)\e[38;5;250m"\e[0m
- \e[38;5;250m(private)\e[0m \e[38;5;83mdebug\e[0m \e[38;5;130m=\e[0m \e[38;5;9mNOT INSPECTED\e[0m
- \e[38;5;250m(private)\e[0m \e[38;5;83minstance\e[0m \e[38;5;130m=\e[0m \e[38;5;9m*RECURSION*\e[0m
+ \e[38;5;250m(private)\e[0m \e[38;5;83mdebug\e[0m \e[38;5;130m=\e[0m \e[38;5;250mbdk\\e[0m\e[1mDebug\e[22m \e[38;5;9mNOT INSPECTED\e[0m
+ \e[38;5;250m(private)\e[0m \e[38;5;83minstance\e[0m \e[38;5;130m=\e[0m \e[38;5;250mbdk\Test\Debug\Fixture\\e[0m\e[1mTestObj\e[22m \e[38;5;196m*RECURSION*\e[0m
\e[38;5;250m(private excluded)\e[0m \e[38;5;83mpropNoDebug\e[0m
\e[38;5;250m(private)\e[0m \e[38;5;83mpropPrivate\e[0m \e[38;5;130m=\e[0m \e[38;5;250m"\e[0mredefined in Test (private) (alternate value via __debugInfo)\e[38;5;250m"\e[0m
\e[38;5;250m(đ private)\e[0m \e[38;5;83mtestBasePrivate\e[0m \e[38;5;130m=\e[0m \e[38;5;250m"\e[0mdefined in TestBase (private)\e[38;5;250m"\e[0m
@@ -109,7 +109,7 @@ public static function providerTestMethod()
\e[38;5;250m(⨠magic excluded)\e[0m \e[38;5;83mmagicProp\e[0m
\e[38;5;250m(debug)\e[0m \e[38;5;83mdebugValue\e[0m \e[38;5;130m=\e[0m \e[38;5;250m"\e[0mThis property is debug only\e[38;5;250m"\e[0m
\e[4mMethods:\e[24m
- public\e[38;5;245m:\e[0m \e[96m8\e[0m
+ public\e[38;5;245m:\e[0m \e[96m9\e[0m
protected\e[38;5;245m:\e[0m \e[96m1\e[0m
private\e[38;5;245m:\e[0m \e[96m1\e[0m
magic\e[38;5;245m:\e[0m \e[96m2\e[0m
@@ -203,7 +203,7 @@ public static function providerTestMethod()
// properties
$expect = \implode("\n", array(
'
properties (via __debugInfo)',
- '
This object has a __get
method',
+ '
This object has __get
and __set
methods',
'
public propPublic = redefined in Test (public)',
'
public static propStatic = I\'m Static',
'
public someArray = array(',
@@ -227,7 +227,7 @@ public static function providerTestMethod()
'private toStrThrow = 0',
'magic bool magicProp',
'debug debugValue = This property is debug only',
- 'methods'
+ 'methods',
));
if (PHP_VERSION_ID >= 80100) {
$expect = \str_replace('\'', ''', $expect);
@@ -246,6 +246,7 @@ public static function providerTestMethod()
'public __call(string $name, array $args): mixed',
'public __debugInfo(): array',
'public __get(string $key): mixed',
+ 'public __set(string $key, mixed $val): void',
'public __toString(): string
',
'abracadabra',
'final public methodPublic(bdk\Test\Debug\Fixture\SomeClass This is the song that never ends. Yes, it goes on and on my friend. Some people started singing it… (119 more bytes)', $str);
- }
+ },
),
),
// 2
@@ -367,10 +368,10 @@ public static function providerTestMethod()
foreach ($objAbs['constants'] as $const) {
self::assertNull($const['desc']);
}
- foreach ($objAbs['properties'] as $name => $prop) {
+ foreach ($objAbs['properties'] as $prop) {
self::assertNull($prop['desc']);
}
- foreach ($objAbs['methods'] as $name => $method) {
+ foreach ($objAbs['methods'] as $method) {
self::assertSame(
array('desc' => null, 'summary' => null),
\array_intersect_key($method['phpDoc'], \array_flip(array('desc','summary')))
@@ -404,7 +405,7 @@ public static function providerTestMethod()
'value: "defined in TestBase"',
));
self::assertEmpty($matches, 'Html should not contain phpDoc summary & descriptions');
- }
+ },
),
),
'methodCollectFalse' => array(
@@ -435,7 +436,7 @@ public static function providerTestMethod()
'text' => static function ($str) {
$containsMethods = \preg_match('/methods/i', $str) === 1;
self::assertFalse($containsMethods, 'Output should not contain methods');
- }
+ },
),
),
// 3
@@ -544,6 +545,7 @@ public static function providerTestMethod()
'__call',
'__debugInfo',
'__get',
+ '__set',
'__toString',
'methodPrivate',
'methodProtected',
@@ -665,13 +667,13 @@ public function testAbstraction()
);
self::assertArraySubset(
array(
- 'isPromoted' => false,
- 'visibility' => 'protected',
- 'value' => 'defined only in TestBase (protected)',
'inheritedFrom' => 'bdk\Test\Debug\Fixture\TestBase',
- 'overrides' => null,
+ 'isPromoted' => false,
'originallyDeclared' => 'bdk\Test\Debug\Fixture\TestBase',
+ 'overrides' => null,
+ 'value' => 'defined only in TestBase (protected)',
'valueFrom' => 'value',
+ 'visibility' => 'protected',
),
$abs['properties']['propProtected']
);
@@ -1208,9 +1210,8 @@ public function testRecursiveObjectProp1()
$select = '.m_log
> .t_object > .object-inner
> .property
- > .t_array .array-inner > li'
- // > .t_array
- . '> .t_recursion';
+ > .t_array .array-inner > li
+ > .t_recursion';
self::assertSelectCount($select, 1, $output);
}
diff --git a/tests/Debug/Type/StringTest.php b/tests/Debug/Type/StringTest.php
index 1edf4a83..fc883ee3 100644
--- a/tests/Debug/Type/StringTest.php
+++ b/tests/Debug/Type/StringTest.php
@@ -269,14 +269,15 @@ public static function providerTestMethod()
. ''
. \str_replace("\n", '' . "\n", $longStringExpect)
. '… 1778 more bytes (not logged)'
- . ''),
+ . ''
+ ),
'script' => 'console.log("long string",' . \json_encode($longStringExpect . '[1778 more bytes (not logged)]') . ');',
'streamAnsi' => "long string \e[38;5;245m=\e[0m \e[38;5;250m\"\e[0m"
. $longStringExpect
. "\e[38;5;250m\"\e[0m"
. "\e[30;48;5;41m[1778 more bytes (not logged)]\e[0m",
'text' => 'long string = "' . $longStringExpect . '"[1778 more bytes (not logged)]',
- )
+ ),
),
'base64' => array(
@@ -285,8 +286,8 @@ public static function providerTestMethod()
\base64_encode(\file_get_contents(TEST_DIR . '/assets/logo.png')),
),
array(
- 'entry' => function (LogEntry $logEntry) use ($base64snip) {
- $jsonExpect = '{"method":"log","args":[{"brief":false,"strlen":10852,"typeMore":"base64","value":' . \json_encode($base64snip) . ',"valueDecoded":{"brief":false,"strlen":%d,"typeMore":"binary","value":"","contentType":"%s","type":"string","debug":"\u0000debug\u0000"},"type":"string","debug":"\u0000debug\u0000"}],"meta":[]}';
+ 'entry' => static function (LogEntry $logEntry) use ($base64snip) {
+ $jsonExpect = '{"method":"log","args":[{"brief":false,"strlen":10852,"type":"string","typeMore":"base64","value":' . \json_encode($base64snip) . ',"valueDecoded":{"brief":false,"contentType":"%s","strlen":%d,"type":"string","typeMore":"binary","value":"","debug":"\u0000debug\u0000"},"debug":"\u0000debug\u0000"}],"meta":[]}';
$jsonified = \json_encode($logEntry);
self::assertStringMatchesFormat($jsonExpect, $jsonified);
},
@@ -295,7 +296,7 @@ public static function providerTestMethod()
$base64snip . '[10696 more bytes (not logged)]',
),
null,
- ''
+ '',
),
'html' => '' . "\n"
. '' . "\n"
@@ -318,7 +319,7 @@ public static function providerTestMethod()
\base64_encode(\file_get_contents(TEST_DIR . '/assets/logo.png')),
),
array(
- 'entry' => function (LogEntry $logEntry) {
+ 'entry' => static function (LogEntry $logEntry) {
},
'html' => '
' . "\n"
. '',
- )
+ ),
),
'serialized.brief' => array(
'group',
@@ -606,14 +607,14 @@ public static function providerTestMethod()
'typeMore' => Abstracter::TYPE_STRING_SERIALIZED,
'value' => 'a:1:{s:3:"foo";s:3:"bar";}',
'valueDecoded' => null,
- )
+ ),
),
'meta' => array(),
),
'html' => '
',
- )
+ ),
),
);
}
diff --git a/tests/Debug/Utility/FileTreeTest.php b/tests/Debug/Utility/FileTreeTest.php
index 834c01f4..9ab6149c 100644
--- a/tests/Debug/Utility/FileTreeTest.php
+++ b/tests/Debug/Utility/FileTreeTest.php
@@ -33,33 +33,33 @@ public function testFileTree()
'/var/www' => array(
'excludedDir' => array(
array(
- 'value' => '2 omitted',
'attribs' => array(
'class' => array(
'exclude-count',
),
),
'type' => 'string',
+ 'value' => '2 omitted',
'debug' => Abstracter::ABSTRACTION,
),
),
array(
- 'value' => 'bootstrap.php',
'attribs' => array(
- 'data-file' => '/var/www/bootstrap.php',
'class' => [],
+ 'data-file' => '/var/www/bootstrap.php',
),
'type' => 'string',
- 'debug' => Abstracter::ABSTRACTION
+ 'value' => 'bootstrap.php',
+ 'debug' => Abstracter::ABSTRACTION,
),
array(
- 'value' => 'index.php',
'attribs' => array(
- 'data-file' => '/var/www/index.php',
'class' => [],
+ 'data-file' => '/var/www/index.php',
),
'type' => 'string',
- 'debug' => Abstracter::ABSTRACTION
+ 'value' => 'index.php',
+ 'debug' => Abstracter::ABSTRACTION,
),
),
);
diff --git a/tests/Debug/Utility/PhpDocTest.php b/tests/Debug/Utility/PhpDocTest.php
index c2403ed3..ec169c87 100644
--- a/tests/Debug/Utility/PhpDocTest.php
+++ b/tests/Debug/Utility/PhpDocTest.php
@@ -40,93 +40,93 @@ public function testGetParsedObject()
$parsed = Debug::getInstance()->phpDoc->getParsed($obj);
$expectJson = <<<'EOD'
{
- "summary": "Implement me!",
- "desc": null,
- "property": [
+ "author": [
{
- "type": "bool",
- "name": "magicProp",
- "desc": "I'm avail via __get()"
+ "desc": "Author desc is non-standard",
+ "email": "bkfake-github@yahoo.com",
+ "name": "Brad Kent"
}
],
- "property-read": [
+ "desc": null,
+ "link": [
{
- "type": "bool",
- "name": "magicReadProp",
- "desc": "Read Only!"
+ "desc": null,
+ "uri": "https:\/\/github.com\/bkdotcom\/PHPDebugConsole"
}
],
"method": [
{
- "static": false,
- "type": "void",
+ "desc": "I'm a magic method",
"name": "presto",
"param": [
{
- "type": null,
- "name": "$foo"
+ "name": "$foo",
+ "type": null
},
{
- "type": "int",
+ "defaultValue": "1",
"name": "$int",
- "defaultValue": "1"
+ "type": "int"
},
{
- "type": null,
+ "defaultValue": "true",
"name": "$bool",
- "defaultValue": "true"
+ "type": null
},
{
- "type": null,
+ "defaultValue": "null",
"name": "$null",
- "defaultValue": "null"
+ "type": null
}
],
- "desc": "I'm a magic method"
+ "static": false,
+ "type": "void"
},
{
- "static": true,
- "type": "void",
+ "desc": "I'm a static magic method",
"name": "prestoStatic",
"param": [
{
- "type": "string",
- "name": "$noDefault"
+ "name": "$noDefault",
+ "type": "string"
},
{
- "type": null,
+ "defaultValue": "array()",
"name": "$arr",
- "defaultValue": "array()"
+ "type": null
},
{
- "type": null,
+ "defaultValue": "array('a'=>'ay','b'=>'bee')",
"name": "$opts",
- "defaultValue": "array('a'=>'ay','b'=>'bee')"
+ "type": null
}
],
- "desc": "I'm a static magic method"
+ "static": true,
+ "type": "void"
}
],
- "author": [
+ "property": [
{
- "name": "Brad Kent",
- "email": "bkfake-github@yahoo.com",
- "desc": "Author desc is non-standard"
+ "desc": "I'm avail via __get()",
+ "name": "magicProp",
+ "type": "bool"
}
],
- "link": [
+ "property-read": [
{
- "uri": "https:\/\/github.com\/bkdotcom\/PHPDebugConsole",
- "desc": null
+ "desc": "Read Only!",
+ "name": "magicReadProp",
+ "type": "bool"
}
],
"see": [
{
- "uri": null,
+ "desc": null,
"fqsen": "subclass::method()",
- "desc": null
+ "uri": null
}
],
+ "summary": "Implement me!",
"unknown": [
{
"desc": "Some phpdoc tag"
@@ -144,8 +144,8 @@ public function testGetParsedObject()
$parsed = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Utility\PhpDocNoParent');
self::assertSame(array(
- 'summary' => null,
'desc' => null,
+ 'summary' => null,
), $parsed);
}
@@ -153,28 +153,28 @@ public function testGetParsedMethod()
{
$parsed = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Utility\PhpDocImplements::someMethod()');
self::assertSame(array(
- 'summary' => 'SomeInterface summary',
'desc' => 'SomeInterface description',
'return' => array(
- 'type' => 'bdk\Test\Debug\Fixture\SomeInterface',
'desc' => null,
+ 'type' => 'bdk\Test\Debug\Fixture\SomeInterface',
),
+ 'summary' => 'SomeInterface summary',
), $parsed);
$parsed = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Utility\PhpDocExtends::someMethod2()');
self::assertSame(array(
- 'summary' => 'PhpDocImplements summary',
'desc' => 'PhpDocImplements desc',
'return' => array(
- 'type' => 'void',
'desc' => null,
+ 'type' => 'void',
),
+ 'summary' => 'PhpDocImplements summary',
), $parsed);
$parsed = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Utility\PhpDocExtends::someMethod3()');
self::assertSame(array(
- 'summary' => 'PhpDocExtends summary',
'desc' => 'PhpDocExtends desc / PhpDocImplements desc',
+ 'summary' => 'PhpDocExtends summary',
/*
'return' => array(
'type' => 'void',
@@ -185,8 +185,8 @@ public function testGetParsedMethod()
$parsed = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Utility\PhpDocNoParent::someMethod()');
self::assertSame(array(
- 'summary' => null,
'desc' => null,
+ 'summary' => null,
), $parsed);
}
@@ -194,26 +194,26 @@ public function testGetParsedProperty()
{
$phpDoc = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Test2::$magicReadProp');
self::assertSame(array(
- 'summary' => 'This property is important',
'desc' => null,
+ 'summary' => 'This property is important',
'var' => array(
array(
- 'type' => 'string',
- 'name' => 'magicReadProp',
'desc' => '',
+ 'name' => 'magicReadProp',
+ 'type' => 'string',
),
),
), $phpDoc);
$parsed = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Utility\PhpDocImplements::$someProperty');
self::assertSame(array(
- 'summary' => '$someProperty summary',
'desc' => null,
+ 'summary' => '$someProperty summary',
'var' => array(
array(
- 'type' => 'string',
- 'name' => 'someProperty',
'desc' => 'desc',
+ 'name' => 'someProperty',
+ 'type' => 'string',
),
),
), $parsed);
@@ -227,8 +227,8 @@ public function testGetParsedConstant()
$reflector = new \ReflectionClassConstant('\bdk\Test\Debug\Fixture\Utility\PhpDocExtends', 'SOME_CONSTANT');
$parsed = Debug::getInstance()->phpDoc->getParsed($reflector);
self::assertSame(array(
- 'summary' => 'PhpDocImplements summary',
'desc' => null,
+ 'summary' => 'PhpDocImplements summary',
/*
'var' => array(
array(
@@ -242,8 +242,8 @@ public function testGetParsedConstant()
$parsed = Debug::getInstance()->phpDoc->getParsed('\bdk\Test\Debug\Fixture\Utility\PhpDocExtends::SOME_CONSTANT');
self::assertSame(array(
- 'summary' => 'PhpDocImplements summary',
'desc' => null,
+ 'summary' => 'PhpDocImplements summary',
/*
'var' => array(
array(
@@ -256,7 +256,7 @@ public function testGetParsedConstant()
), $parsed);
}
- public static function dataProviderComments()
+ public static function providerComments()
{
return array(
'basic' => array(
@@ -264,13 +264,13 @@ public static function dataProviderComments()
* @var string $comment phpdoc comment
*/',
array(
- 'summary' => null,
'desc' => null,
+ 'summary' => null,
'var' => array(
array(
- 'type' => 'string',
+ 'desc' => 'phpdoc comment',
'name' => 'comment',
- 'desc' => 'phpdoc comment'
+ 'type' => 'string',
),
),
),
@@ -280,17 +280,17 @@ public static function dataProviderComments()
* @method boolean magicMethod()
*/',
array(
- 'summary' => null,
'desc' => null,
'method' => array(
array(
- 'static' => false,
- 'type' => 'bool',
+ 'desc' => null,
'name' => 'magicMethod',
'param' => array(),
- 'desc' => null,
+ 'static' => false,
+ 'type' => 'bool',
),
),
+ 'summary' => null,
),
),
'missing $' => array(
@@ -298,15 +298,15 @@ public static function dataProviderComments()
* @param string comment
*/',
array(
- 'summary' => null,
'desc' => null,
'param' => array(
array(
- 'type' => 'string',
- 'name' => 'comment',
'desc' => null,
+ 'name' => 'comment',
+ 'type' => 'string',
),
),
+ 'summary' => null,
),
),
'missing $ 2' => array(
@@ -314,15 +314,15 @@ public static function dataProviderComments()
* @param string comment here
*/',
array(
- 'summary' => null,
'desc' => null,
'param' => array(
array(
- 'type' => 'string',
- 'name' => null,
'desc' => 'comment here',
+ 'name' => null,
+ 'type' => 'string',
),
),
+ 'summary' => null,
),
),
'multi lines' => array(
@@ -336,19 +336,19 @@ public static function dataProviderComments()
* @return self
*/',
array(
- 'summary' => 'Ding.',
'desc' => "Indented\nIndented 2",
'param' => array(
array(
- 'type' => 'int[]',
- 'name' => '$number',
'desc' => "Some number\ndoes things",
+ 'name' => '$number',
+ 'type' => 'int[]',
),
),
'return' => array(
- 'type' => 'self',
'desc' => null,
+ 'type' => 'self',
),
+ 'summary' => 'Ding.',
),
),
'complexType 1' => array(
@@ -356,12 +356,12 @@ public static function dataProviderComments()
* @return array{title: string, value: string, short: false} Very clear description
*/',
array(
- 'summary' => null,
'desc' => null,
'return' => array(
- 'type' => 'array{title: string, value: string, short: false}',
'desc' => 'Very clear description',
+ 'type' => 'array{title: string, value: string, short: false}',
),
+ 'summary' => null,
),
),
'complexType 2' => array(
@@ -369,12 +369,12 @@ public static function dataProviderComments()
* @return array mumbo jumbo
*/',
array(
- 'summary' => null,
'desc' => null,
'return' => array(
- 'type' => 'array',
'desc' => 'mumbo jumbo',
+ 'type' => 'array',
),
+ 'summary' => null,
),
),
);
@@ -384,7 +384,7 @@ public static function dataProviderComments()
* @param string $comment
* @param array $expect
*
- * @dataProvider dataProviderComments
+ * @dataProvider providerComments
*/
public function testStrings($comment, $expect)
{
diff --git a/tests/Debug/Utility/SerializeLogTest.php b/tests/Debug/Utility/SerializeLogTest.php
index 91a6dbf4..efe0ee45 100644
--- a/tests/Debug/Utility/SerializeLogTest.php
+++ b/tests/Debug/Utility/SerializeLogTest.php
@@ -7,6 +7,7 @@
use bdk\Debug\Utility\SerializeLog;
use bdk\HttpMessage\ServerRequest;
use bdk\Test\Debug\DebugTestFramework;
+use bdk\Test\Debug\Fixture\TestObj;
use bdk\Test\PolyFill\AssertionTrait;
/**
@@ -22,6 +23,7 @@ class SerializeLogTest extends DebugTestFramework
public function testSerializeUnserialize()
{
$debug = new Debug(array(
+ 'collect' => true,
'logResponse' => false,
'serviceProvider' => array(
'serverRequest' => new ServerRequest(
@@ -39,18 +41,19 @@ public function testSerializeUnserialize()
$debug->alert('some alert');
$debug->groupSummary();
$debug->log('in summary');
+ $debug->log(new TestObj());
$debug->groupEnd();
$debug->info('this is a test');
$serialized = SerializeLog::serialize($debug);
$unserialized = SerializeLog::unserialize($serialized);
- $this->assertIsArray($unserialized);
+ self::assertIsArray($unserialized);
$channelNameRoot = $debug->getCfg('channelName', Debug::CONFIG_DEBUG);
$expect = array(
'alerts' => $this->helper->deObjectifyData($debug->data->get('alerts'), false),
'config' => array(
'channelIcon' => $debug->getCfg('channelIcon', Debug::CONFIG_DEBUG),
'channelName' => $channelNameRoot,
- 'channels' => \array_map(function (Debug $channel) use ($channelNameRoot) {
+ 'channels' => \array_map(static function (Debug $channel) use ($channelNameRoot) {
$channelName = $channel->getCfg('channelName', Debug::CONFIG_DEBUG);
return array(
'channelIcon' => $channel->getCfg('channelIcon', Debug::CONFIG_DEBUG),
@@ -61,20 +64,22 @@ public function testSerializeUnserialize()
}, $debug->getChannels(true, true)),
'logRuntime' => $debug->getCfg('logRuntime'),
),
- 'log' => $this->helper->deObjectifyData($debug->data->get('log'), false),
- 'logSummary' => $this->helper->deObjectifyData($debug->data->get('logSummary'), false),
+ 'log' => $this->helper->deObjectifyData($debug->data->get('log'), false, true),
+ 'logSummary' => $this->helper->deObjectifyData($debug->data->get('logSummary'), false, true),
'runtime' => $debug->data->get('runtime'),
'requestId' => $debug->data->get('requestId'),
'version' => Debug::VERSION,
);
- $this->assertEquals(
+ self::assertEquals(
$expect,
$this->helper->deObjectifyData($unserialized)
);
$debug = SerializeLog::import($unserialized);
+ $objAbs = $debug->data->get('logSummary.0.1.args.0');
+ self::assertInstanceOf('bdk\\Debug\\Abstraction\\Abstraction', $objAbs);
$serialized = SerializeLog::serialize($debug);
$unserialized = SerializeLog::unserialize($serialized);
- $this->assertEquals(
+ self::assertEquals(
$expect,
$this->helper->deObjectifyData($unserialized)
);
@@ -95,7 +100,7 @@ public function testSerialieNotBase64()
}
$serialized = \base64_decode($serialized);
$unserialized = SerializeLog::unserialize($serialized);
- $this->assertFalse($unserialized);
+ self::assertFalse($unserialized);
}
public function testUnserializeLogLegacy()
@@ -124,11 +129,11 @@ public function testUnserializeLogLegacy()
EOD;
$unserialized = SerializeLog::unserialize($serialized);
$expect = array(
- 'version' => '2.3',
'config' => array(
'channels' => array(),
'channelName' => 'general',
),
+ 'version' => '2.3',
'alerts' => array(
array(
'alert',
@@ -333,9 +338,9 @@ public function testUnserializeLogLegacy()
'channelName' => 'general',
),
);
- $this->assertSame($expect, $unserialized);
- $debug = SerializeLog::import($unserialized);
+ self::assertSame($expect, $unserialized);
+ $debug = SerializeLog::import($unserialized);
/*
Now test that imported log serializes as expected
@@ -365,6 +370,7 @@ public function testUnserializeLogLegacy()
$serialized = SerializeLog::serialize($debug);
$unserialized = SerializeLog::unserialize($serialized);
+
$keysCompare = array('alerts', 'log','logSummary');
foreach ($expect['log'] as $i => $logEntryArray) {
if (empty($logEntryArray[2])) {
@@ -376,7 +382,7 @@ public function testUnserializeLogLegacy()
unset($expect['logSummary'][0][$i][2]);
}
}
- $this->assertEquals(
+ self::assertEquals(
\array_intersect_key($expect, \array_flip($keysCompare)),
\array_intersect_key($this->helper->deObjectifyData($unserialized), \array_flip($keysCompare))
);
diff --git a/tests/Debug/Utility/Utf8Test.php b/tests/Debug/Utility/Utf8Test.php
index 454f084f..323e6088 100644
--- a/tests/Debug/Utility/Utf8Test.php
+++ b/tests/Debug/Utility/Utf8Test.php
@@ -31,7 +31,7 @@ public function testBufferAnalyze()
'blocks' => array(
array(
'utf8special',
- "\xef\xbb\xbf"
+ "\xef\xbb\xbf",
),
array(
'utf8',
@@ -42,8 +42,8 @@ public function testBufferAnalyze()
'bytesOther' => 0,
'bytesSpecial' => 3,
'bytesUtf8' => 9,
- 'percentBinary' => 0,
'mbStrlen' => 10,
+ 'percentBinary' => 0,
'strlen' => 12,
), $stats1);
self::assertSame($stats1, $stats2);
diff --git a/tests/HttpMessage/UriUtilsTest.php b/tests/HttpMessage/UriUtilsTest.php
index fa183d1f..68f453fb 100644
--- a/tests/HttpMessage/UriUtilsTest.php
+++ b/tests/HttpMessage/UriUtilsTest.php
@@ -9,7 +9,7 @@
/**
* @covers bdk\HttpMessage\UriUtils
*
- * @phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedKeys.IncorrectKeyOrder
+ * @phpcs:disable SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys.IncorrectKeyOrder
*/
class UriUtilsTest extends TestCase
{