@@ -56,16 +56,42 @@ public function testGetErrors()
5656 {
5757 $ form = $ this ->getMockForAbstractClass (Form::class);
5858 $ bound = new BoundField ($ form , $ this ->simple_field , "name " );
59+
5960 $ this ->assertInstanceOf (ErrorList::class, $ bound ->errors );
6061 }
6162
62- public function testHasErrors ()
63+ public function testGetHasErrors ()
6364 {
6465 $ form = $ this ->getMockForAbstractClass (Form::class);
6566 $ bound = new BoundField ($ form , $ this ->simple_field , "name " );
67+
6668 $ this ->assertFalse ($ bound ->has_errors );
6769 }
6870
71+ public function testGetIsRequired ()
72+ {
73+ $ form = $ this ->getMockForAbstractClass (Form::class);
74+ $ bound = new BoundField ($ form , $ this ->simple_field , "name " );
75+
76+ $ this ->assertFalse ($ bound ->is_required );
77+ }
78+
79+ public function testGetValue ()
80+ {
81+ $ form = $ this ->getMockForAbstractClass (Form::class);
82+ $ bound = new BoundField ($ form , $ this ->simple_field , "name " );
83+
84+ $ this ->assertNull ($ bound ->value );
85+ }
86+
87+ public function testGetNotDefinedAttribute ()
88+ {
89+ $ form = $ this ->getMockForAbstractClass (Form::class);
90+ $ bound = new BoundField ($ form , $ this ->simple_field , "name " );
91+
92+ $ this ->assertNull ($ bound ->undefined );
93+ }
94+
6995 public function testSimpleGet ()
7096 {
7197 $ form = $ this ->getMockForAbstractClass (Form::class);
@@ -123,12 +149,26 @@ public function testToStringWithErrors()
123149 $ this ->assertXmlStringEqualsXmlString ($ expected , (string ) $ bound );
124150 }
125151
152+ public function testToStringWithFieldRequired ()
153+ {
154+ $ form = $ this ->getMockForAbstractClass (Form::class);
155+ $ field = new CharField (['disabled ' => true ]);
156+
157+ $ bound = new BoundField ($ form , $ field , "name " );
158+
159+ $ expected = '<input type="text" id="id_name" name="name" disabled="disabled"/> ' ;
160+ $ this ->assertXmlStringEqualsXmlString ($ expected , (string ) $ bound );
161+ }
162+
126163 public function testLabelTag ()
127164 {
128165 $ field = new CharField (array ("label " => "Label " ));
129166 $ bound = new BoundField ($ this ->simple_form , $ field , "name " );
167+
130168 $ expected = '<label for="id_name">Label</label> ' ;
169+
131170 $ this ->assertXmlStringEqualsXmlString ($ bound ->labelTag (), $ expected );
171+ $ this ->assertXmlStringEqualsXmlString ($ bound ->label_tag , $ expected );
132172 }
133173
134174 public function testLabelTagWithPrefix ()
0 commit comments