Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / macro / xaction / __tests__ / PhabricatorMacroTestCase.php
blobaa13ec0ac16e8139caaa9a1c98967ec56e610554
1 <?php
3 final class PhabricatorMacroTestCase
4 extends PhabricatorTestCase {
6 public function testMacroNames() {
7 $lit = "\xF0\x9F\x94\xA5";
8 $combining_diaeresis = "\xCC\x88";
10 $cases = array(
11 // Only 2 glyphs long.
12 "u{$combining_diaeresis}n" => false,
13 "{$lit}{$lit}" => false,
15 // Too short.
16 'a' => false,
17 '' => false,
19 // Bad characters.
20 'yes!' => false,
21 "{$lit} {$lit} {$lit}" => false,
22 "aaa\nbbb" => false,
23 'aaa~' => false,
24 'aaa`' => false,
26 // Special rejections for only latin symbols.
27 '---' => false,
28 '___' => false,
29 '-_-' => false,
30 ':::' => false,
31 '-_:' => false,
33 "{$lit}{$lit}{$lit}" => true,
34 'bwahahaha' => true,
35 "u{$combining_diaeresis}nt" => true,
36 'a-a-a-a' => true,
39 foreach ($cases as $input => $expect) {
40 $this->assertEqual(
41 $expect,
42 PhabricatorMacroNameTransaction::isValidMacroName($input),
43 pht('Validity of macro "%s"', $input));