Refactoring tests

This commit is contained in:
Gabriel Caruso 2017-12-07 18:08:19 -02:00
parent a96add4526
commit 8eb7f3a798
5 changed files with 13 additions and 10 deletions

View File

@ -42,8 +42,9 @@ class Functional_Net_SCPSSH2UserStoryTest extends PhpseclibFunctionalTestCase
public function testConstructor($ssh) public function testConstructor($ssh)
{ {
$scp = new SCP($ssh); $scp = new SCP($ssh);
$this->assertTrue( $this->assertInternalType(
is_object($scp), 'object',
$scp,
'Could not construct \phpseclib\Net\SCP object.' 'Could not construct \phpseclib\Net\SCP object.'
); );
return $scp; return $scp;

View File

@ -22,7 +22,7 @@ class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase
'sftp' => ['session' => $this->sftp], 'sftp' => ['session' => $this->sftp],
]); ]);
$fp = fopen($this->buildUrl('fooo.txt'), 'wb', false, $context); $fp = fopen($this->buildUrl('fooo.txt'), 'wb', false, $context);
$this->assertTrue(is_resource($fp)); $this->assertInternalType('resource', $fp);
fclose($fp); fclose($fp);
$this->assertSame(0, $this->sftp->size('fooo.txt')); $this->assertSame(0, $this->sftp->size('fooo.txt'));
} }
@ -39,7 +39,7 @@ class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase
fputs($fp, 'zzzz'); fputs($fp, 'zzzz');
fclose($fp); fclose($fp);
$this->assertTrue(in_array('te#st.txt', $this->sftp->nlist())); $this->assertContains('te#st.txt', $this->sftp->nlist());
} }
/** /**

View File

@ -29,8 +29,9 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
{ {
$sftp = new SFTP($this->getEnv('SSH_HOSTNAME')); $sftp = new SFTP($this->getEnv('SSH_HOSTNAME'));
$this->assertTrue( $this->assertInternalType(
is_object($sftp), 'object',
$sftp,
'Could not construct NET_SFTP object.' 'Could not construct NET_SFTP object.'
); );

View File

@ -14,8 +14,9 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
{ {
$ssh = new SSH2($this->getEnv('SSH_HOSTNAME')); $ssh = new SSH2($this->getEnv('SSH_HOSTNAME'));
$this->assertTrue( $this->assertInternalType(
is_object($ssh), 'object',
$ssh,
'Could not construct NET_SSH2 object.' 'Could not construct NET_SSH2 object.'
); );

View File

@ -59,7 +59,7 @@ class Unit_File_ANSITest extends PhpseclibTestCase
$screen = $ansi->getScreen(); $screen = $ansi->getScreen();
$lines = explode("\r\n", $screen); $lines = explode("\r\n", $screen);
$this->assertSame(24, count($lines)); $this->assertCount(24, $lines);
$this->assertSame(str_repeat('z', 80), $lines[22]); $this->assertSame(str_repeat('z', 80), $lines[22]);
} }
} }