Completed
Pull Request — master (#70)
by Daniel
04:18
created
tests/TagFieldTest.php 1 patch
Indentation   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -5,327 +5,327 @@  discard block
 block discarded – undo
5 5
  */
6 6
 class TagFieldTest extends SapphireTest
7 7
 {
8
-    /**
9
-     * @var string
10
-     */
11
-    public static $fixture_file = 'tagfield/tests/TagFieldTest.yml';
12
-
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $extraDataObjects = array(
17
-        'TagFieldTestBlogTag',
18
-        'TagFieldTestBlogPost',
19
-    );
20
-
21
-    public function testItSavesLinksToNewTagsOnNewRecords()
22
-    {
23
-        $record = $this->getNewTagFieldTestBlogPost('BlogPost1');
24
-
25
-        $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
26
-        $field->setValue(array('Tag3', 'Tag4'));
27
-        $field->saveInto($record);
28
-
29
-        $record->write();
30
-
31
-        $this->compareExpectedAndActualTags(
32
-            array('Tag3', 'Tag4'),
33
-            $record
34
-        );
35
-    }
36
-
37
-    /**
38
-     * @param string $name
39
-     *
40
-     * @return TagFieldTestBlogPost
41
-     */
42
-    protected function getNewTagFieldTestBlogPost($name)
43
-    {
44
-        return $this->objFromFixture(
45
-            'TagFieldTestBlogPost',
46
-            $name
47
-        );
48
-    }
49
-
50
-    /**
51
-     * @param array $expected
52
-     * @param TagFieldTestBlogPost $record
53
-     */
54
-    protected function compareExpectedAndActualTags(array $expected, TagFieldTestBlogPost $record)
55
-    {
56
-        $this->compareTagLists($expected, $record->Tags());
57
-    }
58
-
59
-    /**
60
-     * Ensure a source of tags matches the given string tag names
61
-     *
62
-     * @param array $expected
63
-     * @param DataList $actualSource
64
-     */
65
-    protected function compareTagLists(array $expected, DataList $actualSource)
66
-    {
67
-        $actual = array_values($actualSource->map('ID', 'Title')->toArray());
68
-
69
-        sort($expected);
70
-        sort($actual);
71
-
72
-        $this->assertEquals(
73
-            $expected,
74
-            $actual
75
-        );
76
-    }
77
-
78
-    public function testItSavesLinksToNewTagsOnExistingRecords()
79
-    {
80
-        $record = $this->getNewTagFieldTestBlogPost('BlogPost1');
81
-        $record->write();
82
-
83
-        $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
84
-        $field->setValue(array('Tag3', 'Tag4'));
85
-        $field->saveInto($record);
86
-
87
-        $this->compareExpectedAndActualTags(
88
-            array('Tag3', 'Tag4'),
89
-            $record
90
-        );
91
-    }
92
-
93
-    public function testItSavesLinksToExistingTagsOnNewRecords()
94
-    {
95
-        $record = $this->getNewTagFieldTestBlogPost('BlogPost1');
96
-
97
-        $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
98
-        $field->setValue(array('Tag1', 'Tag2'));
99
-        $field->saveInto($record);
100
-
101
-        $record->write();
102
-
103
-        $this->compareExpectedAndActualTags(
104
-            array('Tag1', 'Tag2'),
105
-            $record
106
-        );
107
-    }
108
-
109
-    public function testItSavesLinksToExistingTagsOnExistingRecords()
110
-    {
111
-        $record = $this->getNewTagFieldTestBlogPost('BlogPost1');
112
-        $record->write();
113
-
114
-        $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
115
-        $field->setValue(array('Tag1', 'Tag2'));
116
-        $field->saveInto($record);
117
-
118
-        $this->compareExpectedAndActualTags(
119
-            array('Tag1', 'Tag2'),
120
-            $record
121
-        );
122
-    }
123
-
124
-    /**
125
-     * Ensure that {@see TagField::saveInto} respects existing tags
126
-     */
127
-    public function testSaveDuplicateTags()
128
-    {
129
-        $record = $this->getNewTagFieldTestBlogPost('BlogPost2');
130
-        $record->write();
131
-        $tag2ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag2');
132
-
133
-        // Check tags before write
134
-        $this->compareExpectedAndActualTags(
135
-            array('Tag1', 'Tag2'),
136
-            $record
137
-        );
138
-        $this->compareTagLists(
139
-            array('Tag1', 'Tag2'),
140
-            TagFieldTestBlogTag::get()
141
-        );
142
-        $this->assertContains($tag2ID, TagFieldTestBlogTag::get()->column('ID'));
143
-
144
-        // Write new tags
145
-        $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
146
-        $field->setValue(array('Tag2', 'Tag3'));
147
-        $field->saveInto($record);
148
-
149
-        // Check only one new tag was added
150
-        $this->compareExpectedAndActualTags(
151
-            array('Tag2', 'Tag3'),
152
-            $record
153
-        );
154
-
155
-        // Ensure that only one new dataobject was added and that tag2s id has not changed
156
-        $this->compareTagLists(
157
-            array('Tag1', 'Tag2', 'Tag3'),
158
-            TagFieldTestBlogTag::get()
159
-        );
160
-        $this->assertContains($tag2ID, TagFieldTestBlogTag::get()->column('ID'));
161
-    }
162
-
163
-    public function testItSuggestsTags()
164
-    {
165
-        $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
166
-
167
-        /**
168
-         * Partial tag title match.
169
-         */
170
-        $request = $this->getNewRequest(array('term' => 'Tag'));
171
-
172
-        $tag1ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag1');
173
-        $tag2ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag2');
174
-
175
-        $this->assertEquals(
176
-            sprintf('{"items":[{"id":%d,"text":"Tag1"},{"id":%d,"text":"Tag2"}]}', $tag1ID, $tag2ID),
177
-            $field->suggest($request)->getBody()
178
-        );
179
-
180
-        /**
181
-         * Exact tag title match.
182
-         */
183
-        $request = $this->getNewRequest(array('term' => 'Tag1'));
184
-
185
-        $this->assertEquals(
186
-            sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
187
-            $field->suggest($request)->getBody()
188
-        );
189
-
190
-        /**
191
-         * Case-insensitive tag title match.
192
-         */
193
-        $request = $this->getNewRequest(array('term' => 'TAG1'));
194
-
195
-        $this->assertEquals(
196
-            sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
197
-            $field->suggest($request)->getBody()
198
-        );
199
-
200
-        /**
201
-         * No tag title match.
202
-         */
203
-        $request = $this->getNewRequest(array('term' => 'unknown'));
204
-
205
-        $this->assertEquals(
206
-            '{"items":[]}',
207
-            $field->suggest($request)->getBody()
208
-        );
209
-    }
210
-
211
-    /**
212
-     * Tests that TagField supports pre-filtered data sources
213
-     */
214
-    public function testRestrictedSuggestions()
215
-    {
216
-        $source = TagFieldTestBlogTag::get()->exclude('Title', 'Tag2');
217
-        $field = new TagField('Tags', '', $source);
218
-        $tag1ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag1');
219
-
220
-        /**
221
-         * Partial tag title match.
222
-         */
223
-        $request = $this->getNewRequest(array('term' => 'Tag'));
224
-
225
-        $this->assertEquals(
226
-            sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
227
-            $field->suggest($request)->getBody()
228
-        );
229
-
230
-        /**
231
-         * Exact tag title match.
232
-         */
233
-        $request = $this->getNewRequest(array('term' => 'Tag1'));
234
-
235
-        $this->assertEquals(
236
-            sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
237
-            $field->suggest($request)->getBody()
238
-        );
239
-
240
-        /**
241
-         * Excluded item doesn't appear in matches
242
-         */
243
-        $request = $this->getNewRequest(array('term' => 'Tag2'));
244
-
245
-        $this->assertEquals(
246
-            '{"items":[]}',
247
-            $field->suggest($request)->getBody()
248
-        );
249
-    }
250
-
251
-    /**
252
-     * @param array $parameters
253
-     *
254
-     * @return SS_HTTPRequest
255
-     */
256
-    protected function getNewRequest(array $parameters)
257
-    {
258
-        return new SS_HTTPRequest(
259
-            'get',
260
-            'TagFieldTestController/TagFieldTestForm/fields/Tags/suggest',
261
-            $parameters
262
-        );
263
-    }
264
-
265
-    public function testItDisplaysValuesFromRelations()
266
-    {
267
-        $record = $this->getNewTagFieldTestBlogPost('BlogPost1');
268
-        $record->write();
269
-
270
-        $form = new Form(
271
-            new TagFieldTestController($record),
272
-            'Form',
273
-            new FieldList(
274
-                $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'))
275
-            ),
276
-            new FieldList()
277
-        );
278
-
279
-        $form->loadDataFrom(
280
-            $this->objFromFixture('TagFieldTestBlogPost', 'BlogPost2')
281
-        );
282
-
283
-        $this->assertEquals($field->Value(), array(1 => 1, 2 => 2));
284
-    }
285
-
286
-    public function testItIgnoresNewTagsIfCannotCreate()
287
-    {
288
-        $record = new TagFieldTestBlogPost();
289
-        $record->write();
290
-
291
-        $tag = TagFieldTestBlogTag::get()->filter('Title', 'Tag1')->first();
292
-
293
-        $field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'), array($tag->ID, 'Tag3'));
294
-        $field->setCanCreate(false);
295
-        $field->saveInto($record);
296
-
297
-        /**
298
-         * @var TagFieldTestBlogPost $record
299
-         */
300
-        $record = DataObject::get_by_id('TagFieldTestBlogPost', $record->ID);
301
-
302
-        $this->compareExpectedAndActualTags(
303
-            array('Tag1'),
304
-            $record
305
-        );
306
-    }
8
+	/**
9
+	 * @var string
10
+	 */
11
+	public static $fixture_file = 'tagfield/tests/TagFieldTest.yml';
12
+
13
+	/**
14
+	 * @var array
15
+	 */
16
+	protected $extraDataObjects = array(
17
+		'TagFieldTestBlogTag',
18
+		'TagFieldTestBlogPost',
19
+	);
20
+
21
+	public function testItSavesLinksToNewTagsOnNewRecords()
22
+	{
23
+		$record = $this->getNewTagFieldTestBlogPost('BlogPost1');
24
+
25
+		$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
26
+		$field->setValue(array('Tag3', 'Tag4'));
27
+		$field->saveInto($record);
28
+
29
+		$record->write();
30
+
31
+		$this->compareExpectedAndActualTags(
32
+			array('Tag3', 'Tag4'),
33
+			$record
34
+		);
35
+	}
36
+
37
+	/**
38
+	 * @param string $name
39
+	 *
40
+	 * @return TagFieldTestBlogPost
41
+	 */
42
+	protected function getNewTagFieldTestBlogPost($name)
43
+	{
44
+		return $this->objFromFixture(
45
+			'TagFieldTestBlogPost',
46
+			$name
47
+		);
48
+	}
49
+
50
+	/**
51
+	 * @param array $expected
52
+	 * @param TagFieldTestBlogPost $record
53
+	 */
54
+	protected function compareExpectedAndActualTags(array $expected, TagFieldTestBlogPost $record)
55
+	{
56
+		$this->compareTagLists($expected, $record->Tags());
57
+	}
58
+
59
+	/**
60
+	 * Ensure a source of tags matches the given string tag names
61
+	 *
62
+	 * @param array $expected
63
+	 * @param DataList $actualSource
64
+	 */
65
+	protected function compareTagLists(array $expected, DataList $actualSource)
66
+	{
67
+		$actual = array_values($actualSource->map('ID', 'Title')->toArray());
68
+
69
+		sort($expected);
70
+		sort($actual);
71
+
72
+		$this->assertEquals(
73
+			$expected,
74
+			$actual
75
+		);
76
+	}
77
+
78
+	public function testItSavesLinksToNewTagsOnExistingRecords()
79
+	{
80
+		$record = $this->getNewTagFieldTestBlogPost('BlogPost1');
81
+		$record->write();
82
+
83
+		$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
84
+		$field->setValue(array('Tag3', 'Tag4'));
85
+		$field->saveInto($record);
86
+
87
+		$this->compareExpectedAndActualTags(
88
+			array('Tag3', 'Tag4'),
89
+			$record
90
+		);
91
+	}
92
+
93
+	public function testItSavesLinksToExistingTagsOnNewRecords()
94
+	{
95
+		$record = $this->getNewTagFieldTestBlogPost('BlogPost1');
96
+
97
+		$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
98
+		$field->setValue(array('Tag1', 'Tag2'));
99
+		$field->saveInto($record);
100
+
101
+		$record->write();
102
+
103
+		$this->compareExpectedAndActualTags(
104
+			array('Tag1', 'Tag2'),
105
+			$record
106
+		);
107
+	}
108
+
109
+	public function testItSavesLinksToExistingTagsOnExistingRecords()
110
+	{
111
+		$record = $this->getNewTagFieldTestBlogPost('BlogPost1');
112
+		$record->write();
113
+
114
+		$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
115
+		$field->setValue(array('Tag1', 'Tag2'));
116
+		$field->saveInto($record);
117
+
118
+		$this->compareExpectedAndActualTags(
119
+			array('Tag1', 'Tag2'),
120
+			$record
121
+		);
122
+	}
123
+
124
+	/**
125
+	 * Ensure that {@see TagField::saveInto} respects existing tags
126
+	 */
127
+	public function testSaveDuplicateTags()
128
+	{
129
+		$record = $this->getNewTagFieldTestBlogPost('BlogPost2');
130
+		$record->write();
131
+		$tag2ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag2');
132
+
133
+		// Check tags before write
134
+		$this->compareExpectedAndActualTags(
135
+			array('Tag1', 'Tag2'),
136
+			$record
137
+		);
138
+		$this->compareTagLists(
139
+			array('Tag1', 'Tag2'),
140
+			TagFieldTestBlogTag::get()
141
+		);
142
+		$this->assertContains($tag2ID, TagFieldTestBlogTag::get()->column('ID'));
143
+
144
+		// Write new tags
145
+		$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
146
+		$field->setValue(array('Tag2', 'Tag3'));
147
+		$field->saveInto($record);
148
+
149
+		// Check only one new tag was added
150
+		$this->compareExpectedAndActualTags(
151
+			array('Tag2', 'Tag3'),
152
+			$record
153
+		);
154
+
155
+		// Ensure that only one new dataobject was added and that tag2s id has not changed
156
+		$this->compareTagLists(
157
+			array('Tag1', 'Tag2', 'Tag3'),
158
+			TagFieldTestBlogTag::get()
159
+		);
160
+		$this->assertContains($tag2ID, TagFieldTestBlogTag::get()->column('ID'));
161
+	}
162
+
163
+	public function testItSuggestsTags()
164
+	{
165
+		$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'));
166
+
167
+		/**
168
+		 * Partial tag title match.
169
+		 */
170
+		$request = $this->getNewRequest(array('term' => 'Tag'));
171
+
172
+		$tag1ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag1');
173
+		$tag2ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag2');
174
+
175
+		$this->assertEquals(
176
+			sprintf('{"items":[{"id":%d,"text":"Tag1"},{"id":%d,"text":"Tag2"}]}', $tag1ID, $tag2ID),
177
+			$field->suggest($request)->getBody()
178
+		);
179
+
180
+		/**
181
+		 * Exact tag title match.
182
+		 */
183
+		$request = $this->getNewRequest(array('term' => 'Tag1'));
184
+
185
+		$this->assertEquals(
186
+			sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
187
+			$field->suggest($request)->getBody()
188
+		);
189
+
190
+		/**
191
+		 * Case-insensitive tag title match.
192
+		 */
193
+		$request = $this->getNewRequest(array('term' => 'TAG1'));
194
+
195
+		$this->assertEquals(
196
+			sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
197
+			$field->suggest($request)->getBody()
198
+		);
199
+
200
+		/**
201
+		 * No tag title match.
202
+		 */
203
+		$request = $this->getNewRequest(array('term' => 'unknown'));
204
+
205
+		$this->assertEquals(
206
+			'{"items":[]}',
207
+			$field->suggest($request)->getBody()
208
+		);
209
+	}
210
+
211
+	/**
212
+	 * Tests that TagField supports pre-filtered data sources
213
+	 */
214
+	public function testRestrictedSuggestions()
215
+	{
216
+		$source = TagFieldTestBlogTag::get()->exclude('Title', 'Tag2');
217
+		$field = new TagField('Tags', '', $source);
218
+		$tag1ID = $this->idFromFixture('TagFieldTestBlogTag', 'Tag1');
219
+
220
+		/**
221
+		 * Partial tag title match.
222
+		 */
223
+		$request = $this->getNewRequest(array('term' => 'Tag'));
224
+
225
+		$this->assertEquals(
226
+			sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
227
+			$field->suggest($request)->getBody()
228
+		);
229
+
230
+		/**
231
+		 * Exact tag title match.
232
+		 */
233
+		$request = $this->getNewRequest(array('term' => 'Tag1'));
234
+
235
+		$this->assertEquals(
236
+			sprintf('{"items":[{"id":%d,"text":"Tag1"}]}', $tag1ID),
237
+			$field->suggest($request)->getBody()
238
+		);
239
+
240
+		/**
241
+		 * Excluded item doesn't appear in matches
242
+		 */
243
+		$request = $this->getNewRequest(array('term' => 'Tag2'));
244
+
245
+		$this->assertEquals(
246
+			'{"items":[]}',
247
+			$field->suggest($request)->getBody()
248
+		);
249
+	}
250
+
251
+	/**
252
+	 * @param array $parameters
253
+	 *
254
+	 * @return SS_HTTPRequest
255
+	 */
256
+	protected function getNewRequest(array $parameters)
257
+	{
258
+		return new SS_HTTPRequest(
259
+			'get',
260
+			'TagFieldTestController/TagFieldTestForm/fields/Tags/suggest',
261
+			$parameters
262
+		);
263
+	}
264
+
265
+	public function testItDisplaysValuesFromRelations()
266
+	{
267
+		$record = $this->getNewTagFieldTestBlogPost('BlogPost1');
268
+		$record->write();
269
+
270
+		$form = new Form(
271
+			new TagFieldTestController($record),
272
+			'Form',
273
+			new FieldList(
274
+				$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'))
275
+			),
276
+			new FieldList()
277
+		);
278
+
279
+		$form->loadDataFrom(
280
+			$this->objFromFixture('TagFieldTestBlogPost', 'BlogPost2')
281
+		);
282
+
283
+		$this->assertEquals($field->Value(), array(1 => 1, 2 => 2));
284
+	}
285
+
286
+	public function testItIgnoresNewTagsIfCannotCreate()
287
+	{
288
+		$record = new TagFieldTestBlogPost();
289
+		$record->write();
290
+
291
+		$tag = TagFieldTestBlogTag::get()->filter('Title', 'Tag1')->first();
292
+
293
+		$field = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'), array($tag->ID, 'Tag3'));
294
+		$field->setCanCreate(false);
295
+		$field->saveInto($record);
296
+
297
+		/**
298
+		 * @var TagFieldTestBlogPost $record
299
+		 */
300
+		$record = DataObject::get_by_id('TagFieldTestBlogPost', $record->ID);
301
+
302
+		$this->compareExpectedAndActualTags(
303
+			array('Tag1'),
304
+			$record
305
+		);
306
+	}
307 307
 }
308 308
 
309 309
 class TagFieldTestBlogTag extends DataObject implements TestOnly
310 310
 {
311
-    /**
312
-     * @var string
313
-     */
314
-    private static $default_sort = '"TagFieldTestBlogTag"."ID" ASC';
315
-
316
-    /**
317
-     * @var array
318
-     */
319
-    private static $db = array(
320
-        'Title' => 'Varchar(200)',
321
-    );
322
-
323
-    /**
324
-     * @var array
325
-     */
326
-    private static $belongs_many_many = array(
327
-        'BlogPosts' => 'TagFieldTestBlogPost',
328
-    );
311
+	/**
312
+	 * @var string
313
+	 */
314
+	private static $default_sort = '"TagFieldTestBlogTag"."ID" ASC';
315
+
316
+	/**
317
+	 * @var array
318
+	 */
319
+	private static $db = array(
320
+		'Title' => 'Varchar(200)',
321
+	);
322
+
323
+	/**
324
+	 * @var array
325
+	 */
326
+	private static $belongs_many_many = array(
327
+		'BlogPosts' => 'TagFieldTestBlogPost',
328
+	);
329 329
 }
330 330
 
331 331
 /**
@@ -333,46 +333,46 @@  discard block
 block discarded – undo
333 333
  */
334 334
 class TagFieldTestBlogPost extends DataObject implements TestOnly
335 335
 {
336
-    /**
337
-     * @var array
338
-     */
339
-    private static $db = array(
340
-        'Title' => 'Text',
341
-        'Content' => 'Text',
342
-    );
343
-
344
-    /**
345
-     * @var array
346
-     */
347
-    private static $many_many = array(
348
-        'Tags' => 'TagFieldTestBlogTag',
349
-    );
336
+	/**
337
+	 * @var array
338
+	 */
339
+	private static $db = array(
340
+		'Title' => 'Text',
341
+		'Content' => 'Text',
342
+	);
343
+
344
+	/**
345
+	 * @var array
346
+	 */
347
+	private static $many_many = array(
348
+		'Tags' => 'TagFieldTestBlogTag',
349
+	);
350 350
 }
351 351
 
352 352
 class TagFieldTestController extends Controller implements TestOnly
353 353
 {
354
-    /**
355
-     * @return Form
356
-     */
357
-    public function TagFieldTestForm()
358
-    {
359
-        $fields = new FieldList(
360
-            $tagField = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'))
361
-        );
362
-
363
-        $actions = new FieldList(
364
-            new FormAction('TagFieldTestFormSubmit')
365
-        );
366
-
367
-        return new Form($this, 'TagFieldTestForm', $fields, $actions);
368
-    }
369
-
370
-    /**
371
-     * @param DataObject $dataObject
372
-     * @param Form $form
373
-     */
374
-    public function TagFieldTestFormSubmit(DataObject $dataObject, Form $form)
375
-    {
376
-        $form->saveInto($dataObject);
377
-    }
354
+	/**
355
+	 * @return Form
356
+	 */
357
+	public function TagFieldTestForm()
358
+	{
359
+		$fields = new FieldList(
360
+			$tagField = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'))
361
+		);
362
+
363
+		$actions = new FieldList(
364
+			new FormAction('TagFieldTestFormSubmit')
365
+		);
366
+
367
+		return new Form($this, 'TagFieldTestForm', $fields, $actions);
368
+	}
369
+
370
+	/**
371
+	 * @param DataObject $dataObject
372
+	 * @param Form $form
373
+	 */
374
+	public function TagFieldTestFormSubmit(DataObject $dataObject, Form $form)
375
+	{
376
+		$form->saveInto($dataObject);
377
+	}
378 378
 }
Please login to merge, or discard this patch.