Differential D12680 Diff 30510 src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
Show All 11 Lines | foreach (Filesystem::listDirectory($dir, $show_hidden = false) as $file) { | ||||
if (!preg_match('/\.diff$/', $file)) { | if (!preg_match('/\.diff$/', $file)) { | ||||
continue; | continue; | ||||
} | } | ||||
$data = Filesystem::readFile($dir.$file); | $data = Filesystem::readFile($dir.$file); | ||||
$opt_file = $dir.$file.'.options'; | $opt_file = $dir.$file.'.options'; | ||||
if (Filesystem::pathExists($opt_file)) { | if (Filesystem::pathExists($opt_file)) { | ||||
$options = Filesystem::readFile($opt_file); | $options = Filesystem::readFile($opt_file); | ||||
$options = json_decode($options, true); | try { | ||||
if (!is_array($options)) { | $options = phutil_json_decode($options); | ||||
throw new Exception("Invalid options file: {$opt_file}."); | } catch (PhutilJSONParserException $ex) { | ||||
throw new PhutilProxyException( | |||||
pht('Invalid options file: %s.', $opt_file), | |||||
$ex); | |||||
} | } | ||||
} else { | } else { | ||||
$options = array(); | $options = array(); | ||||
} | } | ||||
foreach (array('one', 'two') as $type) { | foreach (array('one', 'two') as $type) { | ||||
$this->runParser($type, $data, $file, 'expect'); | $this->runParser($type, $data, $file, 'expect'); | ||||
$this->runParser($type, $data, $file, 'unshielded'); | $this->runParser($type, $data, $file, 'unshielded'); | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |