Changeset View
Changeset View
Standalone View
Standalone View
src/utils/__tests__/PhutilUtilsTestCase.php
Show First 20 Lines • Show All 912 Lines • ▼ Show 20 Lines | foreach (range(0, 255) as $byte) { | ||||
$this->assertEqual( | $this->assertEqual( | ||||
$expect_str, | $expect_str, | ||||
$actual_str, | $actual_str, | ||||
pht('HTTP querystring for byte "%s".', sprintf('0x%02x', $byte))); | pht('HTTP querystring for byte "%s".', sprintf('0x%02x', $byte))); | ||||
} | } | ||||
} | } | ||||
public function testNaturalList() { | |||||
$cases = array( | |||||
array(true, array()), | |||||
array(true, array(0 => true, 1 => true, 2 => true)), | |||||
array(true, array('a', 'b', 'c')), | |||||
array(false, array(0 => true, 2 => true, 1 => true)), | |||||
array(false, array(1 => true)), | |||||
array(false, array('sound' => 'quack')), | |||||
); | |||||
foreach ($cases as $case) { | |||||
list($expect, $value) = $case; | |||||
$this->assertEqual($expect, phutil_is_natural_list($value)); | |||||
} | |||||
} | |||||
} | } |