MultiCheckboxWidgetTest.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Test\TestCase\View\Widget;
  16. use Cake\TestSuite\TestCase;
  17. use Cake\View\StringTemplate;
  18. use Cake\View\Widget\LabelWidget;
  19. use Cake\View\Widget\MultiCheckboxWidget;
  20. use Cake\View\Widget\NestingLabelWidget;
  21. /**
  22. * MultiCheckbox test case.
  23. */
  24. class MultiCheckboxWidgetTest extends TestCase
  25. {
  26. /**
  27. * setup method.
  28. *
  29. * @return void
  30. */
  31. public function setUp()
  32. {
  33. parent::setUp();
  34. $templates = [
  35. 'checkbox' => '<input type="checkbox" name="{{name}}" value="{{value}}"{{attrs}}>',
  36. 'label' => '<label{{attrs}}>{{text}}</label>',
  37. 'nestingLabel' => '<label{{attrs}}>{{input}}{{text}}</label>',
  38. 'checkboxWrapper' => '<div class="checkbox">{{input}}{{label}}</div>',
  39. 'multicheckboxWrapper' => '<fieldset{{attrs}}>{{content}}</fieldset>',
  40. 'multicheckboxTitle' => '<legend>{{text}}</legend>',
  41. ];
  42. $this->templates = new StringTemplate($templates);
  43. $this->context = $this->getMockBuilder('Cake\View\Form\ContextInterface')->getMock();
  44. }
  45. /**
  46. * Test render simple option sets.
  47. *
  48. * @return void
  49. */
  50. public function testRenderSimple()
  51. {
  52. $label = new LabelWidget($this->templates);
  53. $input = new MultiCheckboxWidget($this->templates, $label);
  54. $data = [
  55. 'name' => 'Tags[id]',
  56. 'options' => [
  57. 1 => 'CakePHP',
  58. 2 => 'Development',
  59. ],
  60. ];
  61. $result = $input->render($data, $this->context);
  62. $expected = [
  63. ['div' => ['class' => 'checkbox']],
  64. ['input' => [
  65. 'type' => 'checkbox',
  66. 'name' => 'Tags[id][]',
  67. 'value' => 1,
  68. 'id' => 'tags-id-1',
  69. ]],
  70. ['label' => ['for' => 'tags-id-1']],
  71. 'CakePHP',
  72. '/label',
  73. '/div',
  74. ['div' => ['class' => 'checkbox']],
  75. ['input' => [
  76. 'type' => 'checkbox',
  77. 'name' => 'Tags[id][]',
  78. 'value' => 2,
  79. 'id' => 'tags-id-2',
  80. ]],
  81. ['label' => ['for' => 'tags-id-2']],
  82. 'Development',
  83. '/label',
  84. '/div',
  85. ];
  86. $this->assertHtml($expected, $result);
  87. }
  88. /**
  89. * Test render complex and additional attributes.
  90. *
  91. * @return void
  92. */
  93. public function testRenderComplex()
  94. {
  95. $label = new LabelWidget($this->templates);
  96. $input = new MultiCheckboxWidget($this->templates, $label);
  97. $data = [
  98. 'name' => 'Tags[id]',
  99. 'val' => 2,
  100. 'disabled' => ['1'],
  101. 'options' => [
  102. ['value' => '1', 'text' => 'CakePHP', 'data-test' => 'val'],
  103. ['value' => '2', 'text' => 'Development', 'class' => 'custom'],
  104. ],
  105. ];
  106. $result = $input->render($data, $this->context);
  107. $expected = [
  108. ['div' => ['class' => 'checkbox']],
  109. ['input' => [
  110. 'disabled' => 'disabled',
  111. 'type' => 'checkbox',
  112. 'name' => 'Tags[id][]',
  113. 'value' => 1,
  114. 'id' => 'tags-id-1',
  115. 'data-test' => 'val',
  116. ]],
  117. ['label' => ['for' => 'tags-id-1']],
  118. 'CakePHP',
  119. '/label',
  120. '/div',
  121. ['div' => ['class' => 'checkbox']],
  122. ['input' => [
  123. 'type' => 'checkbox',
  124. 'checked' => 'checked',
  125. 'name' => 'Tags[id][]',
  126. 'value' => 2,
  127. 'id' => 'tags-id-2',
  128. 'class' => 'custom',
  129. ]],
  130. ['label' => ['class' => 'selected', 'for' => 'tags-id-2']],
  131. 'Development',
  132. '/label',
  133. '/div',
  134. ];
  135. $this->assertHtml($expected, $result);
  136. }
  137. /**
  138. * Test render escpaing options.
  139. *
  140. * @return void
  141. */
  142. public function testRenderEscaping()
  143. {
  144. $label = new LabelWidget($this->templates);
  145. $input = new MultiCheckboxWidget($this->templates, $label);
  146. $data = [
  147. 'name' => 'Tags[id]',
  148. 'options' => [
  149. '>' => '>>',
  150. ],
  151. ];
  152. $result = $input->render($data, $this->context);
  153. $expected = [
  154. ['div' => ['class' => 'checkbox']],
  155. ['input' => [
  156. 'type' => 'checkbox',
  157. 'name' => 'Tags[id][]',
  158. 'value' => '&gt;',
  159. 'id' => 'tags-id',
  160. ]],
  161. ['label' => ['for' => 'tags-id']],
  162. '&gt;&gt;',
  163. '/label',
  164. '/div',
  165. ];
  166. $this->assertHtml($expected, $result);
  167. }
  168. /**
  169. * Test render selected checkboxes.
  170. *
  171. * @return void
  172. */
  173. public function testRenderSelected()
  174. {
  175. $label = new LabelWidget($this->templates);
  176. $input = new MultiCheckboxWidget($this->templates, $label);
  177. $data = [
  178. 'name' => 'Tags[id]',
  179. 'options' => [
  180. 1 => 'CakePHP',
  181. '1x' => 'Development',
  182. ],
  183. 'val' => [1],
  184. 'disabled' => false,
  185. ];
  186. $result = $input->render($data, $this->context);
  187. $expected = [
  188. ['div' => ['class' => 'checkbox']],
  189. ['input' => [
  190. 'type' => 'checkbox',
  191. 'name' => 'Tags[id][]',
  192. 'value' => 1,
  193. 'id' => 'tags-id-1',
  194. 'checked' => 'checked',
  195. ]],
  196. ['label' => ['class' => 'selected', 'for' => 'tags-id-1']],
  197. 'CakePHP',
  198. '/label',
  199. '/div',
  200. ['div' => ['class' => 'checkbox']],
  201. ['input' => [
  202. 'type' => 'checkbox',
  203. 'name' => 'Tags[id][]',
  204. 'value' => '1x',
  205. 'id' => 'tags-id-1x',
  206. ]],
  207. ['label' => ['for' => 'tags-id-1x']],
  208. 'Development',
  209. '/label',
  210. '/div',
  211. ];
  212. $this->assertHtml($expected, $result);
  213. $data['val'] = 1;
  214. $result = $input->render($data, $this->context);
  215. $this->assertHtml($expected, $result);
  216. $data['val'] = '1';
  217. $result = $input->render($data, $this->context);
  218. $this->assertHtml($expected, $result);
  219. }
  220. /**
  221. * Test render disabled checkboxes.
  222. *
  223. * @return void
  224. */
  225. public function testRenderDisabled()
  226. {
  227. $label = new LabelWidget($this->templates);
  228. $input = new MultiCheckboxWidget($this->templates, $label);
  229. $data = [
  230. 'name' => 'Tags[id]',
  231. 'options' => [
  232. 1 => 'CakePHP',
  233. '1x' => 'Development',
  234. ],
  235. 'disabled' => true,
  236. ];
  237. $result = $input->render($data, $this->context);
  238. $expected = [
  239. ['div' => ['class' => 'checkbox']],
  240. ['input' => [
  241. 'type' => 'checkbox',
  242. 'name' => 'Tags[id][]',
  243. 'value' => 1,
  244. 'id' => 'tags-id-1',
  245. 'disabled' => 'disabled',
  246. ]],
  247. ['label' => ['for' => 'tags-id-1']],
  248. 'CakePHP',
  249. '/label',
  250. '/div',
  251. ['div' => ['class' => 'checkbox']],
  252. ['input' => [
  253. 'type' => 'checkbox',
  254. 'name' => 'Tags[id][]',
  255. 'value' => '1x',
  256. 'id' => 'tags-id-1x',
  257. 'disabled' => 'disabled',
  258. ]],
  259. ['label' => ['for' => 'tags-id-1x']],
  260. 'Development',
  261. '/label',
  262. '/div',
  263. ];
  264. $this->assertHtml($expected, $result);
  265. $data['disabled'] = 'a string';
  266. $result = $input->render($data, $this->context);
  267. $this->assertHtml($expected, $result);
  268. $data['disabled'] = ['1', '1x'];
  269. $this->assertHtml($expected, $result);
  270. $data = [
  271. 'name' => 'Tags[id]',
  272. 'options' => [
  273. 1 => 'CakePHP',
  274. '1x' => 'Development',
  275. ],
  276. 'disabled' => [1],
  277. ];
  278. $result = $input->render($data, $this->context);
  279. $expected = [
  280. ['div' => ['class' => 'checkbox']],
  281. ['input' => [
  282. 'type' => 'checkbox',
  283. 'name' => 'Tags[id][]',
  284. 'value' => 1,
  285. 'id' => 'tags-id-1',
  286. 'disabled' => 'disabled',
  287. ]],
  288. ['label' => ['for' => 'tags-id-1']],
  289. 'CakePHP',
  290. '/label',
  291. '/div',
  292. ['div' => ['class' => 'checkbox']],
  293. ['input' => [
  294. 'type' => 'checkbox',
  295. 'name' => 'Tags[id][]',
  296. 'value' => '1x',
  297. 'id' => 'tags-id-1x',
  298. ]],
  299. ['label' => ['for' => 'tags-id-1x']],
  300. 'Development',
  301. '/label',
  302. '/div',
  303. ];
  304. $this->assertHtml($expected, $result);
  305. }
  306. /**
  307. * Test render templateVars
  308. *
  309. * @return void
  310. */
  311. public function testRenderTemplateVars()
  312. {
  313. $templates = [
  314. 'checkbox' => '<input type="checkbox" name="{{name}}" value="{{value}}" data-var="{{inputVar}}" {{attrs}}>',
  315. 'label' => '<label{{attrs}}>{{text}} {{inputVar}}</label>',
  316. 'checkboxWrapper' => '<div class="checkbox" data-wrap="{{wrapVar}}">{{input}}{{label}}</div>',
  317. ];
  318. $this->templates->add($templates);
  319. $label = new LabelWidget($this->templates);
  320. $input = new MultiCheckboxWidget($this->templates, $label);
  321. $data = [
  322. 'name' => 'Tags[id]',
  323. 'options' => [
  324. ['value' => '1', 'text' => 'CakePHP', 'templateVars' => ['inputVar' => 'i-var']],
  325. '1x' => 'Development',
  326. ],
  327. 'templateVars' => ['inputVar' => 'default', 'wrapVar' => 'val'],
  328. ];
  329. $result = $input->render($data, $this->context);
  330. $expected = [
  331. ['div' => ['class' => 'checkbox', 'data-wrap' => 'val']],
  332. ['input' => [
  333. 'type' => 'checkbox',
  334. 'name' => 'Tags[id][]',
  335. 'value' => 1,
  336. 'id' => 'tags-id-1',
  337. 'data-var' => 'i-var',
  338. ]],
  339. ['label' => ['for' => 'tags-id-1']],
  340. 'CakePHP i-var',
  341. '/label',
  342. '/div',
  343. ['div' => ['class' => 'checkbox', 'data-wrap' => 'val']],
  344. ['input' => [
  345. 'type' => 'checkbox',
  346. 'name' => 'Tags[id][]',
  347. 'value' => '1x',
  348. 'id' => 'tags-id-1x',
  349. 'data-var' => 'default',
  350. ]],
  351. ['label' => ['for' => 'tags-id-1x']],
  352. 'Development default',
  353. '/label',
  354. '/div',
  355. ];
  356. $this->assertHtml($expected, $result);
  357. }
  358. /**
  359. * Test label = false with checkboxWrapper option.
  360. *
  361. * @return void
  362. */
  363. public function testNoLabelWithCheckboxWrapperOption()
  364. {
  365. $data = [
  366. 'label' => false,
  367. 'name' => 'test',
  368. 'options' => [
  369. 1 => 'A',
  370. 2 => 'B',
  371. ],
  372. ];
  373. $label = new LabelWidget($this->templates);
  374. $input = new MultiCheckboxWidget($this->templates, $label);
  375. $result = $input->render($data, $this->context);
  376. $expected = [
  377. ['div' => ['class' => 'checkbox']],
  378. ['input' => [
  379. 'type' => 'checkbox',
  380. 'name' => 'test[]',
  381. 'value' => 1,
  382. 'id' => 'test-1',
  383. ]],
  384. ['label' => ['for' => 'test-1']],
  385. 'A',
  386. '/label',
  387. '/div',
  388. ['div' => ['class' => 'checkbox']],
  389. ['input' => [
  390. 'type' => 'checkbox',
  391. 'name' => 'test[]',
  392. 'value' => '2',
  393. 'id' => 'test-2',
  394. ]],
  395. ['label' => ['for' => 'test-2']],
  396. 'B',
  397. '/label',
  398. '/div',
  399. ];
  400. $this->assertHtml($expected, $result);
  401. $templates = [
  402. 'checkboxWrapper' => '<div class="checkbox">{{label}}</div>',
  403. ];
  404. $this->templates->add($templates);
  405. $result = $input->render($data, $this->context);
  406. $expected = [
  407. ['div' => ['class' => 'checkbox']],
  408. ['input' => [
  409. 'type' => 'checkbox',
  410. 'name' => 'test[]',
  411. 'value' => 1,
  412. 'id' => 'test-1',
  413. ]],
  414. '/div',
  415. ['div' => ['class' => 'checkbox']],
  416. ['input' => [
  417. 'type' => 'checkbox',
  418. 'name' => 'test[]',
  419. 'value' => '2',
  420. 'id' => 'test-2',
  421. ]],
  422. '/div',
  423. ];
  424. $this->assertHtml($expected, $result);
  425. }
  426. /**
  427. * Test rendering without input nesting inspite of using NestingLabelWidget
  428. *
  429. * @return void
  430. */
  431. public function testRenderNestingLabelWidgetWithoutInputNesting()
  432. {
  433. $label = new NestingLabelWidget($this->templates);
  434. $input = new MultiCheckboxWidget($this->templates, $label);
  435. $data = [
  436. 'name' => 'tags',
  437. 'label' => [
  438. 'input' => false,
  439. ],
  440. 'options' => [
  441. 1 => 'CakePHP',
  442. ],
  443. ];
  444. $result = $input->render($data, $this->context);
  445. $expected = [
  446. ['div' => ['class' => 'checkbox']],
  447. ['input' => [
  448. 'type' => 'checkbox',
  449. 'name' => 'tags[]',
  450. 'value' => 1,
  451. 'id' => 'tags-1',
  452. ]],
  453. ['label' => ['for' => 'tags-1']],
  454. 'CakePHP',
  455. '/label',
  456. '/div',
  457. ];
  458. $this->assertHtml($expected, $result);
  459. }
  460. /**
  461. * Test render with groupings.
  462. *
  463. * @return void
  464. */
  465. public function testRenderGrouped()
  466. {
  467. $label = new LabelWidget($this->templates);
  468. $input = new MultiCheckboxWidget($this->templates, $label);
  469. $data = [
  470. 'name' => 'Tags[id]',
  471. 'options' => [
  472. 'Group 1' => [
  473. 1 => 'CakePHP',
  474. ],
  475. 'Group 2' => [
  476. 2 => 'Development',
  477. ],
  478. ],
  479. ];
  480. $result = $input->render($data, $this->context);
  481. $expected = [
  482. '<fieldset',
  483. '<legend', 'Group 1', '/legend',
  484. ['div' => ['class' => 'checkbox']],
  485. ['input' => [
  486. 'type' => 'checkbox',
  487. 'name' => 'Tags[id][]',
  488. 'value' => 1,
  489. 'id' => 'tags-id-1',
  490. ]],
  491. ['label' => ['for' => 'tags-id-1']],
  492. 'CakePHP',
  493. '/label',
  494. '/div',
  495. '/fieldset',
  496. '<fieldset',
  497. '<legend', 'Group 2', '/legend',
  498. ['div' => ['class' => 'checkbox']],
  499. ['input' => [
  500. 'type' => 'checkbox',
  501. 'name' => 'Tags[id][]',
  502. 'value' => 2,
  503. 'id' => 'tags-id-2',
  504. ]],
  505. ['label' => ['for' => 'tags-id-2']],
  506. 'Development',
  507. '/label',
  508. '/div',
  509. '/fieldset',
  510. ];
  511. $this->assertHtml($expected, $result);
  512. }
  513. /**
  514. * Test render with partial groupings.
  515. *
  516. * @return void
  517. */
  518. public function testRenderPartialGrouped()
  519. {
  520. $label = new LabelWidget($this->templates);
  521. $input = new MultiCheckboxWidget($this->templates, $label);
  522. $data = [
  523. 'name' => 'Tags[id]',
  524. 'options' => [
  525. 1 => 'PHP',
  526. 'Group 1' => [
  527. 2 => 'CakePHP',
  528. ],
  529. 3 => 'Development',
  530. ],
  531. ];
  532. $result = $input->render($data, $this->context);
  533. $expected = [
  534. ['div' => ['class' => 'checkbox']],
  535. ['input' => [
  536. 'type' => 'checkbox',
  537. 'name' => 'Tags[id][]',
  538. 'value' => 1,
  539. 'id' => 'tags-id-1',
  540. ]],
  541. ['label' => ['for' => 'tags-id-1']],
  542. 'PHP',
  543. '/label',
  544. '/div',
  545. '<fieldset',
  546. '<legend', 'Group 1', '/legend',
  547. ['div' => ['class' => 'checkbox']],
  548. ['input' => [
  549. 'type' => 'checkbox',
  550. 'name' => 'Tags[id][]',
  551. 'value' => 2,
  552. 'id' => 'tags-id-2',
  553. ]],
  554. ['label' => ['for' => 'tags-id-2']],
  555. 'CakePHP',
  556. '/label',
  557. '/div',
  558. '/fieldset',
  559. ['div' => ['class' => 'checkbox']],
  560. ['input' => [
  561. 'type' => 'checkbox',
  562. 'name' => 'Tags[id][]',
  563. 'value' => 3,
  564. 'id' => 'tags-id-3',
  565. ]],
  566. ['label' => ['for' => 'tags-id-3']],
  567. 'Development',
  568. '/label',
  569. '/div',
  570. ];
  571. $this->assertHtml($expected, $result);
  572. }
  573. /**
  574. * testRenderCustomAttributes method
  575. *
  576. * Test render with custom attributes
  577. *
  578. * @return void
  579. */
  580. public function testRenderCustomAttributes()
  581. {
  582. $label = new LabelWidget($this->templates);
  583. $input = new MultiCheckboxWidget($this->templates, $label);
  584. $result = $input->render([
  585. 'name' => 'category',
  586. 'options' => ['1', '2'],
  587. 'class' => 'my-class',
  588. 'data-ref' => 'custom-attr',
  589. ], $this->context);
  590. $expected = [
  591. ['div' => ['class' => 'checkbox']],
  592. [
  593. 'input' => [
  594. 'type' => 'checkbox',
  595. 'name' => 'category[]',
  596. 'value' => '0',
  597. 'id' => 'category-0',
  598. 'class' => 'my-class',
  599. 'data-ref' => 'custom-attr',
  600. ],
  601. ],
  602. ['label' => ['for' => 'category-0']],
  603. '1',
  604. '/label',
  605. '/div',
  606. ['div' => ['class' => 'checkbox']],
  607. [
  608. 'input' => [
  609. 'type' => 'checkbox',
  610. 'name' => 'category[]',
  611. 'value' => '1',
  612. 'id' => 'category-1',
  613. 'class' => 'my-class',
  614. 'data-ref' => 'custom-attr',
  615. ],
  616. ],
  617. ['label' => ['for' => 'category-1']],
  618. '2',
  619. '/label',
  620. '/div',
  621. ];
  622. $this->assertHtml($expected, $result);
  623. }
  624. /**
  625. * testRenderExplicitId method
  626. *
  627. * Test that the id passed is actually used
  628. * Issue: https://github.com/cakephp/cakephp/issues/13342
  629. *
  630. * @return void
  631. */
  632. public function testRenderExplicitId()
  633. {
  634. $label = new LabelWidget($this->templates);
  635. $input = new MultiCheckboxWidget($this->templates, $label);
  636. $data = [
  637. 'name' => 'field',
  638. 'options' => ['value1', 'value2'],
  639. 'id' => 'alternative-id',
  640. 'idPrefix' => 'willBeIgnored',
  641. ];
  642. $result = $input->render($data, $this->context);
  643. $expected = [
  644. [
  645. 'div' => ['class' => 'checkbox'],
  646. 'input' => ['type' => 'checkbox', 'name' => 'field[]', 'value' => '0', 'id' => 'alternative-id-0'],
  647. 'label' => ['for' => 'alternative-id-0'],
  648. ],
  649. 'value1',
  650. '/label',
  651. '/div',
  652. [
  653. 'div' => ['class' => 'checkbox'],
  654. 'input' => ['type' => 'checkbox', 'name' => 'field[]', 'value' => '1', 'id' => 'alternative-id-1'],
  655. 'label' => ['for' => 'alternative-id-1'],
  656. ],
  657. 'value2',
  658. '/label',
  659. '/div',
  660. ];
  661. $this->assertHtml($expected, $result);
  662. $data = [
  663. 'name' => 'field',
  664. 'options' => ['value1', 'value2'],
  665. 'idPrefix' => 'formprefix',
  666. ];
  667. $result = $input->render($data, $this->context);
  668. $expected = [
  669. [
  670. 'div' => ['class' => 'checkbox'],
  671. 'input' => ['type' => 'checkbox', 'name' => 'field[]', 'value' => '0', 'id' => 'formprefix-field-0'],
  672. 'label' => ['for' => 'formprefix-field-0'],
  673. ],
  674. 'value1',
  675. '/label',
  676. '/div',
  677. [
  678. 'div' => ['class' => 'checkbox'],
  679. 'input' => ['type' => 'checkbox', 'name' => 'field[]', 'value' => '1', 'id' => 'formprefix-field-1'],
  680. 'label' => ['for' => 'formprefix-field-1'],
  681. ],
  682. 'value2',
  683. '/label',
  684. '/div',
  685. ];
  686. $this->assertHtml($expected, $result);
  687. }
  688. }