|
@@ 568-590 (lines=23) @@
|
| 565 |
|
$this->assertEquals($attributes['id'], $formelement->id); |
| 566 |
|
} |
| 567 |
|
|
| 568 |
|
public function testAddElementToCertainPosition() |
| 569 |
|
{ |
| 570 |
|
// PREPARE: |
| 571 |
|
// this will take position 0 |
| 572 |
|
$this->form->addElement('File'); |
| 573 |
|
// this will take position 1 |
| 574 |
|
$this->form->addElement('Captcha'); |
| 575 |
|
|
| 576 |
|
// TEST: |
| 577 |
|
// this will take position 0 + reorders the array |
| 578 |
|
$this->form->addElement('Text', null, 0); |
| 579 |
|
|
| 580 |
|
$array = []; |
| 581 |
|
$array[] = new Elements\Text(); // 0 - Text |
| 582 |
|
$array[] = new Elements\File(); // 1 - File |
| 583 |
|
$array[] = new Elements\Captcha(); // 2 - Captcha |
| 584 |
|
// manually reapply formelement identifiers |
| 585 |
|
$array['0']->setID('text-formelement-0'); |
| 586 |
|
$array['1']->setID('file-formelement-1'); |
| 587 |
|
$array['2']->setID('captcha-formelement-2'); |
| 588 |
|
|
| 589 |
|
$this->assertEquals($array, $this->form->getFormelements()); |
| 590 |
|
} |
| 591 |
|
|
| 592 |
|
public function testAddElementSwitchEncodingWhenUsingFormelementFile() |
| 593 |
|
{ |
|
@@ 599-621 (lines=23) @@
|
| 596 |
|
$this->assertContains('enctype="multipart/form-data"', $this->form->render()); |
| 597 |
|
} |
| 598 |
|
|
| 599 |
|
public function testregenerateFormelementIdentifiers() |
| 600 |
|
{ |
| 601 |
|
// PREPARE: |
| 602 |
|
// this will take position 0 |
| 603 |
|
$this->form->addElement('File'); |
| 604 |
|
// this will take position 1 |
| 605 |
|
$this->form->addElement('Captcha'); |
| 606 |
|
|
| 607 |
|
// TEST: |
| 608 |
|
// this will take position 0 and reorder the array |
| 609 |
|
$this->form->addElement('Text', null, 0); |
| 610 |
|
|
| 611 |
|
$array = []; |
| 612 |
|
$array[] = new \Koch\Form\Elements\Text(); // 0 - Text |
| 613 |
|
$array[] = new \Koch\Form\Elements\File(); // 1 - File |
| 614 |
|
$array[] = new \Koch\Form\Elements\Captcha(); // 2 - Captcha |
| 615 |
|
// manually reapply formelement identifiers |
| 616 |
|
$array['0']->setID('text-formelement-0'); |
| 617 |
|
$array['1']->setID('file-formelement-1'); |
| 618 |
|
$array['2']->setID('captcha-formelement-2'); |
| 619 |
|
|
| 620 |
|
$this->assertEquals($array, $this->form->getFormelements()); |
| 621 |
|
} |
| 622 |
|
|
| 623 |
|
public function testDelElementByName() |
| 624 |
|
{ |