Differential D12680 Diff 30538 src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
| <?php | <?php | ||||
| final class DiffusionMercurialWireSSHTestCase extends PhabricatorTestCase { | final class DiffusionMercurialWireSSHTestCase extends PhabricatorTestCase { | ||||
| public function testMercurialClientWireProtocolParser() { | public function testMercurialClientWireProtocolParser() { | ||||
| $data = dirname(__FILE__).'/hgwiredata/'; | $data = dirname(__FILE__).'/hgwiredata/'; | ||||
| $dir = Filesystem::listDirectory($data, $include_hidden = false); | $dir = Filesystem::listDirectory($data, $include_hidden = false); | ||||
| foreach ($dir as $file) { | foreach ($dir as $file) { | ||||
| $raw = Filesystem::readFile($data.$file); | $raw = Filesystem::readFile($data.$file); | ||||
| $raw = explode("\n~~~~~~~~~~\n", $raw, 2); | $raw = explode("\n~~~~~~~~~~\n", $raw, 2); | ||||
| $this->assertEqual(2, count($raw)); | $this->assertEqual(2, count($raw)); | ||||
| $expect = json_decode($raw[1], true); | $expect = phutil_json_decode($raw[1]); | ||||
| $this->assertTrue(is_array($expect), $file); | $this->assertTrue(is_array($expect), $file); | ||||
| $this->assertParserResult($expect, $raw[0], $file); | $this->assertParserResult($expect, $raw[0], $file); | ||||
| } | } | ||||
| } | } | ||||
| private function assertParserResult(array $expect, $input, $file) { | private function assertParserResult(array $expect, $input, $file) { | ||||
| list($x, $y) = PhutilSocketChannel::newChannelPair(); | list($x, $y) = PhutilSocketChannel::newChannelPair(); | ||||
| Show All 36 Lines | |||||