Complex classes like m_domTest 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 m_domTest, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
5 | class m_domTest extends PHPUnit_Framework_TestCase |
||
6 | { |
||
7 | /** |
||
8 | * @var m_dom |
||
9 | */ |
||
10 | protected $object; |
||
11 | |||
12 | /** |
||
13 | * Sets up the fixture, for example, opens a network connection. |
||
14 | * This method is called before a test is executed. |
||
15 | */ |
||
16 | protected function setUp() |
||
21 | |||
22 | /** |
||
23 | * Tears down the fixture, for example, closes a network connection. |
||
24 | * This method is called after a test is executed. |
||
25 | */ |
||
26 | protected function tearDown() |
||
30 | |||
31 | /** |
||
32 | * @covers m_dom::get_panel_url_list |
||
33 | * @todo Implement testGet_panel_url_list(). |
||
34 | */ |
||
35 | public function testGet_panel_url_list() |
||
42 | |||
43 | /** |
||
44 | * @covers m_dom::get_sub_domain_id_and_member_by_name |
||
45 | * @todo Implement testGet_sub_domain_id_and_member_by_name(). |
||
46 | */ |
||
47 | public function testGet_sub_domain_id_and_member_by_name() |
||
54 | |||
55 | /** |
||
56 | * @covers m_dom::hook_menu |
||
57 | * @todo Implement testHook_menu(). |
||
58 | */ |
||
59 | public function testHook_menu() |
||
66 | |||
67 | /** |
||
68 | * @covers m_dom::domains_type_lst |
||
69 | * @todo Implement testDomains_type_lst(). |
||
70 | */ |
||
71 | public function testDomains_type_lst() |
||
78 | |||
79 | /** |
||
80 | * @covers m_dom::domains_type_enable_values |
||
81 | * @todo Implement testDomains_type_enable_values(). |
||
82 | */ |
||
83 | public function testDomains_type_enable_values() |
||
90 | |||
91 | /** |
||
92 | * @covers m_dom::domains_type_target_values |
||
93 | * @todo Implement testDomains_type_target_values(). |
||
94 | */ |
||
95 | public function testDomains_type_target_values() |
||
102 | |||
103 | /** |
||
104 | * @covers m_dom::import_manual_dns_zone |
||
105 | * @todo Implement testImport_manual_dns_zone(). |
||
106 | */ |
||
107 | public function testImport_manual_dns_zone() |
||
114 | |||
115 | /** |
||
116 | * @covers m_dom::import_manual_dns_entry |
||
117 | * @todo Implement testImport_manual_dns_entry(). |
||
118 | */ |
||
119 | public function testImport_manual_dns_entry() |
||
126 | |||
127 | /** |
||
128 | * @covers m_dom::is_it_a_redirect |
||
129 | * @todo Implement testIs_it_a_redirect(). |
||
130 | */ |
||
131 | public function testIs_it_a_redirect() |
||
138 | |||
139 | /** |
||
140 | * @covers m_dom::domains_type_regenerate |
||
141 | * @todo Implement testDomains_type_regenerate(). |
||
142 | */ |
||
143 | public function testDomains_type_regenerate() |
||
150 | |||
151 | /** |
||
152 | * @covers m_dom::domains_type_get |
||
153 | * @todo Implement testDomains_type_get(). |
||
154 | */ |
||
155 | public function testDomains_type_get() |
||
162 | |||
163 | /** |
||
164 | * @covers m_dom::domains_type_del |
||
165 | * @todo Implement testDomains_type_del(). |
||
166 | */ |
||
167 | public function testDomains_type_del() |
||
174 | |||
175 | /** |
||
176 | * @covers m_dom::domains_type_update |
||
177 | * @todo Implement testDomains_type_update(). |
||
178 | */ |
||
179 | public function testDomains_type_update() |
||
186 | |||
187 | /** |
||
188 | * @covers m_dom::sub_domain_change_status |
||
189 | * @todo Implement testSub_domain_change_status(). |
||
190 | */ |
||
191 | public function testSub_domain_change_status() |
||
198 | |||
199 | /** |
||
200 | * @covers m_dom::enum_domains |
||
201 | * @todo Implement testEnum_domains(). |
||
202 | */ |
||
203 | public function testEnum_domains() |
||
210 | |||
211 | /** |
||
212 | * @covers m_dom::del_domain_cancel |
||
213 | * @todo Implement testDel_domain_cancel(). |
||
214 | */ |
||
215 | public function testDel_domain_cancel() |
||
222 | |||
223 | /** |
||
224 | * @covers m_dom::del_domain |
||
225 | * @todo Implement testDel_domain(). |
||
226 | */ |
||
227 | public function testDel_domain() |
||
234 | |||
235 | /** |
||
236 | * @covers m_dom::domshort |
||
237 | * @todo Implement testDomshort(). |
||
238 | */ |
||
239 | public function testDomshort() |
||
246 | |||
247 | /** |
||
248 | * @covers m_dom::add_domain |
||
249 | * @todo Implement testAdd_domain(). |
||
250 | */ |
||
251 | public function testAdd_domain() |
||
258 | |||
259 | /** |
||
260 | * @covers m_dom::create_default_subdomains |
||
261 | * @todo Implement testCreate_default_subdomains(). |
||
262 | */ |
||
263 | public function testCreate_default_subdomains() |
||
270 | |||
271 | /** |
||
272 | * @covers m_dom::domdefaultdir |
||
273 | * @todo Implement testDomdefaultdir(). |
||
274 | */ |
||
275 | public function testDomdefaultdir() |
||
282 | |||
283 | /** |
||
284 | * @covers m_dom::dump_axfr |
||
285 | * @todo Implement testDump_axfr(). |
||
286 | */ |
||
287 | public function testDump_axfr() |
||
294 | |||
295 | /** |
||
296 | * @covers m_dom::lst_default_subdomains |
||
297 | * @todo Implement testLst_default_subdomains(). |
||
298 | */ |
||
299 | public function testLst_default_subdomains() |
||
306 | |||
307 | /** |
||
308 | * @covers m_dom::update_default_subdomains |
||
309 | * @todo Implement testUpdate_default_subdomains(). |
||
310 | */ |
||
311 | public function testUpdate_default_subdomains() |
||
318 | |||
319 | /** |
||
320 | * @covers m_dom::update_one_default |
||
321 | * @todo Implement testUpdate_one_default(). |
||
322 | */ |
||
323 | public function testUpdate_one_default() |
||
330 | |||
331 | /** |
||
332 | * @covers m_dom::del_default_type |
||
333 | * @todo Implement testDel_default_type(). |
||
334 | */ |
||
335 | public function testDel_default_type() |
||
342 | |||
343 | /** |
||
344 | * @covers m_dom::whois |
||
345 | * @todo Implement testWhois(). |
||
346 | */ |
||
347 | public function testWhois() |
||
354 | |||
355 | /** |
||
356 | * @covers m_dom::checkmx |
||
357 | * @todo Implement testCheckmx(). |
||
358 | */ |
||
359 | public function testCheckmx() |
||
366 | |||
367 | /** |
||
368 | * @covers m_dom::get_domain_all |
||
369 | * @todo Implement testGet_domain_all(). |
||
370 | */ |
||
371 | public function testGet_domain_all() |
||
378 | |||
379 | /** |
||
380 | * @covers m_dom::get_sub_domain_all |
||
381 | * @todo Implement testGet_sub_domain_all(). |
||
382 | */ |
||
383 | public function testGet_sub_domain_all() |
||
390 | |||
391 | /** |
||
392 | * @covers m_dom::check_type_value |
||
393 | * @todo Implement testCheck_type_value(). |
||
394 | */ |
||
395 | public function testCheck_type_value() |
||
402 | |||
403 | /** |
||
404 | * @covers m_dom::can_create_subdomain |
||
405 | * @todo Implement testCan_create_subdomain(). |
||
406 | */ |
||
407 | public function testCan_create_subdomain() |
||
414 | |||
415 | /** |
||
416 | * @covers m_dom::set_sub_domain |
||
417 | * @todo Implement testSet_sub_domain(). |
||
418 | */ |
||
419 | public function testSet_sub_domain() |
||
426 | |||
427 | /** |
||
428 | * @covers m_dom::del_sub_domain |
||
429 | * @todo Implement testDel_sub_domain(). |
||
430 | */ |
||
431 | public function testDel_sub_domain() |
||
438 | |||
439 | /** |
||
440 | * @covers m_dom::set_ttl |
||
441 | * @todo Implement testSet_ttl(). |
||
442 | */ |
||
443 | public function testSet_ttl() |
||
450 | |||
451 | /** |
||
452 | * @covers m_dom::edit_domain |
||
453 | * @todo Implement testEdit_domain(). |
||
454 | */ |
||
455 | public function testEdit_domain() |
||
462 | |||
463 | /** |
||
464 | * @covers m_dom::enum_slave_ip |
||
465 | * @todo Implement testEnum_slave_ip(). |
||
466 | */ |
||
467 | public function testEnum_slave_ip() |
||
474 | |||
475 | /** |
||
476 | * @covers m_dom::add_slave_ip |
||
477 | * @todo Implement testAdd_slave_ip(). |
||
478 | */ |
||
479 | public function testAdd_slave_ip() |
||
486 | |||
487 | /** |
||
488 | * @covers m_dom::del_slave_ip |
||
489 | * @todo Implement testDel_slave_ip(). |
||
490 | */ |
||
491 | public function testDel_slave_ip() |
||
498 | |||
499 | /** |
||
500 | * @covers m_dom::check_slave_account |
||
501 | * @todo Implement testCheck_slave_account(). |
||
502 | */ |
||
503 | public function testCheck_slave_account() |
||
510 | |||
511 | /** |
||
512 | * @covers m_dom::echo_domain_list |
||
513 | * @todo Implement testEcho_domain_list(). |
||
514 | */ |
||
515 | public function testEcho_domain_list() |
||
522 | |||
523 | /** |
||
524 | * @covers m_dom::get_domain_list |
||
525 | * @todo Implement testGet_domain_list(). |
||
526 | */ |
||
527 | public function testGet_domain_list() |
||
534 | |||
535 | /** |
||
536 | * @covers m_dom::get_domain_all_summary |
||
537 | * @todo Implement testGet_domain_all_summary(). |
||
538 | */ |
||
539 | public function testGet_domain_all_summary() |
||
546 | |||
547 | /** |
||
548 | * @covers m_dom::get_domain_byid |
||
549 | * @todo Implement testGet_domain_byid(). |
||
550 | */ |
||
551 | public function testGet_domain_byid() |
||
558 | |||
559 | /** |
||
560 | * @covers m_dom::get_domain_byname |
||
561 | * @todo Implement testGet_domain_byname(). |
||
562 | */ |
||
563 | public function testGet_domain_byname() |
||
570 | |||
571 | /** |
||
572 | * @covers m_dom::count_domains_all |
||
573 | * @todo Implement testCount_domains_all(). |
||
574 | */ |
||
575 | public function testCount_domains_all() |
||
582 | |||
583 | /** |
||
584 | * @covers m_dom::enum_slave_account |
||
585 | * @todo Implement testEnum_slave_account(). |
||
586 | */ |
||
587 | public function testEnum_slave_account() |
||
594 | |||
595 | /** |
||
596 | * @covers m_dom::add_slave_account |
||
597 | * @todo Implement testAdd_slave_account(). |
||
598 | */ |
||
599 | public function testAdd_slave_account() |
||
606 | |||
607 | /** |
||
608 | * @covers m_dom::del_slave_account |
||
609 | * @todo Implement testDel_slave_account(). |
||
610 | */ |
||
611 | public function testDel_slave_account() |
||
618 | |||
619 | /** |
||
620 | * @covers m_dom::lock |
||
621 | * @todo Implement testLock(). |
||
622 | */ |
||
623 | public function testLock() |
||
630 | |||
631 | /** |
||
632 | * @covers m_dom::unlock |
||
633 | * @todo Implement testUnlock(). |
||
634 | */ |
||
635 | public function testUnlock() |
||
642 | |||
643 | /** |
||
644 | * @covers m_dom::hook_dom_add_mx_domain |
||
645 | * @todo Implement testHook_dom_add_mx_domain(). |
||
646 | */ |
||
647 | public function testHook_dom_add_mx_domain() |
||
654 | |||
655 | /** |
||
656 | * @covers m_dom::hook_admin_del_member |
||
657 | * @todo Implement testHook_admin_del_member(). |
||
658 | */ |
||
659 | public function testHook_admin_del_member() |
||
666 | |||
667 | /** |
||
668 | * @covers m_dom::hook_quota_get |
||
669 | * @todo Implement testHook_quota_get(). |
||
670 | */ |
||
671 | public function testHook_quota_get() |
||
678 | |||
679 | /** |
||
680 | * @covers m_dom::alternc_export_conf |
||
681 | * @todo Implement testAlternc_export_conf(). |
||
682 | */ |
||
683 | public function testAlternc_export_conf() |
||
690 | |||
691 | /** |
||
692 | * @covers m_dom::generation_parameters |
||
693 | * @todo Implement testGeneration_parameters(). |
||
694 | */ |
||
695 | public function testGeneration_parameters() |
||
702 | |||
703 | /** |
||
704 | * @covers m_dom::generation_domains_type |
||
705 | * @todo Implement testGeneration_domains_type(). |
||
706 | */ |
||
707 | public function testGeneration_domains_type() |
||
714 | |||
715 | /** |
||
716 | * @covers m_dom::generate_conf_oldhook |
||
717 | * @todo Implement testGenerate_conf_oldhook(). |
||
718 | */ |
||
719 | public function testGenerate_conf_oldhook() |
||
726 | |||
727 | /** |
||
728 | * @covers m_dom::generate_apacheconf |
||
729 | * @todo Implement testGenerate_apacheconf(). |
||
730 | */ |
||
731 | public function testGenerate_apacheconf() |
||
738 | |||
739 | /** |
||
740 | * @covers m_dom::generation_todo |
||
741 | * @todo Implement testGeneration_todo(). |
||
742 | */ |
||
743 | public function testGeneration_todo() |
||
750 | |||
751 | /** |
||
752 | * @covers m_dom::subdomain_modif_are_done |
||
753 | * @todo Implement testSubdomain_modif_are_done(). |
||
754 | */ |
||
755 | public function testSubdomain_modif_are_done() |
||
762 | |||
763 | /** |
||
764 | * @covers m_dom::set_dns_action |
||
765 | * @todo Implement testSet_dns_action(). |
||
766 | */ |
||
767 | public function testSet_dns_action() |
||
774 | |||
775 | /** |
||
776 | * @covers m_dom::set_dns_result |
||
777 | * @todo Implement testSet_dns_result(). |
||
778 | */ |
||
779 | public function testSet_dns_result() |
||
786 | |||
787 | /** |
||
788 | * @covers m_dom::hook_upnp_list |
||
789 | * @todo Implement testHook_upnp_list(). |
||
790 | */ |
||
791 | public function testHook_upnp_list() |
||
798 | |||
799 | /** |
||
800 | * @covers m_dom::get_problems |
||
801 | * @todo Implement testGet_problems(). |
||
802 | */ |
||
803 | public function testGet_problems() |
||
810 | |||
811 | /** |
||
812 | * @covers m_dom::default_domain_type |
||
813 | * @todo Implement testDefault_domain_type(). |
||
814 | */ |
||
815 | public function testDefault_domain_type() |
||
822 | } |
||
823 |