| Conditions | 3 |
| Paths | 4 |
| Total Lines | 80 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 134 | public function testLoad(): void { |
||
| 135 | |||
| 136 | $obj = new WBWCoreExtension(); |
||
| 137 | |||
| 138 | $this->assertNull($obj->load($this->configs, $this->containerBuilder)); |
||
| 139 | |||
| 140 | // Commands |
||
| 141 | $this->assertInstanceOf(CopySkeletonCommand::class, $this->containerBuilder->get(CopySkeletonCommand::SERVICE_NAME)); |
||
| 142 | $this->assertInstanceOf(UnzipAssetsCommand::class, $this->containerBuilder->get(UnzipAssetsCommand::SERVICE_NAME)); |
||
| 143 | |||
| 144 | // Event listeners |
||
| 145 | $this->assertInstanceOf(KernelEventListener::class, $this->containerBuilder->get(KernelEventListener::SERVICE_NAME)); |
||
| 146 | $this->assertInstanceOf(NotificationEventListener::class, $this->containerBuilder->get(NotificationEventListener::SERVICE_NAME)); |
||
| 147 | $this->assertInstanceOf(ToastEventListener::class, $this->containerBuilder->get(ToastEventListener::SERVICE_NAME)); |
||
| 148 | |||
| 149 | try { |
||
| 150 | |||
| 151 | $this->containerBuilder->get(SecurityEventListener::SERVICE_NAME); |
||
| 152 | } catch (Exception $ex) { |
||
| 153 | |||
| 154 | $this->assertInstanceOf(ServiceNotFoundException::class, $ex); |
||
| 155 | $this->assertStringContainsString(SecurityEventListener::SERVICE_NAME, $ex->getMessage()); |
||
| 156 | } |
||
| 157 | |||
| 158 | // Helpers |
||
| 159 | $this->assertInstanceOf(FormHelper::class, $this->containerBuilder->get(FormHelper::SERVICE_NAME)); |
||
| 160 | $this->assertInstanceOf(RepositoryHelper::class, $this->containerBuilder->get(RepositoryHelper::SERVICE_NAME)); |
||
| 161 | |||
| 162 | // Managers |
||
| 163 | $this->assertInstanceOf(ColorManager::class, $this->containerBuilder->get(ColorManager::SERVICE_NAME)); |
||
| 164 | $this->assertInstanceOf(QuoteManager::class, $this->containerBuilder->get(QuoteManager::SERVICE_NAME)); |
||
| 165 | $this->assertInstanceOf(ThemeManager::class, $this->containerBuilder->get(ThemeManager::SERVICE_NAME)); |
||
| 166 | |||
| 167 | // Providers |
||
| 168 | $this->assertInstanceOf(SyntaxHighlighterStringsProvider::class, $this->containerBuilder->get(SyntaxHighlighterStringsProvider::SERVICE_NAME)); |
||
| 169 | $this->assertInstanceOf(AmberColorProvider::class, $this->containerBuilder->get(AmberColorProvider::SERVICE_NAME)); |
||
| 170 | $this->assertInstanceOf(BlueColorProvider::class, $this->containerBuilder->get(BlueColorProvider::SERVICE_NAME)); |
||
| 171 | $this->assertInstanceOf(BlueGreyColorProvider::class, $this->containerBuilder->get(BlueGreyColorProvider::SERVICE_NAME)); |
||
| 172 | $this->assertInstanceOf(BrownColorProvider::class, $this->containerBuilder->get(BrownColorProvider::SERVICE_NAME)); |
||
| 173 | $this->assertInstanceOf(CyanColorProvider::class, $this->containerBuilder->get(CyanColorProvider::SERVICE_NAME)); |
||
| 174 | $this->assertInstanceOf(DeepOrangeColorProvider::class, $this->containerBuilder->get(DeepOrangeColorProvider::SERVICE_NAME)); |
||
| 175 | $this->assertInstanceOf(DeepPurpleColorProvider::class, $this->containerBuilder->get(DeepPurpleColorProvider::SERVICE_NAME)); |
||
| 176 | $this->assertInstanceOf(GreenColorProvider::class, $this->containerBuilder->get(GreenColorProvider::SERVICE_NAME)); |
||
| 177 | $this->assertInstanceOf(GreyColorProvider::class, $this->containerBuilder->get(GreyColorProvider::SERVICE_NAME)); |
||
| 178 | $this->assertInstanceOf(IndigoColorProvider::class, $this->containerBuilder->get(IndigoColorProvider::SERVICE_NAME)); |
||
| 179 | $this->assertInstanceOf(LightBlueColorProvider::class, $this->containerBuilder->get(LightBlueColorProvider::SERVICE_NAME)); |
||
| 180 | $this->assertInstanceOf(LightGreenColorProvider::class, $this->containerBuilder->get(LightGreenColorProvider::SERVICE_NAME)); |
||
| 181 | $this->assertInstanceOf(LimeColorProvider::class, $this->containerBuilder->get(LimeColorProvider::SERVICE_NAME)); |
||
| 182 | $this->assertInstanceOf(OrangeColorProvider::class, $this->containerBuilder->get(OrangeColorProvider::SERVICE_NAME)); |
||
| 183 | $this->assertInstanceOf(PinkColorProvider::class, $this->containerBuilder->get(PinkColorProvider::SERVICE_NAME)); |
||
| 184 | $this->assertInstanceOf(PurpleColorProvider::class, $this->containerBuilder->get(PurpleColorProvider::SERVICE_NAME)); |
||
| 185 | $this->assertInstanceOf(RedColorProvider::class, $this->containerBuilder->get(RedColorProvider::SERVICE_NAME)); |
||
| 186 | $this->assertInstanceOf(TealColorProvider::class, $this->containerBuilder->get(TealColorProvider::SERVICE_NAME)); |
||
| 187 | $this->assertInstanceOf(YellowColorProvider::class, $this->containerBuilder->get(YellowColorProvider::SERVICE_NAME)); |
||
| 188 | |||
| 189 | try { |
||
| 190 | |||
| 191 | $this->containerBuilder->get(self::WORLDS_WISDOM_QUOTE_PROVIDER_SERVICE_NAME); |
||
| 192 | } catch (Exception $ex) { |
||
| 193 | |||
| 194 | $this->assertInstanceOf(ServiceNotFoundException::class, $ex); |
||
| 195 | $this->assertStringContainsString(self::WORLDS_WISDOM_QUOTE_PROVIDER_SERVICE_NAME, $ex->getMessage()); |
||
| 196 | } |
||
| 197 | |||
| 198 | // Twig extensions |
||
| 199 | $this->assertInstanceOf(ContainerTwigExtension::class, $this->containerBuilder->get(ContainerTwigExtension::SERVICE_NAME)); |
||
| 200 | $this->assertInstanceOf(JavascriptTwigExtension::class, $this->containerBuilder->get(JavascriptTwigExtension::SERVICE_NAME)); |
||
| 201 | $this->assertInstanceOf(QuoteTwigExtension::class, $this->containerBuilder->get(QuoteTwigExtension::SERVICE_NAME)); |
||
| 202 | $this->assertInstanceOf(RendererTwigExtension::class, $this->containerBuilder->get(RendererTwigExtension::SERVICE_NAME)); |
||
| 203 | $this->assertInstanceOf(StylesheetTwigExtension::class, $this->containerBuilder->get(StylesheetTwigExtension::SERVICE_NAME)); |
||
| 204 | $this->assertInstanceOf(UtilityTwigExtension::class, $this->containerBuilder->get(UtilityTwigExtension::SERVICE_NAME)); |
||
| 205 | |||
| 206 | // Assets Twig extensions |
||
| 207 | $this->assertInstanceOf(FontAwesomeTwigExtension::class, $this->containerBuilder->get(FontAwesomeTwigExtension::SERVICE_NAME)); |
||
| 208 | $this->assertInstanceOf(JQueryInputMaskTwigExtension::class, $this->containerBuilder->get(JQueryInputMaskTwigExtension::SERVICE_NAME)); |
||
| 209 | $this->assertInstanceOf(MaterialDesignColorPaletteTwigExtension::class, $this->containerBuilder->get(MaterialDesignColorPaletteTwigExtension::SERVICE_NAME)); |
||
| 210 | $this->assertInstanceOf(MaterialDesignIconicFontTwigExtension::class, $this->containerBuilder->get(MaterialDesignIconicFontTwigExtension::SERVICE_NAME)); |
||
| 211 | $this->assertInstanceOf(MeteoconsTwigExtension::class, $this->containerBuilder->get(MeteoconsTwigExtension::SERVICE_NAME)); |
||
| 212 | $this->assertInstanceOf(SyntaxHighlighterTwigExtension::class, $this->containerBuilder->get(SyntaxHighlighterTwigExtension::SERVICE_NAME)); |
||
| 213 | } |
||
| 214 | |||
| 347 |