File tree Expand file tree Collapse file tree 7 files changed +66
-45
lines changed
Expand file tree Collapse file tree 7 files changed +66
-45
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,7 @@ name: docs-build
33on :
44 release :
55 types : [published]
6- repository_dispatch :
7- types : docs-build
6+ workflow_dispatch :
87
98jobs :
109 build-deploy :
1312 - name : Build Docs
1413 uses : laminas/documentation-theme/github-actions/docs@master
1514 env :
16- " DOCS_DEPLOY_KEY " : ${{ secrets.DOCS_DEPLOY_KEY }}
17- " GITHUB_TOKEN " : ${{ secrets.GITHUB_TOKEN }}
15+ DEPLOY_TOKEN : ${{ secrets.GITHUB_TOKEN }}
16+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 99use Laminas \Form \Exception ;
1010use Locale ;
1111
12- use function assert ;
1312use function extension_loaded ;
1413use function method_exists ;
1514use function preg_split ;
@@ -224,12 +223,13 @@ protected function getSelectElementHelper(): FormSelect
224223 return $ this ->selectHelper ;
225224 }
226225
227- if (method_exists ($ this ->view , 'plugin ' )) {
228- $ selectHelper = $ this ->view ->plugin ('formselect ' );
229- assert ($ selectHelper instanceof FormSelect);
230- $ this ->selectHelper = $ selectHelper ;
226+ if (null !== $ this ->view && method_exists ($ this ->view , 'plugin ' )) {
227+ $ this ->selectHelper = $ this ->view ->plugin ('formselect ' );
228+ }
229+
230+ if (null === $ this ->selectHelper ) {
231+ $ this ->selectHelper = new FormSelect ();
231232 }
232- assert (null !== $ this ->selectHelper );
233233
234234 return $ this ->selectHelper ;
235235 }
Original file line number Diff line number Diff line change @@ -393,11 +393,11 @@ protected function getInputHelper(): FormInput
393393 return $ this ->inputHelper ;
394394 }
395395
396- if (method_exists ($ this ->view , 'plugin ' )) {
396+ if (null !== $ this -> view && method_exists ($ this ->view , 'plugin ' )) {
397397 $ this ->inputHelper = $ this ->view ->plugin ('form_input ' );
398398 }
399399
400- if (! $ this ->inputHelper instanceof FormInput ) {
400+ if (null === $ this ->inputHelper ) {
401401 $ this ->inputHelper = new FormInput ();
402402 }
403403
Original file line number Diff line number Diff line change @@ -297,14 +297,16 @@ protected function renderHiddenElement(SelectElement $element): string
297297
298298 protected function getFormHiddenHelper (): FormHidden
299299 {
300- if (! $ this ->formHiddenHelper ) {
301- if (method_exists ($ this ->view , 'plugin ' )) {
302- $ this ->formHiddenHelper = $ this ->view ->plugin ('formhidden ' );
303- }
300+ if (null !== $ this ->formHiddenHelper ) {
301+ return $ this ->formHiddenHelper ;
302+ }
304303
305- if (! $ this ->formHiddenHelper instanceof FormHidden) {
306- $ this ->formHiddenHelper = new FormHidden ();
307- }
304+ if (null !== $ this ->view && method_exists ($ this ->view , 'plugin ' )) {
305+ $ this ->formHiddenHelper = $ this ->view ->plugin ('formhidden ' );
306+ }
307+
308+ if (null === $ this ->formHiddenHelper ) {
309+ $ this ->formHiddenHelper = new FormHidden ();
308310 }
309311
310312 return $ this ->formHiddenHelper ;
Original file line number Diff line number Diff line change @@ -44,6 +44,16 @@ public function testGeneratesThreeSelectsWithElement(): void
4444 self ::assertStringContainsString ('<select name="year" ' , $ markup );
4545 }
4646
47+ public function testGeneratesWithoutRenderer (): void
48+ {
49+ $ element = new DateSelect ('foo ' );
50+ $ helper = new FormDateSelectHelper ();
51+ $ markup = $ helper ->render ($ element );
52+ self ::assertStringContainsString ('<select name="day" ' , $ markup );
53+ self ::assertStringContainsString ('<select name="month" ' , $ markup );
54+ self ::assertStringContainsString ('<select name="year" ' , $ markup );
55+ }
56+
4757 public function testCanGenerateSelectsWithEmptyOption (): void
4858 {
4959 $ element = new DateSelect ('foo ' );
Original file line number Diff line number Diff line change @@ -395,6 +395,16 @@ public function testHiddenElementWhenAttributeMultipleIsSet(): void
395395 self ::assertStringContainsString ('<input type="hidden" name="foo" value="empty"><select ' , $ markup );
396396 }
397397
398+ public function testHiddenElementWhenNoRenderer (): void
399+ {
400+ $ element = new SelectElement ('foo ' );
401+ $ element ->setUseHiddenElement (true );
402+ $ element ->setUnselectedValue ('empty ' );
403+ $ helper = new FormSelectHelper ();
404+ $ markup = $ helper ->render ($ element );
405+ self ::assertStringContainsString ('<input type="hidden" name="foo" value="empty"><select ' , $ markup );
406+ }
407+
398408 public function testRenderInputNotSelectElementRaisesException (): void
399409 {
400410 $ element = new Element \Text ('foo ' );
You can’t perform that action at this time.
0 commit comments