| Conditions | 1 |
| Paths | 1 |
| Total Lines | 65 |
| Code Lines | 46 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 120 | public function testRun() |
||
| 121 | { |
||
| 122 | $customerIds = [123, 456]; |
||
| 123 | $emails = ['[email protected]', '[email protected]']; |
||
| 124 | |||
| 125 | $this->configHelper->expects($this->once()) |
||
| 126 | ->method('isEnabled') |
||
| 127 | ->willReturn(true); |
||
| 128 | |||
| 129 | $this->configHelper->expects($this->once()) |
||
| 130 | ->method('isContactExportEnabled') |
||
| 131 | ->willReturn(true); |
||
| 132 | |||
| 133 | $this->customerCollection->expects($this->once()) |
||
| 134 | ->method('addContactOmittedFilter') |
||
| 135 | ->willReturnSelf(); |
||
| 136 | |||
| 137 | $this->customerCollection->expects($this->once()) |
||
| 138 | ->method('getAllIds') |
||
| 139 | ->willReturn($customerIds); |
||
| 140 | |||
| 141 | $this->subscriberCollection->expects($this->once()) |
||
| 142 | ->method('excludeCustomers') |
||
| 143 | ->willReturnSelf(); |
||
| 144 | |||
| 145 | $this->subscriberCollection->expects($this->once()) |
||
| 146 | ->method('addContactOmittedFilter') |
||
| 147 | ->willReturnSelf(); |
||
| 148 | |||
| 149 | $this->subscriberCollection->expects($this->once()) |
||
| 150 | ->method('getAllEmails') |
||
| 151 | ->willReturn($emails); |
||
| 152 | |||
| 153 | $this->publisher->expects($this->exactly(4)) |
||
| 154 | ->method('publish'); |
||
| 155 | |||
| 156 | $this->publisher->expects($this->at(0)) |
||
| 157 | ->method('publish') |
||
| 158 | ->with( |
||
| 159 | Topics::CUSTOMER_CONTACT_EXPORT, |
||
| 160 | json_encode(['magento_customer_id' => $customerIds[0]]) |
||
| 161 | ); |
||
| 162 | |||
| 163 | $this->publisher->expects($this->at(1)) |
||
| 164 | ->method('publish') |
||
| 165 | ->with( |
||
| 166 | Topics::CUSTOMER_CONTACT_EXPORT, |
||
| 167 | json_encode(['magento_customer_id' => $customerIds[1]]) |
||
| 168 | ); |
||
| 169 | |||
| 170 | $this->publisher->expects($this->at(2)) |
||
| 171 | ->method('publish') |
||
| 172 | ->with( |
||
| 173 | Topics::NEWSLETTER_CONTACT_EXPORT, |
||
| 174 | json_encode(['email' => $emails[0]]) |
||
| 175 | ); |
||
| 176 | |||
| 177 | $this->publisher->expects($this->at(3)) |
||
| 178 | ->method('publish') |
||
| 179 | ->with( |
||
| 180 | Topics::NEWSLETTER_CONTACT_EXPORT, |
||
| 181 | json_encode(['email' => $emails[1]]) |
||
| 182 | ); |
||
| 183 | |||
| 184 | $this->exportOmittedContacts->run(); |
||
| 185 | } |
||
| 187 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths