Conditions | 1 |
Paths | 1 |
Total Lines | 76 |
Code Lines | 42 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 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 |
||
67 | public function testShopDomain() |
||
68 | { |
||
69 | $shopDomain = 'test.myshopify.com'; |
||
70 | $return = $this->component->setShopDomain($shopDomain); |
||
71 | $this->assertSame($return, $shopDomain); |
||
72 | $return = $this->component->getShopDomain(); |
||
73 | $this->assertSame($return, $shopDomain); |
||
74 | |||
75 | $shopDomain = 'random.myshopify.com'; |
||
76 | $this->component->setShopDomain($shopDomain); |
||
77 | $return = $this->component->setShopDomain($shopDomain); |
||
78 | $this->assertSame($return, $shopDomain); |
||
79 | $return = $this->component->getShopDomain(); |
||
80 | $this->assertSame($return, $shopDomain); |
||
81 | |||
82 | $shopDomain = null; |
||
83 | $this->assertNull($shopDomain); |
||
84 | $return = $this->component->setShopDomain($shopDomain); |
||
85 | $this->assertNull($return); |
||
86 | $return = $this->component->getShopDomain(); |
||
87 | $this->assertNull($return); |
||
88 | |||
89 | $shopDomain = false; |
||
90 | $this->assertFalse($shopDomain); |
||
91 | $return = $this->component->setShopDomain($shopDomain); |
||
92 | $this->assertFalse($return); |
||
93 | $return = $this->component->getShopDomain(); |
||
94 | $this->assertFalse($return); |
||
95 | |||
96 | $shopDomain = true; |
||
97 | $this->assertTrue($shopDomain); |
||
98 | $return = $this->component->setShopDomain($shopDomain); |
||
99 | $this->assertTrue($return); |
||
100 | $return = $this->component->getShopDomain(); |
||
101 | $this->assertTrue($return); |
||
102 | |||
103 | $shopDomain = 'test.myshopify.com'; |
||
104 | $return = $this->component->validDomain($shopDomain); |
||
105 | $this->assertTrue($return); |
||
106 | |||
107 | $shopDomain = 'TEST.MYshopify.COM'; |
||
108 | $return = $this->component->validDomain($shopDomain); |
||
109 | $this->assertTrue($return); |
||
110 | |||
111 | $shopDomain = 'random.myshopify.com'; |
||
112 | $return = $this->component->validDomain($shopDomain); |
||
113 | $this->assertTrue($return); |
||
114 | |||
115 | $shopDomain = 'www.myshopify.com'; |
||
116 | $return = $this->component->validDomain($shopDomain); |
||
117 | $this->assertTrue($return); |
||
118 | |||
119 | /*$shopDomain = 'test.myshopify.net'; |
||
120 | $return = $this->component->validDomain($shopDomain); |
||
121 | $this->assertFalse($return); |
||
122 | |||
123 | $shopDomain = 'http://test.myshopify.com/'; |
||
124 | $return = $this->component->validDomain($shopDomain); |
||
125 | $this->assertFalse($return); |
||
126 | |||
127 | $shopDomain = 'google.com'; |
||
128 | $return = $this->component->validDomain($shopDomain); |
||
129 | $this->assertFalse($return); |
||
130 | |||
131 | $shopDomain = null; |
||
132 | $return = $this->component->validDomain($shopDomain); |
||
133 | $this->assertFalse($return); |
||
134 | |||
135 | $shopDomain = false; |
||
136 | $return = $this->component->validDomain($shopDomain); |
||
137 | $this->assertFalse($return); |
||
138 | |||
139 | $shopDomain = true; |
||
140 | $return = $this->component->validDomain($shopDomain); |
||
141 | $this->assertFalse($return);*/ |
||
142 | } |
||
143 | |||
216 |