| Total Complexity | 70 |
| Total Lines | 357 |
| Duplicated Lines | 0 % |
| Changes | 9 | ||
| Bugs | 1 | Features | 4 |
Complex classes like EntityTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use EntityTest, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 11 | class EntityTest extends TestCase |
||
| 12 | { |
||
| 13 | |||
| 14 | public function testAccountEntity() |
||
| 15 | { |
||
| 16 | $this->performEntityTest(\Picqer\Financials\Exact\Account::class); |
||
| 17 | } |
||
| 18 | |||
| 19 | public function testAccountClassificationEntity() |
||
| 22 | } |
||
| 23 | |||
| 24 | public function testAccountItemEntity() |
||
| 25 | { |
||
| 26 | $this->performEntityTest(\Picqer\Financials\Exact\AccountItem::class); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testAddressEntity() |
||
| 30 | { |
||
| 31 | $this->performEntityTest(\Picqer\Financials\Exact\Address::class); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function testBankAccountEntity() |
||
| 35 | { |
||
| 36 | $this->performEntityTest(\Picqer\Financials\Exact\BankAccount::class); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function testBankEntryEntity() |
||
| 40 | { |
||
| 41 | $this->performEntityTest(\Picqer\Financials\Exact\BankEntry::class); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function testBankEntryLineEntity() |
||
| 45 | { |
||
| 46 | $this->performEntityTest(\Picqer\Financials\Exact\BankEntryLine::class); |
||
| 47 | } |
||
| 48 | |||
| 49 | public function testBudgetEntity() |
||
| 50 | { |
||
| 51 | $this->performEntityTest(\Picqer\Financials\Exact\Budget::class); |
||
| 52 | } |
||
| 53 | |||
| 54 | public function testCashEntryEntity() |
||
| 55 | { |
||
| 56 | $this->performEntityTest(\Picqer\Financials\Exact\CashEntry::class); |
||
| 57 | } |
||
| 58 | |||
| 59 | public function testCashEntryLineEntity() |
||
| 60 | { |
||
| 61 | $this->performEntityTest(\Picqer\Financials\Exact\CashEntryLine::class); |
||
| 62 | } |
||
| 63 | |||
| 64 | public function testContactEntity() |
||
| 65 | { |
||
| 66 | $this->performEntityTest(\Picqer\Financials\Exact\Contact::class); |
||
| 67 | } |
||
| 68 | |||
| 69 | public function testCostcenterEntity() |
||
| 72 | } |
||
| 73 | |||
| 74 | public function testCostunitEntity() |
||
| 75 | { |
||
| 76 | $this->performEntityTest(\Picqer\Financials\Exact\Costunit::class); |
||
| 77 | } |
||
| 78 | |||
| 79 | public function testDirectDebitMandateEntity() |
||
| 80 | { |
||
| 81 | $this->performEntityTest(\Picqer\Financials\Exact\DirectDebitMandate::class); |
||
| 82 | } |
||
| 83 | |||
| 84 | public function testDivisionEntity() |
||
| 85 | { |
||
| 86 | $this->performEntityTest(\Picqer\Financials\Exact\Division::class); |
||
| 87 | } |
||
| 88 | |||
| 89 | public function testSystemDivisionEntity() |
||
| 90 | { |
||
| 91 | $this->performEntityTest(\Picqer\Financials\Exact\SystemDivision::class); |
||
| 92 | } |
||
| 93 | |||
| 94 | public function testDocumentEntity() |
||
| 95 | { |
||
| 96 | $this->performEntityTest(\Picqer\Financials\Exact\Document::class); |
||
| 97 | } |
||
| 98 | |||
| 99 | public function testDocumentAttachmentEntity() |
||
| 100 | { |
||
| 101 | $this->performEntityTest(\Picqer\Financials\Exact\DocumentAttachment::class); |
||
| 102 | } |
||
| 103 | |||
| 104 | public function testGeneralJournalEntity() |
||
| 105 | { |
||
| 106 | $this->performEntityTest(\Picqer\Financials\Exact\GeneralJournalEntry::class); |
||
| 107 | } |
||
| 108 | |||
| 109 | public function testGeneralJournalEntryLineEntity() |
||
| 110 | { |
||
| 111 | $this->performEntityTest(\Picqer\Financials\Exact\GeneralJournalEntryLine::class); |
||
| 112 | } |
||
| 113 | |||
| 114 | public function testGLAccountEntity() |
||
| 115 | { |
||
| 116 | $this->performEntityTest(\Picqer\Financials\Exact\GLAccount::class); |
||
| 117 | } |
||
| 118 | |||
| 119 | public function testInvoiceSalesOrdersEntity() |
||
| 120 | { |
||
| 121 | $this->performEntityTest(\Picqer\Financials\Exact\InvoiceSalesOrder::class); |
||
| 122 | } |
||
| 123 | |||
| 124 | public function testItemEntity() |
||
| 125 | { |
||
| 126 | $this->performEntityTest(\Picqer\Financials\Exact\Item::class); |
||
| 127 | } |
||
| 128 | |||
| 129 | public function testItemGroupEntity() |
||
| 130 | { |
||
| 131 | $this->performEntityTest(\Picqer\Financials\Exact\ItemGroup::class); |
||
| 132 | } |
||
| 133 | |||
| 134 | public function testItemWarehouseEntity() |
||
| 135 | { |
||
| 136 | $this->performEntityTest(\Picqer\Financials\Exact\ItemWarehouse::class); |
||
| 137 | } |
||
| 138 | |||
| 139 | public function testJournalEntity() |
||
| 140 | { |
||
| 141 | $this->performEntityTest(\Picqer\Financials\Exact\Journal::class); |
||
| 142 | } |
||
| 143 | |||
| 144 | public function testLayoutEntity() |
||
| 145 | { |
||
| 146 | $this->performEntityTest(\Picqer\Financials\Exact\Layout::class); |
||
| 147 | } |
||
| 148 | |||
| 149 | public function testMailMessageEntity() |
||
| 150 | { |
||
| 151 | $this->performEntityTest(\Picqer\Financials\Exact\MailMessage::class); |
||
| 152 | } |
||
| 153 | |||
| 154 | public function testMailMessageAttachmentEntity() |
||
| 155 | { |
||
| 156 | $this->performEntityTest(\Picqer\Financials\Exact\MailMessageAttachment::class); |
||
| 157 | } |
||
| 158 | |||
| 159 | public function testMeEntity() |
||
| 160 | { |
||
| 161 | $this->performEntityTest(\Picqer\Financials\Exact\Me::class); |
||
| 162 | } |
||
| 163 | |||
| 164 | public function testPayablesListEntity() |
||
| 167 | } |
||
| 168 | |||
| 169 | public function testPaymentConditionEntity() |
||
| 170 | { |
||
| 171 | $this->performEntityTest(\Picqer\Financials\Exact\PaymentCondition::class); |
||
| 172 | } |
||
| 173 | |||
| 174 | public function testPrintedSalesInvoiceEntity() |
||
| 177 | } |
||
| 178 | |||
| 179 | public function testProfitLossOverviewEntity() |
||
| 180 | { |
||
| 182 | } |
||
| 183 | |||
| 184 | public function testPurchaseEntryEntity() |
||
| 187 | } |
||
| 188 | |||
| 189 | public function testPurchaseEntryLineEntity() |
||
| 190 | { |
||
| 191 | $this->performEntityTest(\Picqer\Financials\Exact\PurchaseEntryLine::class); |
||
| 192 | } |
||
| 193 | |||
| 194 | public function testPurchaseInvoiceEntity() |
||
| 195 | { |
||
| 196 | $this->performEntityTest(\Picqer\Financials\Exact\PurchaseInvoice::class); |
||
| 197 | } |
||
| 198 | |||
| 199 | public function testPurchaseInvoiceLineEntity() |
||
| 200 | { |
||
| 201 | $this->performEntityTest(\Picqer\Financials\Exact\PurchaseInvoiceLine::class); |
||
| 202 | } |
||
| 203 | |||
| 204 | public function testPurchaseOrderEntity() |
||
| 205 | { |
||
| 206 | $this->performEntityTest(\Picqer\Financials\Exact\PurchaseOrder::class); |
||
| 207 | } |
||
| 208 | |||
| 209 | public function testPurchaseOrderLineEntity() |
||
| 210 | { |
||
| 211 | $this->performEntityTest(\Picqer\Financials\Exact\PurchaseOrderLine::class); |
||
| 212 | } |
||
| 213 | |||
| 214 | public function testQuotationEntity() |
||
| 215 | { |
||
| 216 | $this->performEntityTest(\Picqer\Financials\Exact\Quotation::class); |
||
| 217 | } |
||
| 218 | |||
| 219 | public function testQuotationLineEntity() |
||
| 220 | { |
||
| 221 | $this->performEntityTest(\Picqer\Financials\Exact\QuotationLine::class); |
||
| 222 | } |
||
| 223 | |||
| 224 | public function testReceivableListEntity() |
||
| 225 | { |
||
| 226 | $this->performEntityTest(\Picqer\Financials\Exact\ReceivableList::class); |
||
| 227 | } |
||
| 228 | |||
| 229 | public function testReportingBalanceEntity() |
||
| 230 | { |
||
| 231 | $this->performEntityTest(\Picqer\Financials\Exact\ReportingBalance::class); |
||
| 232 | } |
||
| 233 | |||
| 234 | public function testSalesEntryEntity() |
||
| 235 | { |
||
| 236 | $this->performEntityTest(\Picqer\Financials\Exact\SalesEntry::class); |
||
| 237 | } |
||
| 238 | |||
| 239 | public function testSalesEntryLineEntity() |
||
| 242 | } |
||
| 243 | |||
| 244 | public function testSalesInvoiceEntity() |
||
| 245 | { |
||
| 246 | $this->performEntityTest(\Picqer\Financials\Exact\SalesInvoice::class); |
||
| 247 | } |
||
| 248 | |||
| 249 | public function testSalesInvoiceLineEntity() |
||
| 250 | { |
||
| 251 | $this->performEntityTest(\Picqer\Financials\Exact\SalesInvoiceLine::class); |
||
| 252 | } |
||
| 253 | |||
| 254 | public function testSalesItemPriceEntity() |
||
| 255 | { |
||
| 256 | $this->performEntityTest(\Picqer\Financials\Exact\SalesItemPrice::class); |
||
| 257 | } |
||
| 258 | |||
| 259 | public function testSalesOrderEntity() |
||
| 262 | } |
||
| 263 | |||
| 264 | public function testSalesOrderLineEntity() |
||
| 265 | { |
||
| 266 | $this->performEntityTest(\Picqer\Financials\Exact\SalesOrderLine::class); |
||
| 267 | } |
||
| 268 | |||
| 269 | public function testShippingMethodEntity() |
||
| 270 | { |
||
| 271 | $this->performEntityTest(\Picqer\Financials\Exact\ShippingMethod::class); |
||
| 272 | } |
||
| 273 | |||
| 274 | public function testStockPositionEntity() |
||
| 275 | { |
||
| 276 | $this->performEntityTest(\Picqer\Financials\Exact\StockPosition::class); |
||
| 277 | } |
||
| 278 | |||
| 279 | public function testSubscriptionEntity() |
||
| 282 | } |
||
| 283 | |||
| 284 | public function testSubscriptionLineEntity() |
||
| 285 | { |
||
| 286 | $this->performEntityTest(\Picqer\Financials\Exact\SubscriptionLine::class); |
||
| 287 | } |
||
| 288 | |||
| 289 | public function testSubscriptionTypeEntity() |
||
| 290 | { |
||
| 291 | $this->performEntityTest(\Picqer\Financials\Exact\SubscriptionType::class); |
||
| 292 | } |
||
| 293 | |||
| 294 | public function testSupplierItemEntity() |
||
| 295 | { |
||
| 296 | $this->performEntityTest(\Picqer\Financials\Exact\SupplierItem::class); |
||
| 297 | } |
||
| 298 | |||
| 299 | public function testTransactionEntity() |
||
| 300 | { |
||
| 301 | $this->performEntityTest(\Picqer\Financials\Exact\Transaction::class); |
||
| 302 | } |
||
| 303 | |||
| 304 | public function testTransactionLineEntity() |
||
| 305 | { |
||
| 306 | $this->performEntityTest(\Picqer\Financials\Exact\TransactionLine::class); |
||
| 307 | } |
||
| 308 | |||
| 309 | public function testUnitsEntity() |
||
| 312 | } |
||
| 313 | |||
| 314 | public function testVatcodeEntity() |
||
| 315 | { |
||
| 316 | $this->performEntityTest(\Picqer\Financials\Exact\VatCode::class); |
||
| 317 | } |
||
| 318 | |||
| 319 | public function testWebhookSubscriptionEntity() |
||
| 320 | { |
||
| 321 | $this->performEntityTest(\Picqer\Financials\Exact\WebhookSubscription::class); |
||
| 322 | } |
||
| 323 | |||
| 324 | public function testStockCountEntity() |
||
| 325 | { |
||
| 326 | $this->performEntityTest(\Picqer\Financials\Exact\StockCount::class); |
||
| 327 | } |
||
| 328 | |||
| 329 | public function testStockCountLineEntity() |
||
| 330 | { |
||
| 331 | $this->performEntityTest(\Picqer\Financials\Exact\StockCountLine::class); |
||
| 332 | } |
||
| 333 | |||
| 334 | public function testWarehouseEntity() |
||
| 335 | { |
||
| 336 | $this->performEntityTest(\Picqer\Financials\Exact\Warehouse::class); |
||
| 337 | } |
||
| 338 | |||
| 339 | public function testStorageLocationEntity() |
||
| 340 | { |
||
| 341 | $this->performEntityTest(\Picqer\Financials\Exact\StorageLocation::class); |
||
| 342 | } |
||
| 343 | |||
| 344 | public function testGoodsDeliveryEntity() |
||
| 345 | { |
||
| 346 | $this->performEntityTest(\Picqer\Financials\Exact\GoodsDelivery::class); |
||
| 347 | } |
||
| 348 | |||
| 349 | public function testGoodsDeliveryLineEntity() |
||
| 350 | { |
||
| 351 | $this->performEntityTest(\Picqer\Financials\Exact\GoodsDeliveryLine::class); |
||
| 352 | } |
||
| 353 | |||
| 354 | public function testSalesOrderIDEntity() |
||
| 357 | } |
||
| 358 | |||
| 359 | protected function performEntityTest($entityName) |
||
| 360 | { |
||
| 361 | $reflectionClass = new ReflectionClass($entityName); |
||
| 362 | |||
| 363 | $this->assertTrue($reflectionClass->isInstantiable()); |
||
| 368 | } |
||
| 369 | |||
| 370 | } |
||
| 371 |