1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of EC-CUBE |
5
|
|
|
* |
6
|
|
|
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved. |
7
|
|
|
* |
8
|
|
|
* http://www.ec-cube.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 Page\Admin\OwnersPluginPage; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @group plugin |
18
|
|
|
* @group plugin_installer |
19
|
|
|
*/ |
20
|
|
|
class AA00PluginInstallerCest |
21
|
|
|
{ |
22
|
|
|
const ページタイトル = '#main .page-header'; |
23
|
|
|
|
24
|
|
|
protected $plugins = []; |
25
|
|
|
|
26
|
|
View Code Duplication |
public function _before(\AcceptanceTester $I) |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
$fixtures = __DIR__.'/../_data/plugin_fixtures.php'; |
29
|
|
|
if (file_exists($fixtures)) { |
30
|
|
|
$this->plugins = require $fixtures; |
31
|
|
|
} |
32
|
|
|
$I->loginAsAdmin(); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function _after(\AcceptanceTester $I) |
|
|
|
|
36
|
|
|
{ |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function plugin_プラグインインストール(\AcceptanceTester $I) |
40
|
|
|
{ |
41
|
|
|
$I->wantTo('プラグインインストール'); |
42
|
|
|
|
43
|
|
|
foreach ($this->plugins as $num => $plugin) { |
44
|
|
|
$OwnersPluginPage = OwnersPluginPage::go($I) |
45
|
|
|
->goInstall($I); |
46
|
|
|
$datadir = __DIR__.'/../_data'; |
47
|
|
|
|
48
|
|
|
if (file_exists($datadir.'/'.$plugin['file'])) { |
49
|
|
|
unlink($datadir.'/'.$plugin['file']); |
50
|
|
|
} |
51
|
|
|
$I->amGoingTo($plugin['file'].' を '.$plugin['url'].' からダウンロードします.'); |
52
|
|
|
$archive = file_get_contents($plugin['url']); |
53
|
|
|
$save_path = $datadir.'/'.$plugin['file']; |
54
|
|
|
file_put_contents($save_path, $archive); |
55
|
|
|
$I->amGoingTo($plugin['file'].' を '.$save_path.' に保存しました.'); |
56
|
|
|
|
57
|
|
|
$OwnersPluginPage->インストール($plugin['file']); |
58
|
|
|
$I->see('プラグインをインストールしました。', OwnersPluginPage::$完了メッセージ); |
59
|
|
|
|
60
|
|
|
// プラグイン有効化 |
61
|
|
|
$OwnersPluginPage->有効にする($plugin['code']); |
62
|
|
|
$I->see('プラグインを有効にしました。', OwnersPluginPage::$完了メッセージ); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.