Afform.update - If server_route changes, then clear menu/navigation system
[civicrm-core.git] / ext / afform / core / tests / phpunit / CRM / Afform / UtilTest.php
CommitLineData
87dde5eb
TO
1<?php
2
3use Civi\Test\HeadlessInterface;
4use Civi\Test\TransactionalInterface;
5
6/**
7 * @group headless
8 */
9class CRM_Afform_UtilTest extends \PHPUnit_Framework_TestCase implements HeadlessInterface, TransactionalInterface {
10
11 /**
12 * Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile().
13 * See: https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md
14 */
15 public function setUpHeadless() {
16 return \Civi\Test::headless()
17 ->installMe(__DIR__)
18 ->install(['org.civicrm.api4'])
19 ->apply();
20 }
21
22 public function getNameExamples() {
23 $exs = [];
24 $exs[] = ['ab-cd-ef', 'camel', 'abCdEf'];
25 $exs[] = ['abCd', 'camel', 'abCd'];
26 $exs[] = ['AbCd', 'camel', 'abCd'];
27 $exs[] = ['ab-cd', 'dash', 'ab-cd'];
28 $exs[] = ['abCd', 'dash', 'ab-cd'];
29 $exs[] = ['AbCd', 'dash', 'ab-cd'];
30
31 $exs[] = ['ab-cd-ef23', 'camel', 'abCdEf23'];
32 $exs[] = ['abCd23', 'camel', 'abCd23'];
33 $exs[] = ['AbCd23', 'camel', 'abCd23'];
34 $exs[] = ['ab-cd23', 'dash', 'ab-cd23'];
35 $exs[] = ['abCd23', 'dash', 'ab-cd23'];
36 $exs[] = ['AbCd23', 'dash', 'ab-cd23'];
37
38 return $exs;
39 }
40
41 /**
42 * @param $inputFileName
43 * @param $toFormat
44 * @param $expected
45 * @dataProvider getNameExamples
46 */
47 public function testNameConversion($inputFileName, $toFormat, $expected) {
48 $actual = _afform_angular_module_name($inputFileName, $toFormat);
49 $this->assertEquals($expected, $actual);
50 }
51
52}