[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final 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.phacility.instance' => true, 34 'web002.useast.example.com' => true, 35 'master.example-corp.com' => true, 36 ); 37 38 foreach ($map as $input => $expect) { 39 $caught = null; 40 try { 41 AlmanacNames::validateServiceOrDeviceName($input); 42 } catch (Exception $ex) { 43 $caught = $ex; 44 } 45 $this->assertEqual( 46 $expect, 47 !($caught instanceof Exception), 48 $input); 49 } 50 } 51 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |