nanasess /
ec-cube
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use Page\Admin\OwnersPluginPage; |
||
| 4 | |||
| 5 | /** |
||
| 6 | * @group plugin |
||
| 7 | * @group plugin_installer |
||
| 8 | */ |
||
| 9 | class AA00PluginInstallerCest |
||
|
0 ignored issues
–
show
|
|||
| 10 | { |
||
| 11 | const ページタイトル = '#main .page-header'; |
||
| 12 | |||
| 13 | protected $plugins = []; |
||
| 14 | |||
| 15 | View Code Duplication | public function _before(\AcceptanceTester $I) |
|
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
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. Loading history...
|
|||
| 16 | { |
||
| 17 | $fixtures = __DIR__.'/../_data/plugin_fixtures.php'; |
||
| 18 | if (file_exists($fixtures)) { |
||
| 19 | $this->plugins = require $fixtures; |
||
| 20 | } |
||
| 21 | $I->loginAsAdmin(); |
||
| 22 | } |
||
| 23 | |||
| 24 | public function _after(\AcceptanceTester $I) |
||
|
0 ignored issues
–
show
|
|||
| 25 | { |
||
| 26 | } |
||
| 27 | |||
| 28 | public function plugin_プラグインインストール(\AcceptanceTester $I) |
||
| 29 | { |
||
| 30 | $I->wantTo('プラグインインストール'); |
||
| 31 | |||
| 32 | foreach ($this->plugins as $num => $plugin) { |
||
| 33 | $OwnersPluginPage = OwnersPluginPage::go($I) |
||
| 34 | ->goInstall($I); |
||
| 35 | $datadir = __DIR__.'/../_data'; |
||
| 36 | |||
| 37 | if (file_exists($datadir.'/'.$plugin['file'])) { |
||
| 38 | unlink($datadir.'/'.$plugin['file']); |
||
| 39 | } |
||
| 40 | $I->amGoingTo($plugin['file'].' を '.$plugin['url'].' からダウンロードします.'); |
||
| 41 | $archive = file_get_contents($plugin['url']); |
||
| 42 | $save_path = $datadir.'/'.$plugin['file']; |
||
| 43 | file_put_contents($save_path, $archive); |
||
| 44 | $I->amGoingTo($plugin['file'].' を '.$save_path.' に保存しました.'); |
||
| 45 | |||
| 46 | $OwnersPluginPage->インストール($plugin['file']); |
||
| 47 | $I->see('プラグインをインストールしました。', OwnersPluginPage::$完了メッセージ); |
||
| 48 | |||
| 49 | // プラグイン有効化 |
||
| 50 | $OwnersPluginPage->有効にする($plugin['code']); |
||
| 51 | $I->see('プラグインを有効にしました。', OwnersPluginPage::$完了メッセージ); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | } |
||
| 55 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.