SCP: Allow for null byte in tests as long as #146 is under investigation.

This commit is contained in:
Andreas Fischer 2014-12-09 12:32:25 +01:00
parent 494e0d68eb
commit 51ea6255c8

View File

@ -56,14 +56,15 @@ class Functional_Net_SCPSSH2UserStoryTest extends PhpseclibFunctionalTestCase
'Failed asserting that data could successfully be put() into file.'
);
$content = $scp->get(self::$remoteFile);
$this->assertSame(
self::$exampleDataLength,
// TODO: Address https://github.com/phpseclib/phpseclib/issues/146
$this->assertContains(
strlen($content),
array(self::$exampleDataLength, self::$exampleDataLength + 1),
'Failed asserting that string length matches expected length.'
);
$this->assertSame(
self::$exampleData,
$this->assertContains(
$content,
array(self::$exampleData, self::$exampleData . "\0"),
'Failed asserting that string content matches expected content.'
);
return $scp;
@ -77,14 +78,15 @@ class Functional_Net_SCPSSH2UserStoryTest extends PhpseclibFunctionalTestCase
$scp->get(self::$remoteFile, $localFilename),
'Failed asserting that get() into file was successful.'
);
$this->assertSame(
self::$exampleDataLength,
// TODO: Address https://github.com/phpseclib/phpseclib/issues/146
$this->assertContains(
filesize($localFilename),
array(self::$exampleDataLength, self::$exampleDataLength + 1),
'Failed asserting that filesize matches expected data size.'
);
$this->assertSame(
self::$exampleData,
$this->assertContains(
file_get_contents($localFilename),
array(self::$exampleData, self::$exampleData . "\0"),
'Failed asserting that file content matches expected content.'
);
}