More tidying.
[yaffs-website] / vendor / drupal / console / Test / Helper / StringHelperTest.php
1 <?php
2 namespace Drupal\Console\Test\Helper;
3
4 use Drupal\Console\Helper\StringHelper;
5
6 class StringHelperTest extends \PHPUnit_Framework_TestCase
7 {
8     /* @var $stringHelper */
9     protected $stringHelper;
10
11     protected function setUp()
12     {
13         $this->stringHelper = new StringHelper();
14     }
15
16     /**
17      * @dataProvider getDataNames
18      */
19     public function testCreateMachineName($input, $machine_name)
20     {
21         $this->assertEquals($this->stringHelper->createMachineName($input), $machine_name);
22     }
23
24     /**
25      * @dataProvider getDataCamelCaseNames
26      */
27     public function testCamelCaseToMachineName($camel_case, $machine_name)
28     {
29         $this->assertEquals($this->stringHelper->camelCaseToMachineName($camel_case), $machine_name);
30     }
31
32     /**
33      * Random strings and their equivalent machine-name
34      */
35     public function getDataNames()
36     {
37         return [
38           ['Test Space between words', 'test_space_between_words'],
39           ['test$special*characters!', 'test_special_characters'],
40           ['URL', 'url'],
41         ];
42     }
43
44     /**
45      * Camel-case strings and their equivalent machine-name
46      */
47     public function getDataCamelCaseNames()
48     {
49         return [
50           ['camelCase', 'camel_case'],
51           ['greatestFunctionEverWritten', 'greatest_function_ever_written'],
52           ['WakeUp', 'wake_up'],
53         ];
54     }
55 }