Completed
Push — 4.0 ( 268f2c...88f012 )
by Hideki
05:48 queued 10s
created

codeception/acceptance/AA0PluginInstallerCest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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)
0 ignored issues
show
The parameter $I is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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