1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of EC-CUBE |
5
|
|
|
* |
6
|
|
|
* Copyright(c) LOCKON CO.,LTD. All Rights Reserved. |
7
|
|
|
* |
8
|
|
|
* http://www.lockon.co.jp/ |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
use Codeception\Util\FileSystem; |
15
|
|
|
use Codeception\Util\Fixtures; |
16
|
|
|
use Doctrine\ORM\EntityManager; |
17
|
|
|
use Eccube\Common\EccubeConfig; |
18
|
|
|
use Eccube\Entity\Plugin; |
19
|
|
|
use Eccube\Repository\PluginRepository; |
20
|
|
|
use Page\Admin\PluginLocalInstallPage; |
21
|
|
|
use Page\Admin\PluginManagePage; |
22
|
|
|
use Page\Admin\PluginSearchPage; |
23
|
|
|
|
24
|
|
|
class EA10PluginCest |
25
|
|
|
{ |
26
|
|
|
/** @var EntityManager */ |
27
|
|
|
private $em; |
28
|
|
|
|
29
|
|
|
/** @var \Doctrine\DBAL\Connection */ |
30
|
|
|
private $conn; |
31
|
|
|
|
32
|
|
|
/** @var PluginRepository */ |
33
|
|
|
private $pluginRepository; |
34
|
|
|
|
35
|
|
|
/** @var EccubeConfig */ |
36
|
|
|
private $config; |
37
|
|
|
|
38
|
|
|
public function _before(\AcceptanceTester $I) |
39
|
|
|
{ |
40
|
|
|
$I->loginAsAdmin(); |
41
|
|
|
|
42
|
|
|
$this->em = Fixtures::get('entityManager'); |
43
|
|
|
$this->conn = $this->em->getConnection(); |
44
|
|
|
$this->pluginRepository = $this->em->getRepository(Plugin::class); |
45
|
|
|
$this->config = Fixtures::get('config'); |
46
|
|
|
FileSystem::doEmptyDir('repos'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function install_enable_disable_enable_disable_remove_store(\AcceptanceTester $I) |
50
|
|
|
{ |
51
|
|
|
Horizon_Store::start($I) |
52
|
|
|
->インストール() |
53
|
|
|
->有効化() |
54
|
|
|
->無効化() |
55
|
|
|
->有効化() |
56
|
|
|
->無効化() |
57
|
|
|
->削除(); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function install_enable_disable_enable_disable_remove_local(\AcceptanceTester $I) |
61
|
|
|
{ |
62
|
|
|
Horizon_Local::start($I) |
63
|
|
|
->インストール() |
64
|
|
|
->有効化() |
65
|
|
|
->無効化() |
66
|
|
|
->有効化() |
67
|
|
|
->無効化() |
68
|
|
|
->削除(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function install_remove_local(\AcceptanceTester $I) |
72
|
|
|
{ |
73
|
|
|
Horizon_Local::start($I) |
74
|
|
|
->インストール() |
75
|
|
|
->削除(); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function install_remove_store(\AcceptanceTester $I) |
79
|
|
|
{ |
80
|
|
|
Horizon_Store::start($I) |
81
|
|
|
->インストール() |
82
|
|
|
->削除(); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function install_update_remove_store(\AcceptanceTester $I) |
86
|
|
|
{ |
87
|
|
|
Horizon_Store::start($I) |
88
|
|
|
->インストール() |
89
|
|
|
->アップデート() |
90
|
|
|
->削除(); |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
|
94
|
|
|
|
95
|
|
|
public function install_update_remove_local(\AcceptanceTester $I) |
96
|
|
|
{ |
97
|
|
|
Horizon_Local::start($I) |
98
|
|
|
->インストール() |
99
|
|
|
->アップデート() |
100
|
|
|
->削除(); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
public function install_enable_disable_update_enable_disable_remove_local(\AcceptanceTester $I) |
104
|
|
|
{ |
105
|
|
|
Horizon_Local::start($I) |
106
|
|
|
->インストール() |
107
|
|
|
->有効化() |
108
|
|
|
->無効化() |
109
|
|
|
->アップデート() |
110
|
|
|
->有効化() |
111
|
|
|
->無効化() |
112
|
|
|
->削除(); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function install_enable_disable_update_enable_disable_remove_store(\AcceptanceTester $I) |
116
|
|
|
{ |
117
|
|
|
Horizon_Store::start($I) |
118
|
|
|
->インストール() |
119
|
|
|
->有効化() |
120
|
|
|
->無効化() |
121
|
|
|
->アップデート() |
122
|
|
|
->有効化() |
123
|
|
|
->無効化() |
124
|
|
|
->削除(); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function install_enable_update_disable_remove_store(\AcceptanceTester $I) |
128
|
|
|
{ |
129
|
|
|
Horizon_Store::start($I) |
130
|
|
|
->インストール() |
131
|
|
|
->有効化() |
132
|
|
|
->アップデート() |
133
|
|
|
->無効化() |
134
|
|
|
->削除(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function install_enable_update_disable_remove_local(\AcceptanceTester $I) |
138
|
|
|
{ |
139
|
|
|
Horizon_Local::start($I) |
140
|
|
|
->インストール() |
141
|
|
|
->有効化() |
142
|
|
|
->アップデート() |
143
|
|
|
->無効化() |
144
|
|
|
->削除(); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function install_update_enable_disable_remove_local(\AcceptanceTester $I) |
148
|
|
|
{ |
149
|
|
|
Horizon_Local::start($I) |
150
|
|
|
->インストール() |
151
|
|
|
->アップデート() |
152
|
|
|
->有効化() |
153
|
|
|
->無効化() |
154
|
|
|
->削除(); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function install_update_enable_disable_remove_store(\AcceptanceTester $I) |
158
|
|
|
{ |
159
|
|
|
Horizon_Store::start($I) |
160
|
|
|
->インストール() |
161
|
|
|
->アップデート() |
162
|
|
|
->有効化() |
163
|
|
|
->無効化() |
164
|
|
|
->削除(); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
public function install_enable_enable(\AcceptanceTester $I) |
168
|
|
|
{ |
169
|
|
|
Horizon_Store::start($I) |
170
|
|
|
->インストール() |
171
|
|
|
->新しいタブで開く() |
172
|
|
|
->有効化() |
173
|
|
|
->前のタブに戻る() |
174
|
|
|
->既に有効なものを有効化(); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public function install_disable_disable(\AcceptanceTester $I) |
178
|
|
|
{ |
179
|
|
|
Horizon_Store::start($I) |
180
|
|
|
->インストール() |
181
|
|
|
->有効化() |
182
|
|
|
->新しいタブで開く() |
183
|
|
|
->無効化() |
184
|
|
|
->前のタブに戻る() |
185
|
|
|
->既に無効なものを無効化(); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
public function install_assets_local(\AcceptanceTester $I) |
189
|
|
|
{ |
190
|
|
|
$this->publishPlugin('Assets-1.0.0.tgz'); |
191
|
|
|
|
192
|
|
|
$assetsPath = $this->config['plugin_html_realdir'].'/Assets/assets/assets.js'; |
193
|
|
|
$updatedPath = $this->config['plugin_html_realdir'].'/Assets/assets/updated.js'; |
194
|
|
|
|
195
|
|
|
$I->assertFileNotExists($assetsPath); |
196
|
|
|
$I->assertFileNotExists($updatedPath); |
197
|
|
|
|
198
|
|
|
$ManagePage = PluginLocalInstallPage::go($I)->アップロード('plugins/Assets-1.0.0.tgz'); |
199
|
|
|
$I->assertFileExists($assetsPath); |
200
|
|
|
$I->assertFileNotExists($updatedPath); |
201
|
|
|
|
202
|
|
|
$ManagePage->独自プラグイン_有効化('Assets'); |
203
|
|
|
$I->assertFileExists($assetsPath); |
204
|
|
|
$I->assertFileNotExists($updatedPath); |
205
|
|
|
|
206
|
|
|
$ManagePage->独自プラグイン_無効化('Assets'); |
207
|
|
|
$I->assertFileExists($assetsPath); |
208
|
|
|
$I->assertFileNotExists($updatedPath); |
209
|
|
|
|
210
|
|
|
$ManagePage->独自プラグイン_アップデート('Assets', 'plugins/Assets-1.0.1.tgz'); |
211
|
|
|
$I->assertFileExists($assetsPath); |
212
|
|
|
$I->assertFileExists($updatedPath); |
213
|
|
|
|
214
|
|
|
$ManagePage->独自プラグイン_削除('Assets'); |
215
|
|
|
$I->assertFileNotExists($assetsPath); |
216
|
|
|
$I->assertFileNotExists($updatedPath); |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
public function install_assets_store(\AcceptanceTester $I) |
220
|
|
|
{ |
221
|
|
|
// 最初のバージョンを作成 |
222
|
|
|
$this->publishPlugin('Assets-1.0.0.tgz'); |
223
|
|
|
|
224
|
|
|
$assetsPath = $this->config['plugin_html_realdir'].'/Assets/assets/assets.js'; |
225
|
|
|
$updatedPath = $this->config['plugin_html_realdir'].'/Assets/assets/updated.js'; |
226
|
|
|
$I->assertFileNotExists($assetsPath); |
227
|
|
|
$I->assertFileNotExists($updatedPath); |
228
|
|
|
|
229
|
|
|
$ManagePage = PluginSearchPage::go($I) |
230
|
|
|
->入手する('Assets') |
231
|
|
|
->インストール(); |
232
|
|
|
$I->assertFileNotExists($assetsPath); |
233
|
|
|
$I->assertFileNotExists($updatedPath); |
234
|
|
|
|
235
|
|
|
$ManagePage->ストアプラグイン_有効化('Assets'); |
236
|
|
|
$I->assertFileExists($assetsPath); |
237
|
|
|
$I->assertFileNotExists($updatedPath); |
238
|
|
|
|
239
|
|
|
$ManagePage->ストアプラグイン_無効化('Assets'); |
240
|
|
|
$I->assertFileExists($assetsPath); |
241
|
|
|
$I->assertFileNotExists($updatedPath); |
242
|
|
|
|
243
|
|
|
// 新しいバージョンを作成 |
244
|
|
|
$this->publishPlugin('Assets-1.0.1.tgz'); |
245
|
|
|
|
246
|
|
|
$I->reloadPage(); |
247
|
|
|
$ManagePage->ストアプラグイン_アップデート('Assets')->アップデート(); |
248
|
|
|
$I->assertFileExists($assetsPath); |
249
|
|
|
$I->assertFileExists($updatedPath); |
250
|
|
|
|
251
|
|
|
$ManagePage->ストアプラグイン_削除('Assets'); |
252
|
|
|
$I->assertFileNotExists($assetsPath); |
253
|
|
|
$I->assertFileNotExists($updatedPath); |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
private function publishPlugin($fileName) |
257
|
|
|
{ |
258
|
|
|
copy(codecept_data_dir().'/'.'plugins/'.$fileName, codecept_root_dir().'/repos/'.$fileName); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
private function tableExists($tableName) |
|
|
|
|
262
|
|
|
{ |
263
|
|
|
return $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '${tableName}';")->fetch()['count'] > 0; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
private function columnExists($tableName, $columnName) |
|
|
|
|
267
|
|
|
{ |
268
|
|
|
return $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '${tableName}' AND column_name = '${columnName}';")->fetch()['count'] == 1; |
269
|
|
|
} |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
abstract class Abstract_Plugin |
273
|
|
|
{ |
274
|
|
|
/** @var AcceptanceTester */ |
275
|
|
|
protected $I; |
276
|
|
|
|
277
|
|
|
/** @var EntityManager */ |
278
|
|
|
protected $em; |
279
|
|
|
|
280
|
|
|
/** @var \Doctrine\DBAL\Connection */ |
281
|
|
|
protected $conn; |
282
|
|
|
|
283
|
|
|
/** @var PluginRepository */ |
284
|
|
|
protected $pluginRepository; |
285
|
|
|
|
286
|
|
|
/** @var EccubeConfig */ |
287
|
|
|
protected $config; |
288
|
|
|
|
289
|
|
|
|
290
|
|
|
protected $table; |
291
|
|
|
|
292
|
|
|
protected $column; |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* Abstract_Plugin constructor. |
296
|
|
|
*/ |
297
|
|
|
public function __construct(\AcceptanceTester $I) |
298
|
|
|
{ |
299
|
|
|
$this->I = $I; |
300
|
|
|
$this->em = Fixtures::get('entityManager'); |
301
|
|
|
$this->conn = $this->em->getConnection(); |
302
|
|
|
$this->pluginRepository = $this->em->getRepository(Plugin::class); |
303
|
|
|
$this->config = Fixtures::get('config'); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
View Code Duplication |
protected function tableExists() |
|
|
|
|
307
|
|
|
{ |
308
|
|
|
if ($this->table) { |
309
|
|
|
$exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '".$this->table."';")->fetch()['count'] > 0; |
310
|
|
|
$this->I->assertTrue($exists, 'テーブルがあるはず'); |
311
|
|
|
} |
312
|
|
|
} |
313
|
|
|
|
314
|
|
View Code Duplication |
protected function tableNotExists() |
|
|
|
|
315
|
|
|
{ |
316
|
|
|
if ($this->table) { |
317
|
|
|
$exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '".$this->table."';")->fetch()['count'] > 0; |
318
|
|
|
$this->I->assertFalse($exists, 'テーブルがないはず'); |
319
|
|
|
} |
320
|
|
|
} |
321
|
|
|
|
322
|
|
View Code Duplication |
protected function columnExists() |
|
|
|
|
323
|
|
|
{ |
324
|
|
|
if ($this->column) { |
325
|
|
|
list($tableName, $columnName) = explode('.', $this->column); |
326
|
|
|
$exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '${tableName}' AND column_name = '${columnName}';")->fetch()['count'] == 1; |
327
|
|
|
$this->I->assertTrue($exists, 'カラムがあるはず'); |
328
|
|
|
} |
329
|
|
|
} |
330
|
|
|
|
331
|
|
View Code Duplication |
protected function columnNotExists() |
|
|
|
|
332
|
|
|
{ |
333
|
|
|
if ($this->column) { |
334
|
|
|
list($tableName, $columnName) = explode('.', $this->column); |
335
|
|
|
$exists = $this->conn->executeQuery("SELECT count(*) AS count FROM information_schema.columns WHERE table_name = '${tableName}' AND column_name = '${columnName}';")->fetch()['count'] == 1; |
336
|
|
|
$this->I->assertFalse($exists, 'カラムがないはず'); |
337
|
|
|
} |
338
|
|
|
} |
339
|
|
|
|
340
|
|
|
public function 新しいタブで開く() |
341
|
|
|
{ |
342
|
|
|
$this->I->executeJS("window.open(location.href, 'other')"); |
343
|
|
|
$this->I->switchToWindow('other'); |
344
|
|
|
return $this; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
public function 前のタブに戻る() |
348
|
|
|
{ |
349
|
|
|
$this->I->switchToPreviousTab(); |
350
|
|
|
return $this; |
351
|
|
|
} |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
class Store_Plugin extends Abstract_Plugin |
355
|
|
|
{ |
356
|
|
|
/** @var PluginManagePage */ |
357
|
|
|
private $ManagePage; |
358
|
|
|
|
359
|
|
|
/** @var Plugin */ |
360
|
|
|
private $Plugin; |
361
|
|
|
|
362
|
|
|
private $initialized = false; |
363
|
|
|
|
364
|
|
|
private $enabled = false; |
365
|
|
|
|
366
|
|
|
private $code; |
367
|
|
|
|
368
|
|
|
public function __construct(AcceptanceTester $I, $code) |
369
|
|
|
{ |
370
|
|
|
parent::__construct($I); |
371
|
|
|
$this->code = $code; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
View Code Duplication |
public function インストール() |
|
|
|
|
375
|
|
|
{ |
376
|
|
|
$this->publishPlugin($this->code.'-1.0.0.tgz'); |
377
|
|
|
/* |
378
|
|
|
* インストール |
379
|
|
|
*/ |
380
|
|
|
$this->ManagePage = PluginSearchPage::go($this->I) |
381
|
|
|
->入手する($this->code) |
382
|
|
|
->インストール(); |
383
|
|
|
|
384
|
|
|
$this->tableNotExists(); |
385
|
|
|
$this->columnNotExists(); |
386
|
|
|
|
387
|
|
|
$this->Plugin = $this->pluginRepository->findByCode($this->code); |
388
|
|
|
$this->I->assertFalse($this->Plugin->isInitialized(), '初期化されていない'); |
389
|
|
|
$this->I->assertFalse($this->Plugin->isEnabled(), '有効化されていない'); |
390
|
|
|
|
391
|
|
|
return $this; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
View Code Duplication |
public function 有効化() |
|
|
|
|
395
|
|
|
{ |
396
|
|
|
$this->ManagePage->ストアプラグイン_有効化($this->code); |
397
|
|
|
|
398
|
|
|
$this->tableExists(); |
399
|
|
|
$this->columnExists(); |
400
|
|
|
|
401
|
|
|
$this->em->refresh($this->Plugin); |
402
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている'); |
403
|
|
|
$this->I->assertTrue($this->Plugin->isEnabled(), '有効化されている'); |
404
|
|
|
|
405
|
|
|
$this->initialized = true; |
406
|
|
|
$this->enabled = true; |
407
|
|
|
return $this; |
408
|
|
|
} |
409
|
|
|
|
410
|
|
View Code Duplication |
public function 既に有効なものを有効化() |
|
|
|
|
411
|
|
|
{ |
412
|
|
|
$this->ManagePage->ストアプラグイン_有効化($this->code, '既に有効です。'); |
413
|
|
|
|
414
|
|
|
$this->tableExists(); |
415
|
|
|
$this->columnExists(); |
416
|
|
|
|
417
|
|
|
$this->em->refresh($this->Plugin); |
418
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている'); |
419
|
|
|
$this->I->assertTrue($this->Plugin->isEnabled(), '有効化されている'); |
420
|
|
|
|
421
|
|
|
$this->initialized = true; |
422
|
|
|
$this->enabled = true; |
423
|
|
|
|
424
|
|
|
|
425
|
|
|
return $this; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
View Code Duplication |
public function 無効化() |
|
|
|
|
429
|
|
|
{ |
430
|
|
|
$this->ManagePage->ストアプラグイン_無効化($this->code); |
431
|
|
|
|
432
|
|
|
$this->tableExists(); |
433
|
|
|
$this->columnExists(); |
434
|
|
|
|
435
|
|
|
$this->em->refresh($this->Plugin); |
436
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている'); |
437
|
|
|
$this->I->assertFalse($this->Plugin->isEnabled(), '無効化されている'); |
438
|
|
|
|
439
|
|
|
$this->enabled = false; |
440
|
|
|
|
441
|
|
|
return $this; |
442
|
|
|
} |
443
|
|
|
|
444
|
|
View Code Duplication |
public function 既に無効なものを無効化() |
|
|
|
|
445
|
|
|
{ |
446
|
|
|
$this->ManagePage->ストアプラグイン_無効化($this->code, '既に無効です。'); |
447
|
|
|
|
448
|
|
|
$this->tableExists(); |
449
|
|
|
$this->columnExists(); |
450
|
|
|
|
451
|
|
|
$this->em->refresh($this->Plugin); |
452
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている'); |
453
|
|
|
$this->I->assertFalse($this->Plugin->isEnabled(), '無効化されている'); |
454
|
|
|
|
455
|
|
|
$this->enabled = false; |
456
|
|
|
|
457
|
|
|
return $this; |
458
|
|
|
} |
459
|
|
|
|
460
|
|
View Code Duplication |
public function 削除() |
|
|
|
|
461
|
|
|
{ |
462
|
|
|
$this->ManagePage->ストアプラグイン_削除($this->code); |
463
|
|
|
|
464
|
|
|
$this->tableNotExists(); |
465
|
|
|
$this->columnNotExists(); |
466
|
|
|
|
467
|
|
|
$this->em->refresh($this->Plugin); |
468
|
|
|
$this->Plugin = $this->pluginRepository->findByCode($this->code); |
469
|
|
|
$this->I->assertNull($this->Plugin, '削除されている'); |
470
|
|
|
|
471
|
|
|
return $this; |
472
|
|
|
} |
473
|
|
|
|
474
|
|
View Code Duplication |
public function アップデート() |
|
|
|
|
475
|
|
|
{ |
476
|
|
|
$this->publishPlugin($this->code.'-1.0.1.tgz'); |
477
|
|
|
|
478
|
|
|
$this->I->reloadPage(); |
479
|
|
|
$this->ManagePage->ストアプラグイン_アップデート($this->code)->アップデート(); |
480
|
|
|
|
481
|
|
|
$this->em->refresh($this->Plugin); |
482
|
|
|
|
483
|
|
|
$this->I->assertEquals($this->initialized, $this->Plugin->isInitialized(), '初期化'); |
484
|
|
|
$this->I->assertEquals($this->enabled, $this->Plugin->isEnabled(), '有効/無効'); |
485
|
|
|
|
486
|
|
|
return $this; |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
private function publishPlugin($fileName) |
490
|
|
|
{ |
491
|
|
|
$published = copy(codecept_data_dir().'/'.'plugins/'.$fileName, codecept_root_dir().'/repos/'.$fileName); |
492
|
|
|
$this->I->assertTrue($published, "公開できた ${fileName}"); |
493
|
|
|
$output = []; |
494
|
|
|
exec("ls -ltra repos/", $output); |
495
|
|
|
echo implode(PHP_EOL, $output).PHP_EOL; |
496
|
|
|
} |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
class Local_Plugin extends Abstract_Plugin |
500
|
|
|
{ |
501
|
|
|
/** @var PluginManagePage */ |
502
|
|
|
private $ManagePage; |
503
|
|
|
|
504
|
|
|
/** @var Plugin */ |
505
|
|
|
private $Plugin; |
506
|
|
|
|
507
|
|
|
private $enabled = false; |
508
|
|
|
|
509
|
|
|
/** @var string */ |
510
|
|
|
private $code; |
511
|
|
|
|
512
|
|
|
public function __construct(AcceptanceTester $I, $code) |
513
|
|
|
{ |
514
|
|
|
parent::__construct($I); |
515
|
|
|
$this->code = $code; |
516
|
|
|
} |
517
|
|
|
|
518
|
|
View Code Duplication |
public function インストール() |
|
|
|
|
519
|
|
|
{ |
520
|
|
|
$this->ManagePage = PluginLocalInstallPage::go($this->I) |
521
|
|
|
->アップロード('plugins/'.$this->code.'-1.0.0.tgz'); |
522
|
|
|
|
523
|
|
|
$this->I->see('プラグインをインストールしました。', PluginManagePage::完了メーッセージ); |
524
|
|
|
|
525
|
|
|
$this->tableExists(); |
526
|
|
|
$this->columnExists(); |
527
|
|
|
|
528
|
|
|
$this->Plugin = $this->pluginRepository->findByCode($this->code); |
529
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されていない'); |
530
|
|
|
$this->I->assertFalse($this->Plugin->isEnabled(), '有効化されていない'); |
531
|
|
|
|
532
|
|
|
return $this; |
533
|
|
|
} |
534
|
|
|
|
535
|
|
View Code Duplication |
public function 有効化() |
|
|
|
|
536
|
|
|
{ |
537
|
|
|
$this->ManagePage->独自プラグイン_有効化($this->code); |
538
|
|
|
|
539
|
|
|
$this->tableExists(); |
540
|
|
|
$this->columnExists(); |
541
|
|
|
|
542
|
|
|
$this->em->refresh($this->Plugin); |
543
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている'); |
544
|
|
|
$this->I->assertTrue($this->Plugin->isEnabled(), '有効化されている'); |
545
|
|
|
|
546
|
|
|
$this->enabled = true; |
547
|
|
|
return $this; |
548
|
|
|
} |
549
|
|
|
|
550
|
|
View Code Duplication |
public function 無効化() |
|
|
|
|
551
|
|
|
{ |
552
|
|
|
$this->ManagePage->独自プラグイン_無効化($this->code); |
553
|
|
|
|
554
|
|
|
$this->tableExists(); |
555
|
|
|
$this->columnExists(); |
556
|
|
|
|
557
|
|
|
$this->em->refresh($this->Plugin); |
558
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている'); |
559
|
|
|
$this->I->assertFalse($this->Plugin->isEnabled(), '無効化されている'); |
560
|
|
|
|
561
|
|
|
$this->enabled = false; |
562
|
|
|
|
563
|
|
|
return $this; |
564
|
|
|
} |
565
|
|
|
|
566
|
|
View Code Duplication |
public function 削除() |
|
|
|
|
567
|
|
|
{ |
568
|
|
|
$this->ManagePage->独自プラグイン_削除($this->code); |
569
|
|
|
|
570
|
|
|
$this->I->see('プラグインを削除しました。', PluginManagePage::完了メーッセージ); |
571
|
|
|
|
572
|
|
|
$this->tableNotExists(); |
573
|
|
|
$this->columnNotExists(); |
574
|
|
|
|
575
|
|
|
$this->em->refresh($this->Plugin); |
576
|
|
|
$this->Plugin = $this->pluginRepository->findByCode($this->code); |
577
|
|
|
$this->I->assertNull($this->Plugin, '削除されている'); |
578
|
|
|
|
579
|
|
|
return $this; |
580
|
|
|
} |
581
|
|
|
|
582
|
|
|
public function アップデート() |
583
|
|
|
{ |
584
|
|
|
$this->ManagePage->独自プラグイン_アップデート($this->code, 'plugins/'.$this->code.'-1.0.1.tgz'); |
585
|
|
|
|
586
|
|
|
$this->em->refresh($this->Plugin); |
587
|
|
|
$this->I->assertTrue($this->Plugin->isInitialized(), '初期化されている'); |
588
|
|
|
$this->I->assertEquals($this->enabled, $this->Plugin->isEnabled(), '有効/無効'); |
589
|
|
|
|
590
|
|
|
return $this; |
591
|
|
|
} |
592
|
|
|
} |
593
|
|
|
|
594
|
|
View Code Duplication |
class Horizon_Local extends Local_Plugin |
|
|
|
|
595
|
|
|
{ |
596
|
|
|
public function __construct(AcceptanceTester $I) |
597
|
|
|
{ |
598
|
|
|
parent::__construct($I, 'Horizon'); |
599
|
|
|
$this->table = 'dtb_dash'; |
600
|
|
|
$this->column = 'dtb_cart.is_horizon'; |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
public static function start(AcceptanceTester $I) |
604
|
|
|
{ |
605
|
|
|
return new self($I); |
606
|
|
|
} |
607
|
|
|
} |
608
|
|
|
|
609
|
|
View Code Duplication |
class Horizon_Store extends Store_Plugin |
|
|
|
|
610
|
|
|
{ |
611
|
|
|
public function __construct(AcceptanceTester $I) |
612
|
|
|
{ |
613
|
|
|
parent::__construct($I, 'Horizon'); |
614
|
|
|
$this->table = 'dtb_dash'; |
615
|
|
|
$this->column = 'dtb_cart.is_horizon'; |
616
|
|
|
} |
617
|
|
|
|
618
|
|
|
public static function start(AcceptanceTester $I) |
619
|
|
|
{ |
620
|
|
|
return new self($I); |
621
|
|
|
} |
622
|
|
|
} |