File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PHPForm \Unit \Widgets ;
3+
4+ use PHPUnit \Framework \TestCase ;
5+
6+ use PHPForm \Widgets \Widget ;
7+
8+ class WidgetTest extends TestCase
9+ {
10+ public function setUp ()
11+ {
12+ $ this ->widget = $ this ->getMockForAbstractClass (Widget::class);
13+ }
14+
15+ public function testGetOptions ()
16+ {
17+ $ options = $ this ->widget ->getOptions ("name " , "value " );
18+ $ this ->assertEquals (array (), $ options );
19+ }
20+
21+ public function testValueFromData ()
22+ {
23+ $ result = $ this ->widget ->valueFromData (array ("name " => "value " ), array (), "name " );
24+ $ this ->assertEquals ("value " , $ result );
25+ }
26+
27+ public function testValueFromDataInexistent ()
28+ {
29+ $ result = $ this ->widget ->valueFromData (array (), array (), "name " );
30+ $ this ->assertNull ($ result );
31+ }
32+
33+ public function testBuildAutoId ()
34+ {
35+ $ this ->assertEquals ("id_name " , $ this ->widget ->buildAutoId ("name " ));
36+ $ this ->assertEquals ("id_name_1 " , $ this ->widget ->buildAutoId ("name " , 1 ));
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments