@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 55 lines 1.2 kB view raw
1<?php 2 3final class AlmanacNamesTestCase extends PhabricatorTestCase { 4 5 public function testServiceOrDeviceNames() { 6 $map = array( 7 '' => false, 8 'a' => false, 9 'ab' => false, 10 '...' => false, 11 'ab.' => false, 12 '.ab' => false, 13 'A-B' => false, 14 'A!B' => false, 15 'A.B' => false, 16 'a..b' => false, 17 '1.2' => false, 18 '127.0.0.1' => false, 19 '1.b' => false, 20 'a.1' => false, 21 'a.1.b' => false, 22 '-.a' => false, 23 '-a.b' => false, 24 'a-.b' => false, 25 'a.-' => false, 26 'a.-b' => false, 27 'a.b-' => false, 28 '-.-' => false, 29 'a--b' => false, 30 31 'abc' => true, 32 'a.b' => true, 33 'db.companyname.instance' => true, 34 'web002.useast.example.com' => true, 35 'master.example-corp.com' => true, 36 37 // Maximum length is 100. 38 str_repeat('a', 100) => true, 39 str_repeat('a', 101) => false, 40 ); 41 42 foreach ($map as $input => $expect) { 43 $caught = null; 44 try { 45 AlmanacNames::validateName($input); 46 } catch (Exception $ex) { 47 $caught = $ex; 48 } 49 $this->assertEqual( 50 $expect, 51 !($caught instanceof Exception), 52 $input); 53 } 54 } 55}