1<?php
2
3namespace dokuwiki\plugin\struct\test;
4
5use dokuwiki\plugin\struct\meta;
6
7/**
8 * Tests for the Column object
9 *
10 * @group plugin_struct
11 * @group plugins
12 */
13class column_struct_test extends StructTest
14{
15
16    public function test_allTypes()
17    {
18
19        $expect = array(
20            'Checkbox' => 'dokuwiki\\plugin\\struct\\types\\Checkbox',
21            'Color' => 'dokuwiki\\plugin\\struct\\types\\Color',
22            'Date' => 'dokuwiki\\plugin\\struct\\types\\Date',
23            'DateTime' => 'dokuwiki\\plugin\\struct\\types\\DateTime',
24            'Decimal' => 'dokuwiki\\plugin\\struct\\types\\Decimal',
25            'Dropdown' => 'dokuwiki\\plugin\\struct\\types\\Dropdown',
26            'LongText' => 'dokuwiki\\plugin\\struct\\types\\LongText',
27            'Lookup' => 'dokuwiki\\plugin\\struct\\types\\Lookup',
28            'Mail' => 'dokuwiki\\plugin\\struct\\types\\Mail',
29            'Media' => 'dokuwiki\\plugin\\struct\\types\\Media',
30            'Page' => 'dokuwiki\\plugin\\struct\\types\\Page',
31            'Tag' => 'dokuwiki\\plugin\\struct\\types\\Tag',
32            'Text' => 'dokuwiki\\plugin\\struct\\types\\Text',
33            'Url' => 'dokuwiki\\plugin\\struct\\types\\Url',
34            'User' => 'dokuwiki\\plugin\\struct\\types\\User',
35            'Wiki' => 'dokuwiki\\plugin\\struct\\types\\Wiki'
36        );
37
38        $this->assertEquals($expect, meta\Column::allTypes(true));
39    }
40
41    public function test_extendedTypes()
42    {
43
44        $expect = array(
45            'Checkbox' => 'dokuwiki\\plugin\\struct\\types\\Checkbox',
46            'Color' => 'dokuwiki\\plugin\\struct\\types\\Color',
47            'Date' => 'dokuwiki\\plugin\\struct\\types\\Date',
48            'DateTime' => 'dokuwiki\\plugin\\struct\\types\\DateTime',
49            'Decimal' => 'dokuwiki\\plugin\\struct\\types\\Decimal',
50            'Dropdown' => 'dokuwiki\\plugin\\struct\\types\\Dropdown',
51            'LongText' => 'dokuwiki\\plugin\\struct\\types\\LongText',
52            'Lookup' => 'dokuwiki\\plugin\\struct\\types\\Lookup',
53            'Mail' => 'dokuwiki\\plugin\\struct\\types\\Mail',
54            'Media' => 'dokuwiki\\plugin\\struct\\types\\Media',
55            'Page' => 'dokuwiki\\plugin\\struct\\types\\Page',
56            'test' => 'some\\test\\class',
57            'Tag' => 'dokuwiki\\plugin\\struct\\types\\Tag',
58            'Text' => 'dokuwiki\\plugin\\struct\\types\\Text',
59            'Url' => 'dokuwiki\\plugin\\struct\\types\\Url',
60            'User' => 'dokuwiki\\plugin\\struct\\types\\User',
61            'Wiki' => 'dokuwiki\\plugin\\struct\\types\\Wiki'
62        );
63
64        global $EVENT_HANDLER;
65        $EVENT_HANDLER->register_hook('PLUGIN_STRUCT_TYPECLASS_INIT', 'BEFORE', $this, 'event');
66        $this->assertEquals($expect, meta\Column::allTypes(true));
67    }
68
69    /**
70     * Fake event that adds a new type to the list of types
71     *
72     * @param \Doku_Event $event
73     * @param $param
74     */
75    public function event(\Doku_Event $event, $param)
76    {
77        $event->data['test'] = 'some\\test\\class';
78    }
79
80}
81