| Conditions | 1 |
| Paths | 1 |
| Total Lines | 83 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 52 | public function インストール(\AcceptanceTester $I) { |
||
| 53 | |||
| 54 | /* |
||
| 55 | * インストール |
||
| 56 | */ |
||
| 57 | |||
| 58 | $ManagePage = PluginSearchPage::go($I) |
||
| 59 | ->入手する('SamplePayment') |
||
| 60 | ->インストール(); |
||
| 61 | |||
| 62 | $I->assertFalse($this->tableExists('plg_sample_payment_config')); |
||
| 63 | $I->assertFalse($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 64 | |||
| 65 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
| 66 | $I->assertFalse($Plugin->isInitialized(), '初期化されていない'); |
||
| 67 | $I->assertFalse($Plugin->isEnabled(), '有効化されていない'); |
||
| 68 | |||
| 69 | /* |
||
| 70 | * 有効化 |
||
| 71 | */ |
||
| 72 | $ManagePage->ストアプラグイン_有効化('SamplePayment'); |
||
| 73 | |||
| 74 | $I->see('「EC-CUBE Payment Sample Plugin」を有効にしました。', PluginManagePage::完了メーッセージ); |
||
| 75 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 76 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 77 | |||
| 78 | |||
| 79 | $this->em->refresh($Plugin); |
||
|
|
|||
| 80 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 81 | $I->assertTrue($Plugin->isEnabled(), '有効化されている'); |
||
| 82 | |||
| 83 | /* |
||
| 84 | * 無効化 |
||
| 85 | */ |
||
| 86 | $ManagePage->ストアプラグイン_無効化('SamplePayment'); |
||
| 87 | |||
| 88 | $I->see('「EC-CUBE Payment Sample Plugin」を無効にしました。', PluginManagePage::完了メーッセージ); |
||
| 89 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 90 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 91 | |||
| 92 | $this->em->refresh($Plugin); |
||
| 93 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 94 | $I->assertFalse($Plugin->isEnabled(), '無効化されている'); |
||
| 95 | |||
| 96 | /* |
||
| 97 | * 再度有効化 |
||
| 98 | */ |
||
| 99 | $ManagePage->ストアプラグイン_有効化('SamplePayment'); |
||
| 100 | |||
| 101 | $I->see('「EC-CUBE Payment Sample Plugin」を有効にしました。', PluginManagePage::完了メーッセージ); |
||
| 102 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 103 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 104 | |||
| 105 | $this->em->refresh($Plugin); |
||
| 106 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 107 | $I->assertTrue($Plugin->isEnabled(), '有効化されている'); |
||
| 108 | |||
| 109 | |||
| 110 | /* |
||
| 111 | * 再度無効化 |
||
| 112 | */ |
||
| 113 | $ManagePage->ストアプラグイン_無効化('SamplePayment'); |
||
| 114 | |||
| 115 | $I->see('「EC-CUBE Payment Sample Plugin」を無効にしました。', PluginManagePage::完了メーッセージ); |
||
| 116 | $I->assertTrue($this->tableExists('plg_sample_payment_config')); |
||
| 117 | $I->assertTrue($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 118 | |||
| 119 | $this->em->refresh($Plugin); |
||
| 120 | $I->assertTrue($Plugin->isInitialized(), '初期化されている'); |
||
| 121 | $I->assertFalse($Plugin->isEnabled(), '無効化されている'); |
||
| 122 | |||
| 123 | /* |
||
| 124 | * 削除 |
||
| 125 | */ |
||
| 126 | $ManagePage->ストアプラグイン_削除('SamplePayment'); |
||
| 127 | |||
| 128 | $I->assertFalse($this->tableExists('plg_sample_payment_config')); |
||
| 129 | $I->assertFalse($this->columnExists('dtb_customer', 'sample_payment_cards')); |
||
| 130 | |||
| 131 | $this->em->refresh($Plugin); |
||
| 132 | $Plugin = $this->pluginRepository->findByCode('SamplePayment'); |
||
| 133 | $I->assertNull($Plugin); |
||
| 134 | } |
||
| 135 | |||
| 145 | } |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: