Failed Conditions
Push — modify-scrutinizeryml ( 361e25...08b4c1 )
by Kentaro
63:54 queued 57:30
created

EA09PluginUninstallerCest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 52.63 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 20
loc 38
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 8 8 2
A _after() 0 3 1
A plugin_プラグインアンインストール() 12 18 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
use Page\Admin\OwnersPluginPage;
4
5
/**
6
 * @group plugin
7
 * @group plugin_uninstaller
8
 */
9
class EA09PluginUninstallerCest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
10
{
11
    const ページタイトル = '#main .page-header';
12
13
    protected $plugins = [];
14
15 View Code Duplication
    public function _before(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
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
Unused Code introduced by
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...
25
    {
26
    }
27
28
    public function plugin_プラグインアンインストール(\AcceptanceTester $I)
29
    {
30
        $I->wantTo('プラグインアンインストール');
31
32 View Code Duplication
        foreach ($this->plugins as $num => $plugin) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
33
34
            // プラグイン無効化
35
            OwnersPluginPage::go($I)->無効にする($plugin['code']);
36
            $I->see('プラグインを無効にしました。', OwnersPluginPage::$完了メッセージ);
37
        }
38
39 View Code Duplication
        foreach ($this->plugins as $num => $plugin) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
40
41
            // プラグイン削除
42
            OwnersPluginPage::go($I)->削除($plugin['code']);
43
            $I->see(' プラグインを削除しました。', OwnersPluginPage::$完了メッセージ);
44
        }
45
    }
46
}
47