@@ 104-116 (lines=13) @@ | ||
101 | $this->assertEquals('Foo', $form->Fields()->fieldByName($field_name)->Title()); |
|
102 | } |
|
103 | ||
104 | public function testInsertBefore() |
|
105 | { |
|
106 | $form = $this->form->enableSpamProtection(array( |
|
107 | 'protector' => FooProtector::class, |
|
108 | 'insertBefore' => 'URL' |
|
109 | )); |
|
110 | ||
111 | $fields = $form->Fields(); |
|
112 | $this->assertEquals('Title', $fields[0]->Title()); |
|
113 | $this->assertEquals('Comment', $fields[1]->Title()); |
|
114 | $this->assertEquals('Foo', $fields[2]->Title()); |
|
115 | $this->assertEquals('URL', $fields[3]->Title()); |
|
116 | } |
|
117 | ||
118 | public function testInsertBeforeMissing() |
|
119 | { |
|
@@ 118-131 (lines=14) @@ | ||
115 | $this->assertEquals('URL', $fields[3]->Title()); |
|
116 | } |
|
117 | ||
118 | public function testInsertBeforeMissing() |
|
119 | { |
|
120 | $form = $this->form->enableSpamProtection(array( |
|
121 | 'protector' => FooProtector::class, |
|
122 | 'insertBefore' => 'NotAField' |
|
123 | )); |
|
124 | ||
125 | // field should default to the end instead |
|
126 | $fields = $form->Fields(); |
|
127 | $this->assertEquals('Title', $fields[0]->Title()); |
|
128 | $this->assertEquals('Comment', $fields[1]->Title()); |
|
129 | $this->assertEquals('URL', $fields[2]->Title()); |
|
130 | $this->assertEquals('Foo', $fields[3]->Title()); |
|
131 | } |
|
132 | } |
|
133 |