-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBlock4topicsFixture.php
More file actions
256 lines (249 loc) · 5.97 KB
/
Block4topicsFixture.php
File metadata and controls
256 lines (249 loc) · 5.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<?php
/**
* トピックス用のBlockFixture
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('BlockFixture', 'Blocks.Test/Fixture');
App::uses('Topic4topicsFixture', 'Topics.Test/Fixture');
/**
* トピックス用のBlockFixture
*
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @package NetCommons\Topics\Test\Fixture
*/
class Block4topicsFixture extends BlockFixture {
/**
* Model name
*
* @var string
*/
public $name = 'Block';
/**
* Records
*
* @var array
*/
public $records = array(
//#### 掲示板
array(
'id' => '1',
'room_id' => '2',
'plugin_key' => 'test_bbses',
'key' => 'block_1',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
//#### ブログ(公開日のチェック)
array(
'id' => '2',
'room_id' => '2',
'plugin_key' => 'test_blogs',
'key' => 'block_2',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
//#### お知らせ(ブロックの公開状態、公開日のチェック)
// - [block_id=3] ブロック公開
array(
'id' => '3',
'room_id' => '2',
'plugin_key' => 'test_announcements',
'key' => 'block_3',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
// - [block_id=4] ブロック非公開
array(
'id' => '4',
'room_id' => '2',
'plugin_key' => 'test_announcements',
'key' => 'block_4',
'public_type' => '0',
'publish_start' => null,
'publish_end' => null,
),
// - [block_id=5] ブロック期限付き+期限内
array(
'id' => '5',
'room_id' => '2',
'plugin_key' => 'test_announcements',
'key' => 'block_5',
'public_type' => '2',
'publish_start' => 'past_3()',
'publish_end' => 'future()',
),
// - [block_id=6] ブロック期限付き+期限内(startのみ指定)
array(
'id' => '6',
'room_id' => '2',
'plugin_key' => 'test_announcements',
'key' => 'block_6',
'public_type' => '2',
'publish_start' => 'past_3()',
'publish_end' => null,
),
// - [block_id=7] ブロック期限付き+期限内(endのみ指定)
array(
'id' => '7',
'room_id' => '2',
'plugin_key' => 'test_announcements',
'key' => 'block_7',
'public_type' => '2',
'publish_start' => null,
'publish_end' => 'future()',
),
// - [block_id=8] ブロック期限付き+期限前
array(
'id' => '8',
'room_id' => '2',
'plugin_key' => 'test_announcements',
'key' => 'block_8',
'public_type' => '2',
'publish_start' => 'future()',
'publish_end' => null,
),
// - [block_id=9] ブロック期限付き+期限切れ
array(
'id' => '9',
'room_id' => '2',
'plugin_key' => 'test_announcements',
'key' => 'block_9',
'public_type' => '2',
'publish_start' => null,
'publish_end' => 'past_3()',
),
// - [block_id=10,room_id=6] 管理者プライベート
array(
'id' => '10',
'room_id' => '6',
'plugin_key' => 'test_announcements',
'key' => 'block_10',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
// - [block_id=11,room_id=9] 一般1プライベート
array(
'id' => '11',
'room_id' => '9',
'plugin_key' => 'test_announcements',
'key' => 'block_11',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
// - [block_id=12,room_id=12] ルーム2
array(
'id' => '12',
'room_id' => '12',
'plugin_key' => 'test_announcements',
'key' => 'block_12',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
//#### FAQ
array(
'id' => '13',
'room_id' => '2',
'plugin_key' => 'test_faqs',
'key' => 'block_13',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
//#### 回覧板(イレギュラープラグイン)
array(
'id' => '14',
'room_id' => '2',
'plugin_key' => 'test_circular_notices',
'key' => 'block_14',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
array(
'id' => '15',
'room_id' => '12',
'plugin_key' => 'test_circular_notices',
'key' => 'block_15',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
//#### カレンダー(イレギュラープラグイン)
// - パブリック
array(
'id' => '16',
'room_id' => '2',
'plugin_key' => 'test_calendars',
'key' => 'block_16',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
// - ルーム2[room_id=12]
array(
'id' => '17',
'room_id' => '12',
'plugin_key' => 'test_calendars',
'key' => 'block_17',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
// - 会員全体[room_id=4]
array(
'id' => '18',
'room_id' => '4',
'plugin_key' => 'test_calendars',
'key' => 'block_18',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
// - プライベート(管理者)[room_id=6]
array(
'id' => '19',
'room_id' => '6',
'plugin_key' => 'test_calendars',
'key' => 'block_19',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
// - プライベート(一般)[room_id=9]
array(
'id' => '20',
'room_id' => '9',
'plugin_key' => 'test_calendars',
'key' => 'block_20',
'public_type' => '1',
'publish_start' => null,
'publish_end' => null,
),
);
/**
* Initialize the fixture.
*
* @return void
*/
public function init() {
parent::init();
$now = gmdate('Y-m-d H:i:s');
$fixture = new Topic4topicsFixture();
foreach ($this->records as $i => $record) {
$record['publish_start'] = $fixture->getDateTime($record['publish_start'], $now);
$record['publish_end'] = $fixture->getDateTime($record['publish_end'], $now);
$this->records[$i] = $record;
}
}
}