2 namespace Drupal\Console\Test\Helper;
4 use Drupal\Console\Helper\StringHelper;
6 class StringHelperTest extends \PHPUnit_Framework_TestCase
8 /* @var $stringHelper */
9 protected $stringHelper;
11 protected function setUp()
13 $this->stringHelper = new StringHelper();
17 * @dataProvider getDataNames
19 public function testCreateMachineName($input, $machine_name)
21 $this->assertEquals($this->stringHelper->createMachineName($input), $machine_name);
25 * @dataProvider getDataCamelCaseNames
27 public function testCamelCaseToMachineName($camel_case, $machine_name)
29 $this->assertEquals($this->stringHelper->camelCaseToMachineName($camel_case), $machine_name);
33 * Random strings and their equivalent machine-name
35 public function getDataNames()
38 ['Test Space between words', 'test_space_between_words'],
39 ['test$special*characters!', 'test_special_characters'],
45 * Camel-case strings and their equivalent machine-name
47 public function getDataCamelCaseNames()
50 ['camelCase', 'camel_case'],
51 ['greatestFunctionEverWritten', 'greatest_function_ever_written'],
52 ['WakeUp', 'wake_up'],