|
@@ 91-103 (lines=13) @@
|
| 88 |
|
$this->assertEquals('Foo', $form->Fields()->fieldByName($field_name)->Title()); |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
public function testInsertBefore() |
| 92 |
|
{ |
| 93 |
|
$form = $this->form->enableSpamProtection(array( |
| 94 |
|
'protector' => 'FormSpamProtectionExtensionTest_FooProtector', |
| 95 |
|
'insertBefore' => 'URL' |
| 96 |
|
)); |
| 97 |
|
|
| 98 |
|
$fields = $form->Fields(); |
| 99 |
|
$this->assertEquals('Title', $fields[0]->Title()); |
| 100 |
|
$this->assertEquals('Comment', $fields[1]->Title()); |
| 101 |
|
$this->assertEquals('Foo', $fields[2]->Title()); |
| 102 |
|
$this->assertEquals('URL', $fields[3]->Title()); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
public function testInsertBeforeMissing() |
| 106 |
|
{ |
|
@@ 105-118 (lines=14) @@
|
| 102 |
|
$this->assertEquals('URL', $fields[3]->Title()); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
public function testInsertBeforeMissing() |
| 106 |
|
{ |
| 107 |
|
$form = $this->form->enableSpamProtection(array( |
| 108 |
|
'protector' => 'FormSpamProtectionExtensionTest_FooProtector', |
| 109 |
|
'insertBefore' => 'NotAField' |
| 110 |
|
)); |
| 111 |
|
|
| 112 |
|
// field should default to the end instead |
| 113 |
|
$fields = $form->Fields(); |
| 114 |
|
$this->assertEquals('Title', $fields[0]->Title()); |
| 115 |
|
$this->assertEquals('Comment', $fields[1]->Title()); |
| 116 |
|
$this->assertEquals('URL', $fields[2]->Title()); |
| 117 |
|
$this->assertEquals('Foo', $fields[3]->Title()); |
| 118 |
|
} |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
/** |