-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFrameFixture.php
More file actions
102 lines (97 loc) · 2.19 KB
/
FrameFixture.php
File metadata and controls
102 lines (97 loc) · 2.19 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
<?php
/**
* FrameFixture
*
* @copyright Copyright 2014, NetCommons Project
* @author Kohei Teraguchi <kteraguchi@commonsnet.org>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
*/
/**
* FrameFixture
*
* @author Kohei Teraguchi <kteraguchi@commonsnet.org>
* @package NetCommons\Blocks\Test\Fixture
*/
class FrameFixture extends CakeTestFixture {
/**
* Records
*
* @var array
*/
public $records = array(
//メイン
array(
'id' => '6',
'room_id' => '2',
'box_id' => '27',
'plugin_key' => 'test_plugin',
'block_id' => '2',
'key' => 'frame_3',
'weight' => '1',
'is_deleted' => '0',
),
//フレーム削除(論理削除)
array(
'id' => '12',
'room_id' => '2',
'box_id' => '27',
'plugin_key' => 'test_plugin',
'block_id' => '2',
'key' => 'frame_6',
'weight' => '2',
'is_deleted' => '1',
),
//フレームのブロックなし
array(
'id' => '14',
'room_id' => '2',
'box_id' => '27',
'plugin_key' => 'test_plugin',
'block_id' => null,
'key' => 'frame_7',
'weight' => '2',
'is_deleted' => '0',
),
//メイン(別ルーム(room_id=5))
array(
'id' => '16',
'room_id' => '5',
'box_id' => '42',
'plugin_key' => 'test_plugin',
'block_id' => null,
'key' => 'frame_8',
'weight' => '1',
'is_deleted' => '0',
),
//メイン(別ルーム(room_id=6、ブロックなし))
array(
'id' => '18',
'room_id' => '6',
'box_id' => '51',
'plugin_key' => 'test_plugin',
'block_id' => null,
'key' => 'frame_9',
'weight' => '1',
'is_deleted' => '0',
),
);
/**
* Initialize the fixture.
*
* @return void
*/
public function init() {
require_once App::pluginPath('Frames') . 'Config' . DS . 'Schema' . DS . 'schema.php';
$this->fields = (new FramesSchema())->tables[Inflector::tableize($this->name)];
if (class_exists('NetCommonsTestSuite') && NetCommonsTestSuite::$plugin) {
$records = array_keys($this->records);
foreach ($records as $i) {
if ($this->records[$i]['plugin_key'] === 'test_plugin') {
$this->records[$i]['plugin_key'] = NetCommonsTestSuite::$plugin;
}
}
}
parent::init();
}
}