-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIssue923SettingModeProblemAddTest.php
More file actions
148 lines (129 loc) · 3.3 KB
/
Issue923SettingModeProblemAddTest.php
File metadata and controls
148 lines (129 loc) · 3.3 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
<?php
/**
* Issue923SettingModeProblemAddTest
*
* @author Ryuji AMANO <ryuji@ryus.co.jp>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
*/
App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
/**
* Issue923SettingModeProblemAddTest
*
* @author Ryuji AMANO <ryuji@ryus.co.jp>
* @package NetCommons\Pages\Test\Case\Controller\PagesEditController
* @codeCoverageIgnore
* @SuppressWarnings(PHPMD.NumberOfChildren)
*/
class Issue923SettingModeProblemAddTest extends NetCommonsControllerTestCase {
/**
* Plugin name
*
* @var string
*/
public $plugin = 'registrations';
/**
* Controller name
*
* @var string
*/
protected $_controller = 'registration_add';
/**
* Fixtures
*
* @var array
*/
public $fixtures = array(
'plugin.registrations.registration',
'plugin.registrations.block_setting_for_registration',
'plugin.registrations.registration_page',
'plugin.registrations.registration_question',
'plugin.registrations.registration_choice',
'plugin.registrations.registration_answer_summary',
'plugin.registrations.registration_answer',
'plugin.authorization_keys.authorization_keys',
'plugin.workflow.workflow_comment',
//'plugin.files.upload_file',
);
/**
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
//$this->Registration = ClassRegistry::init('Registrations.Registration');
//$this->Registration->Behaviors->unload('AuthorizationKey');
TestAuthGeneral::login($this);
//テストプラグインのロード
NetCommonsCakeTestCase::loadTestPlugin($this, 'Registrations', 'TestRegistrations');
Current::isSettingMode(false);
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
parent::tearDown();
}
/**
* add()アクションテスト
*
* @return void
*/
public function testAdd() {
$data = $this->__getData();
//セッティングモードでないときは、メール設定タブは非表示
$this->_controller = 'registration_add';
$url = [
'controller' => 'registration_add',
'action' => 'add',
'block_id' => $data['Block']['id'],
'frame_id' => $data['Frame']['id'],
//'key' => 'registration_2',
];
$this->_testGetAction($url,
[
'method' => 'assertNotContains', 'expected' => __d('blocks', 'Block settings')
], null, 'view');
//セッティングモードONならブロック設定タブが表示される
$url['q_mode'] = 'setting';
$this->_testGetAction($url,
[
'method' => 'assertContains', 'expected' => __d('blocks', 'Block settings')
], null, 'view');
}
/**
* テストDataの取得
*
* @param string $registrationKey キー
* @return array
*/
private function __getData($registrationKey = null) {
$frameId = '6';
$blockId = '2';
$blockKey = 'block_1';
$data = array(
'save_' . WorkflowComponent::STATUS_IN_DRAFT => null,
'Frame' => array(
'id' => $frameId
),
'Block' => array(
'id' => $blockId,
'key' => $blockKey,
'language_id' => '2',
'room_id' => '2',
'plugin_key' => $this->plugin,
),
'ActionRegistrationAdd' => array(
'create_option' => 'create',
'title' => 'New Registration Title',
),
//'WorkflowComment' => array(
// 'comment' => 'WorkflowComment save test'
//),
);
return $data;
}
}