Changeset View
Changeset View
Standalone View
Standalone View
src/utils/__tests__/PhutilUtilsTestCase.php
Show First 20 Lines • Show All 578 Lines • ▼ Show 20 Lines | public function testPhutilINIDecode() { | ||||
); | ); | ||||
foreach ($valid_cases as $input => $expect) { | foreach ($valid_cases as $input => $expect) { | ||||
$result = phutil_ini_decode($input); | $result = phutil_ini_decode($input); | ||||
$this->assertEqual($expect, $result, 'phutil_ini_decode('.$input.')'); | $this->assertEqual($expect, $result, 'phutil_ini_decode('.$input.')'); | ||||
} | } | ||||
$invalid_cases = array( | $invalid_cases = array( | ||||
'[' => | '[' => new PhutilINIParserException(), | ||||
'syntax error, unexpected $end, expecting \']\' in Unknown on line 1', | |||||
); | ); | ||||
foreach ($invalid_cases as $input => $expect) { | foreach ($invalid_cases as $input => $expect) { | ||||
$caught = null; | $caught = null; | ||||
try { | try { | ||||
phutil_ini_decode($input); | phutil_ini_decode($input); | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$caught = $ex; | $caught = $ex; | ||||
} | } | ||||
$this->assertTrue($caught instanceof PhutilINIParserException); | $this->assertTrue($caught instanceof $expect); | ||||
$this->assertEqual($expect, $caught->getMessage()); | |||||
} | } | ||||
} | } | ||||
public function testCensorCredentials() { | public function testCensorCredentials() { | ||||
$cases = array( | $cases = array( | ||||
'' => '', | '' => '', | ||||
'abc' => 'abc', | 'abc' => 'abc', | ||||
▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines |