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