| Total Complexity | 4 | 
| Total Lines | 37 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 10 | class SupportTest extends CommonTestClass | ||
| 11 | { | ||
| 12 | /** | ||
| 13 | * @param string $in | ||
| 14 | * @param string[] $expected | ||
| 15 | * @dataProvider nameFromTemplateProvider | ||
| 16 | */ | ||
| 17 | public function testNameFromTemplate(string $in, array $expected): void | ||
| 18 |     { | ||
| 19 | $this->assertEquals($expected, Support::moduleNameFromRequest($in)); | ||
| 20 | } | ||
| 21 | |||
| 22 | public function nameFromTemplateProvider(): array | ||
| 23 |     { | ||
| 24 | return [ | ||
| 25 | ['whatever-for-name', ['WhateverForName']], | ||
| 26 | ['whatever--for--name', ['Whatever', 'For', 'Name']], | ||
| 27 | ]; | ||
| 28 | } | ||
| 29 | |||
| 30 | /** | ||
| 31 | * @param string[] $in | ||
| 32 | * @param string $expected | ||
| 33 | * @dataProvider normalizeLinkProvider | ||
| 34 | */ | ||
| 35 | public function testLinkModule(array $in, string $expected): void | ||
| 36 |     { | ||
| 37 | $this->assertEquals($expected, Support::requestFromModuleName($in)); | ||
| 38 | } | ||
| 39 | |||
| 40 | public function normalizeLinkProvider(): array | ||
| 41 |     { | ||
| 42 | return [ | ||
| 43 | [['FooBar0Baz'], 'foo-bar0-baz'], | ||
| 44 | [['Nope-Yep'], 'nope-yep'], | ||
| 45 | [['Θεσσαλονίκη'], 'θεσσαλονίκη'], // not ASCII | ||
| 46 | [['FooBar', 'Baz'], 'foo-bar--baz'], | ||
| 47 | ]; | ||
| 50 |