| Conditions | 1 |
| Paths | 1 |
| Total Lines | 73 |
| Code Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| 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 | $return = $this->component->setShopDomain($shopDomain); |
||
| 84 | $this->assertNull($return); |
||
| 85 | $return = $this->component->getShopDomain(); |
||
| 86 | $this->assertNull($return); |
||
| 87 | |||
| 88 | $shopDomain = false; |
||
| 89 | $return = $this->component->setShopDomain($shopDomain); |
||
| 90 | $this->assertFalse($return); |
||
| 91 | $return = $this->component->getShopDomain(); |
||
| 92 | $this->assertFalse($return); |
||
| 93 | |||
| 94 | $shopDomain = true; |
||
| 95 | $return = $this->component->setShopDomain($shopDomain); |
||
| 96 | $this->assertTrue($return); |
||
| 97 | $return = $this->component->getShopDomain(); |
||
| 98 | $this->assertTrue($return); |
||
| 99 | |||
| 100 | $shopDomain = "test.myshopify.com"; |
||
| 101 | $return = $this->component->validDomain($shopDomain); |
||
| 102 | $this->assertTrue($return); |
||
| 103 | |||
| 104 | $shopDomain = "TEST.MYshopify.COM"; |
||
| 105 | $return = $this->component->validDomain($shopDomain); |
||
| 106 | $this->assertTrue($return); |
||
| 107 | |||
| 108 | $shopDomain = "random.myshopify.com"; |
||
| 109 | $return = $this->component->validDomain($shopDomain); |
||
| 110 | $this->assertTrue($return); |
||
| 111 | |||
| 112 | $shopDomain = "www.myshopify.com"; |
||
| 113 | $return = $this->component->validDomain($shopDomain); |
||
| 114 | $this->assertTrue($return); |
||
| 115 | |||
| 116 | /*$shopDomain = "test.myshopify.net"; |
||
| 117 | $return = $this->component->validDomain($shopDomain); |
||
| 118 | $this->assertFalse($return); |
||
| 119 | |||
| 120 | $shopDomain = "http://test.myshopify.com/"; |
||
| 121 | $return = $this->component->validDomain($shopDomain); |
||
| 122 | $this->assertFalse($return); |
||
| 123 | |||
| 124 | $shopDomain = "google.com"; |
||
| 125 | $return = $this->component->validDomain($shopDomain); |
||
| 126 | $this->assertFalse($return); |
||
| 127 | |||
| 128 | $shopDomain = NULL; |
||
| 129 | $return = $this->component->validDomain($shopDomain); |
||
| 130 | $this->assertFalse($return); |
||
| 131 | |||
| 132 | $shopDomain = false; |
||
| 133 | $return = $this->component->validDomain($shopDomain); |
||
| 134 | $this->assertFalse($return); |
||
| 135 | |||
| 136 | $shopDomain = true; |
||
| 137 | $return = $this->component->validDomain($shopDomain); |
||
| 138 | $this->assertFalse($return);*/ |
||
| 139 | } |
||
| 140 | |||
| 204 |