DotTest.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. <?php
  2. /**
  3. * Dot - PHP dot notation access to arrays
  4. *
  5. * @author Riku Särkinen <riku@adbar.io>
  6. * @link https://github.com/adbario/php-dot-notation
  7. * @license https://github.com/adbario/php-dot-notation/blob/2.x/LICENSE.md (MIT License)
  8. */
  9. namespace Adbar\Tests;
  10. use Adbar\Dot;
  11. use ArrayIterator;
  12. use PHPUnit\Framework\TestCase;
  13. class DotTest extends TestCase
  14. {
  15. /*
  16. * --------------------------------------------------------------
  17. * Construct
  18. * --------------------------------------------------------------
  19. */
  20. public function testConstructWithoutValues()
  21. {
  22. $dot = new Dot;
  23. $this->assertSame([], $dot->all());
  24. }
  25. public function testConstructWithArray()
  26. {
  27. $dot = new Dot(['foo' => 'bar']);
  28. $this->assertEquals('bar', $dot->get('foo'));
  29. }
  30. public function testConstructWithString()
  31. {
  32. $dot = new Dot('foobar');
  33. $this->assertEquals('foobar', $dot->get(0));
  34. }
  35. public function testConstructWithDot()
  36. {
  37. $dot1 = new Dot(['foo' => 'bar']);
  38. $dot2 = new Dot($dot1);
  39. $this->assertEquals('bar', $dot2->get('foo'));
  40. }
  41. public function testConstructHelper()
  42. {
  43. $dot = dot(['foo' => 'bar']);
  44. $this->assertInstanceOf(Dot::class, $dot);
  45. $this->assertEquals('bar', $dot->get('foo'));
  46. }
  47. /*
  48. * --------------------------------------------------------------
  49. * Add
  50. * --------------------------------------------------------------
  51. */
  52. public function testAddKeyValuePair()
  53. {
  54. $dot = new Dot;
  55. $dot->add('foo.bar', 'baz');
  56. $this->assertEquals('baz', $dot->get('foo.bar'));
  57. }
  58. public function testAddKeyValuePairWithCustomDelimeter()
  59. {
  60. $dot = new Dot([], '/');
  61. $dot->add('foo/bar', 'baz');
  62. $this->assertEquals('baz', $dot->get('foo/bar'));
  63. }
  64. public function testAddValueToExistingKey()
  65. {
  66. $dot = new Dot(['foo' => 'bar']);
  67. $dot->add('foo', 'baz');
  68. $this->assertEquals('bar', $dot->get('foo'));
  69. }
  70. public function testAddArrayOfKeyValuePairs()
  71. {
  72. $dot = new Dot(['foobar' => 'baz']);
  73. $dot->add([
  74. 'foobar' => 'qux',
  75. 'corge' => 'grault'
  76. ]);
  77. $this->assertSame(['foobar' => 'baz', 'corge' => 'grault'], $dot->all());
  78. }
  79. /*
  80. * --------------------------------------------------------------
  81. * All
  82. * --------------------------------------------------------------
  83. */
  84. public function testAllReturnsAllItems()
  85. {
  86. $dot = new Dot(['foo' => 'bar']);
  87. $this->assertSame(['foo' => 'bar'], $dot->all());
  88. }
  89. /*
  90. * --------------------------------------------------------------
  91. * Clear
  92. * --------------------------------------------------------------
  93. */
  94. public function testClearKey()
  95. {
  96. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  97. $dot->clear('foo.bar');
  98. $this->assertSame([], $dot->get('foo.bar'));
  99. }
  100. public function testClearKeyWithCustomDelimiter()
  101. {
  102. $dot = new Dot(['foo' => ['bar' => 'baz']], '/');
  103. $dot->clear('foo/bar');
  104. $this->assertSame([], $dot->get('foo/bar'));
  105. }
  106. public function testClearNonExistingKey()
  107. {
  108. $dot = new Dot;
  109. $dot->clear('foo');
  110. $this->assertSame([], $dot->get('foo'));
  111. }
  112. public function testClearArrayOfKeys()
  113. {
  114. $dot = new Dot(['foo' => 'bar', 'baz' => 'qux']);
  115. $dot->clear(['foo', 'baz']);
  116. $this->assertSame(['foo' => [], 'baz' => []], $dot->all());
  117. }
  118. public function testClearAll()
  119. {
  120. $dot = new Dot(['foo' => 'bar']);
  121. $dot->clear();
  122. $this->assertSame([], $dot->all());
  123. }
  124. /*
  125. * --------------------------------------------------------------
  126. * Delete
  127. * --------------------------------------------------------------
  128. */
  129. public function testDeleteKey()
  130. {
  131. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  132. $dot->delete('foo.bar');
  133. $this->assertFalse($dot->has('foo.bar'));
  134. }
  135. public function testDeleteKeyWithCustomDelimeter()
  136. {
  137. $dot = new Dot(['foo' => ['bar' => 'baz']], '/');
  138. $dot->delete('foo/bar');
  139. $this->assertFalse($dot->has('foo/bar'));
  140. }
  141. public function testDeleteNonExistingKey()
  142. {
  143. $dot = new Dot(['foo' => 'bar']);
  144. $dot->delete('baz.qux');
  145. $this->assertSame(['foo' => 'bar'], $dot->all());
  146. }
  147. public function testDeleteArrayOfKeys()
  148. {
  149. $dot = new Dot(['foo' => 'bar', 'baz' => 'qux']);
  150. $dot->delete(['foo', 'baz']);
  151. $this->assertSame([], $dot->all());
  152. }
  153. /*
  154. * --------------------------------------------------------------
  155. * Flatten
  156. * --------------------------------------------------------------
  157. */
  158. public function testFlatten()
  159. {
  160. $dot = new Dot(['foo' => ['abc' => 'xyz', 'bar' => ['baz']]]);
  161. $flatten = $dot->flatten();
  162. $this->assertEquals('xyz', $flatten['foo.abc']);
  163. $this->assertEquals('baz', $flatten['foo.bar.0']);
  164. }
  165. public function testFlattenWithCustomDelimiter()
  166. {
  167. $dot = new Dot(['foo' => ['abc' => 'xyz', 'bar' => ['baz']]], '/');
  168. $flatten = $dot->flatten();
  169. $this->assertEquals('xyz', $flatten['foo/abc']);
  170. $this->assertEquals('baz', $flatten['foo/bar/0']);
  171. }
  172. public function testFlattenWithDoubleCustomDelimiter()
  173. {
  174. $dot = new Dot(['foo' => ['abc' => 'xyz', 'bar' => ['baz']]], '/');
  175. $flatten = $dot->flatten('_');
  176. $this->assertEquals('xyz', $flatten['foo_abc']);
  177. $this->assertEquals('baz', $flatten['foo_bar_0']);
  178. }
  179. /*
  180. * --------------------------------------------------------------
  181. * Get
  182. * --------------------------------------------------------------
  183. */
  184. public function testGetValueFromKey()
  185. {
  186. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  187. $this->assertEquals('baz', $dot->get('foo.bar'));
  188. }
  189. public function testGetValueFromNonExistingKey()
  190. {
  191. $dot = new Dot;
  192. $this->assertNull($dot->get('foo'));
  193. }
  194. public function testGetGivenDefaultValueFromNonExistingKey()
  195. {
  196. $dot = new Dot;
  197. $this->assertEquals('bar', $dot->get('foo', 'bar'));
  198. }
  199. /*
  200. * --------------------------------------------------------------
  201. * Has
  202. * --------------------------------------------------------------
  203. */
  204. public function testHasKey()
  205. {
  206. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  207. $this->assertTrue($dot->has('foo.bar'));
  208. $dot->delete('foo.bar');
  209. $this->assertFalse($dot->has('foo.bar'));
  210. }
  211. public function testHasArrayOfKeys()
  212. {
  213. $dot = new Dot(['foo' => 'bar', 'baz' => 'qux']);
  214. $this->assertTrue($dot->has(['foo', 'baz']));
  215. $dot->delete('foo');
  216. $this->assertFalse($dot->has(['foo', 'baz']));
  217. }
  218. public function testHasWithEmptyDot()
  219. {
  220. $dot = new Dot;
  221. $this->assertFalse($dot->has('foo'));
  222. }
  223. /*
  224. * --------------------------------------------------------------
  225. * Is empty
  226. * --------------------------------------------------------------
  227. */
  228. public function testIsEmptyDot()
  229. {
  230. $dot = new Dot;
  231. $this->assertTrue($dot->isEmpty());
  232. $dot->set('foo', 'bar');
  233. $this->assertFalse($dot->isEmpty());
  234. }
  235. public function testIsEmptyKey()
  236. {
  237. $dot = new Dot;
  238. $this->assertTrue($dot->isEmpty('foo.bar'));
  239. $dot->set('foo.bar', 'baz');
  240. $this->assertFalse($dot->isEmpty('foo.bar'));
  241. }
  242. public function testIsEmptyArrayOfKeys()
  243. {
  244. $dot = new Dot;
  245. $this->assertTrue($dot->isEmpty(['foo', 'bar']));
  246. $dot->set('foo', 'baz');
  247. $this->assertFalse($dot->isEmpty(['foo', 'bar']));
  248. }
  249. /*
  250. * --------------------------------------------------------------
  251. * Merge
  252. * --------------------------------------------------------------
  253. */
  254. public function testMergeArrayWithDot()
  255. {
  256. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  257. $dot->merge(['foo' => ['bar' => 'qux']]);
  258. $this->assertEquals('qux', $dot->get('foo.bar'));
  259. }
  260. public function testMergeArrayWithKey()
  261. {
  262. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  263. $dot->merge('foo', ['bar' => 'qux']);
  264. $this->assertEquals('qux', $dot->get('foo.bar'));
  265. }
  266. public function testMergeDotWithDot()
  267. {
  268. $dot1 = new Dot(['foo' => ['bar' => 'baz']]);
  269. $dot2 = new Dot(['foo' => ['bar' => 'qux']]);
  270. $dot1->merge($dot2);
  271. $this->assertEquals('qux', $dot1->get('foo.bar'));
  272. }
  273. public function testMergeDotObjectWithKey()
  274. {
  275. $dot1 = new Dot(['foo' => ['bar' => 'baz']]);
  276. $dot2 = new Dot(['bar' => 'qux']);
  277. $dot1->merge('foo', $dot2);
  278. $this->assertEquals('qux', $dot1->get('foo.bar'));
  279. }
  280. /*
  281. * --------------------------------------------------------------
  282. * Recursive merge
  283. * --------------------------------------------------------------
  284. */
  285. public function testRecursiveMergeArrayWithDot()
  286. {
  287. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  288. $dot->mergeRecursive(['foo' => ['bar' => 'qux', 'quux' => 'quuz']]);
  289. $this->assertEquals(['baz', 'qux'], $dot->get('foo.bar'));
  290. $this->assertEquals('quuz', $dot->get('foo.quux'));
  291. }
  292. public function testRecursiveMergeArrayWithKey()
  293. {
  294. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  295. $dot->mergeRecursive('foo', ['bar' => 'qux', 'quux' => 'quuz']);
  296. $this->assertEquals(['baz', 'qux'], $dot->get('foo.bar'));
  297. $this->assertEquals('quuz', $dot->get('foo.quux'));
  298. }
  299. public function testRecursiveMergeDotWithDot()
  300. {
  301. $dot1 = new Dot(['foo' => ['bar' => 'baz']]);
  302. $dot2 = new Dot(['foo' => ['bar' => 'qux', 'quux' => 'quuz']]);
  303. $dot1->mergeRecursive($dot2);
  304. $this->assertEquals(['baz', 'qux'], $dot1->get('foo.bar'));
  305. $this->assertEquals('quuz', $dot1->get('foo.quux'));
  306. }
  307. public function testRecursiveMergeDotObjectWithKey()
  308. {
  309. $dot1 = new Dot(['foo' => ['bar' => 'baz']]);
  310. $dot2 = new Dot(['bar' => 'qux', 'quux' => 'quuz']);
  311. $dot1->mergeRecursive('foo', $dot2);
  312. $this->assertEquals(['baz', 'qux'], $dot1->get('foo.bar'));
  313. $this->assertEquals('quuz', $dot1->get('foo.quux'));
  314. }
  315. /*
  316. * --------------------------------------------------------------
  317. * Recursive distinct merge
  318. * --------------------------------------------------------------
  319. */
  320. public function testRecursiveDistinctMergeArrayWithDot()
  321. {
  322. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  323. $dot->mergeRecursiveDistinct(['foo' => ['bar' => 'qux', 'quux' => 'quuz']]);
  324. $this->assertEquals('qux', $dot->get('foo.bar'));
  325. $this->assertEquals('quuz', $dot->get('foo.quux'));
  326. }
  327. public function testRecursiveDistinctMergeArrayWithKey()
  328. {
  329. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  330. $dot->mergeRecursiveDistinct('foo', ['bar' => 'qux', 'quux' => 'quuz']);
  331. $this->assertEquals('qux', $dot->get('foo.bar'));
  332. $this->assertEquals('quuz', $dot->get('foo.quux'));
  333. }
  334. public function testRecursiveDistinctMergeDotWithDot()
  335. {
  336. $dot1 = new Dot(['foo' => ['bar' => 'baz']]);
  337. $dot2 = new Dot(['foo' => ['bar' => 'qux', 'quux' => 'quuz']]);
  338. $dot1->mergeRecursiveDistinct($dot2);
  339. $this->assertEquals('qux', $dot1->get('foo.bar'));
  340. $this->assertEquals('quuz', $dot1->get('foo.quux'));
  341. }
  342. public function testRecursiveDistinctMergeDotObjectWithKey()
  343. {
  344. $dot1 = new Dot(['foo' => ['bar' => 'baz']]);
  345. $dot2 = new Dot(['bar' => 'qux', 'quux' => 'quuz']);
  346. $dot1->mergeRecursiveDistinct('foo', $dot2);
  347. $this->assertEquals('qux', $dot1->get('foo.bar'));
  348. $this->assertEquals('quuz', $dot1->get('foo.quux'));
  349. }
  350. /*
  351. * --------------------------------------------------------------
  352. * Pull
  353. * --------------------------------------------------------------
  354. */
  355. public function testPullKey()
  356. {
  357. $dot = new Dot(['foo' => 'bar']);
  358. $this->assertEquals('bar', $dot->pull('foo'));
  359. $this->assertFalse($dot->has('foo'));
  360. }
  361. public function testPullNonExistingKey()
  362. {
  363. $dot = new Dot;
  364. $this->assertNull($dot->pull('foo'));
  365. }
  366. public function testPullNonExistingKeyWithDefaultValue()
  367. {
  368. $dot = new Dot;
  369. $this->assertEquals('bar', $dot->pull('foo', 'bar'));
  370. }
  371. public function testPullAll()
  372. {
  373. $dot = new Dot(['foo' => 'bar']);
  374. $this->assertSame(['foo' => 'bar'], $dot->pull());
  375. $this->assertSame([], $dot->all());
  376. }
  377. /*
  378. * --------------------------------------------------------------
  379. * Push
  380. * --------------------------------------------------------------
  381. */
  382. public function testPushValue()
  383. {
  384. $dot = new Dot;
  385. $dot->push('foo');
  386. $this->assertEquals('foo', $dot->get(0));
  387. }
  388. public function testPushValueToKey()
  389. {
  390. $dot = new Dot(['foo' => [0 => 'bar']]);
  391. $dot->push('foo', 'baz');
  392. $this->assertSame(['bar', 'baz'], $dot->get('foo'));
  393. }
  394. /*
  395. * --------------------------------------------------------------
  396. * Replace
  397. * --------------------------------------------------------------
  398. */
  399. public function testReplaceWithArray()
  400. {
  401. $dot = new Dot(['foo' => ['bar' => 'baz']]);
  402. $dot->replace(['foo' => ['qux' => 'quux']]);
  403. $this->assertEquals(['qux' => 'quux'], $dot->get('foo'));
  404. }
  405. public function testReplaceKeyWithArray()
  406. {
  407. $dot = new Dot(['foo' => ['bar' => 'baz', 'qux' => 'quux']]);
  408. $dot->replace('foo', ['qux' => 'corge']);
  409. $this->assertEquals(['bar' => 'baz', 'qux' => 'corge'], $dot->get('foo'));
  410. }
  411. public function testReplaceWithDot()
  412. {
  413. $dot1 = new Dot(['foo' => ['bar' => 'baz']]);
  414. $dot2 = new Dot(['foo' => ['bar' => 'qux']]);
  415. $dot1->replace($dot2);
  416. $this->assertEquals(['bar' => 'qux'], $dot1->get('foo'));
  417. }
  418. public function testReplaceKeyWithDot()
  419. {
  420. $dot1 = new Dot(['foo' => ['bar' => 'baz', 'qux' => 'quux']]);
  421. $dot2 = new Dot(['qux' => 'corge']);
  422. $dot1->merge('foo', $dot2);
  423. $this->assertEquals(['bar' => 'baz', 'qux' => 'corge'], $dot1->get('foo'));
  424. }
  425. /*
  426. * --------------------------------------------------------------
  427. * Set
  428. * --------------------------------------------------------------
  429. */
  430. public function testSetKeyValuePair()
  431. {
  432. $dot = new Dot;
  433. $dot->set('foo.bar', 'baz');
  434. $this->assertEquals('baz', $dot->get('foo.bar'));
  435. }
  436. public function testSetKeyValuePairWithCustomDelimiter()
  437. {
  438. $dot = new Dot([], '/');
  439. $dot->set('foo/bar', 'baz');
  440. $this->assertEquals('baz', $dot->get('foo/bar'));
  441. }
  442. public function testSetArrayOfKeyValuePairs()
  443. {
  444. $dot = new Dot;
  445. $dot->set(['foo' => 'bar', 'baz' => 'qux']);
  446. $this->assertSame(['foo' => 'bar', 'baz' => 'qux'], $dot->all());
  447. }
  448. /*
  449. * --------------------------------------------------------------
  450. * Set array
  451. * --------------------------------------------------------------
  452. */
  453. public function testSetArray()
  454. {
  455. $dot = new Dot;
  456. $dot->setArray(['foo' => 'bar']);
  457. $this->assertSame(['foo' => 'bar'], $dot->all());
  458. }
  459. /*
  460. * --------------------------------------------------------------
  461. * Set reference
  462. * --------------------------------------------------------------
  463. */
  464. public function testSetReference()
  465. {
  466. $dot = new Dot;
  467. $items = ['foo' => 'bar'];
  468. $dot->setReference($items);
  469. $dot->set('foo', 'baz');
  470. $this->assertEquals('baz', $items['foo']);
  471. }
  472. /*
  473. * --------------------------------------------------------------
  474. * ArrayAccess interface
  475. * --------------------------------------------------------------
  476. */
  477. public function testOffsetExists()
  478. {
  479. $dot = new Dot(['foo' => 'bar']);
  480. $this->assertTrue(isset($dot['foo']));
  481. unset($dot['foo']);
  482. $this->assertFalse(isset($dot['foo']));
  483. }
  484. public function testOffsetGet()
  485. {
  486. $dot = new Dot(['foo' => 'bar']);
  487. $this->assertEquals('bar', $dot['foo']);
  488. }
  489. public function testOffsetSet()
  490. {
  491. $dot = new Dot;
  492. $dot['foo.bar'] = 'baz';
  493. $this->assertEquals('baz', $dot['foo.bar']);
  494. }
  495. public function testOffsetSetWithoutKey()
  496. {
  497. $dot = new Dot;
  498. $dot[] = 'foobar';
  499. $this->assertEquals('foobar', $dot->get(0));
  500. }
  501. public function testOffsetUnset()
  502. {
  503. $dot = new Dot(['foo' => 'bar']);
  504. unset($dot['foo']);
  505. $this->assertFalse(isset($dot['foo']));
  506. }
  507. /*
  508. * --------------------------------------------------------------
  509. * To JSON
  510. * --------------------------------------------------------------
  511. */
  512. public function testToJsonAll()
  513. {
  514. $dot = new Dot(['foo' => 'bar']);
  515. $this->assertJsonStringEqualsJsonString(
  516. json_encode(['foo' => 'bar']),
  517. $dot->toJson()
  518. );
  519. }
  520. public function testToJsonAllWithOption()
  521. {
  522. $dot = new Dot(['foo' => "'bar'"]);
  523. $this->assertJsonStringEqualsJsonString(
  524. json_encode(['foo' => "'bar'"], JSON_HEX_APOS),
  525. $dot->toJson(JSON_HEX_APOS)
  526. );
  527. }
  528. public function testToJsonKey()
  529. {
  530. $dot = new Dot(['foo' => ['bar' => 'value']]);
  531. $this->assertJsonStringEqualsJsonString(
  532. json_encode(['bar' => "value"]),
  533. $dot->toJson('foo')
  534. );
  535. }
  536. public function testToJsonKeyWithOptions()
  537. {
  538. $dot = new Dot(['foo' => ['bar' => "'value'"]]);
  539. $this->assertEquals(
  540. json_encode(['bar' => "'value'"], JSON_HEX_APOS),
  541. $dot->toJson('foo', JSON_HEX_APOS)
  542. );
  543. }
  544. /*
  545. * --------------------------------------------------------------
  546. * Countable interface
  547. * --------------------------------------------------------------
  548. */
  549. public function testCount()
  550. {
  551. $dot = new Dot([1, 2, 3]);
  552. $this->assertEquals(3, $dot->count());
  553. }
  554. public function testCountable()
  555. {
  556. $dot = new Dot([1, 2, 3]);
  557. $this->assertCount(3, $dot);
  558. }
  559. /*
  560. * --------------------------------------------------------------
  561. * IteratorAggregate interface
  562. * --------------------------------------------------------------
  563. */
  564. public function testGetIteratorReturnsArrayIterator()
  565. {
  566. $dot = new Dot;
  567. $this->assertInstanceOf(ArrayIterator::class, $dot->getIterator());
  568. }
  569. public function testIterationReturnsOriginalValues()
  570. {
  571. $dot = new Dot([1, 2, 3]);
  572. foreach ($dot as $item) {
  573. $items[] = $item;
  574. }
  575. $this->assertSame([1, 2, 3], $items);
  576. }
  577. /*
  578. * --------------------------------------------------------------
  579. * JsonSerializable interface
  580. * --------------------------------------------------------------
  581. */
  582. public function testJsonEncodingReturnsJson()
  583. {
  584. $dot = new Dot(['foo' => 'bar']);
  585. $this->assertJsonStringEqualsJsonString(
  586. json_encode(['foo' => 'bar']),
  587. json_encode($dot)
  588. );
  589. }
  590. }