From cd82c9a852604de2fbf850f7bc7ed8fd03cdaa9b Mon Sep 17 00:00:00 2001 From: proggeler Date: Thu, 19 Dec 2019 14:48:53 +0100 Subject: [PATCH] #98: reverted whitespace changes --- tests/SftpAdapterTests.php | 130 ++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/tests/SftpAdapterTests.php b/tests/SftpAdapterTests.php index 03d4d32..2d869df 100644 --- a/tests/SftpAdapterTests.php +++ b/tests/SftpAdapterTests.php @@ -18,10 +18,10 @@ class SftpTests extends TestCase protected function setup() { - if (!defined('NET_SFTP_TYPE_REGULAR')) { + if (! defined('NET_SFTP_TYPE_REGULAR')) { define('NET_SFTP_TYPE_REGULAR', 1); } - if (!defined('NET_SFTP_TYPE_DIRECTORY')) { + if (! defined('NET_SFTP_TYPE_DIRECTORY')) { define('NET_SFTP_TYPE_DIRECTORY', 2); } } @@ -47,9 +47,9 @@ public function adapterProvider() public function testHas($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->andReturn([ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); @@ -99,9 +99,9 @@ public function testDelete($filesystem, $adapter, $mock) { $mock->shouldReceive('delete')->andReturn(true, false); $mock->shouldReceive('stat')->andReturn([ - 'type' => 1, - 'mtime' => time(), - 'size' => 20, + 'type' => 1, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $this->assertTrue($filesystem->delete('something')); @@ -115,9 +115,9 @@ public function testUpdate(FilesystemInterface $filesystem, $adapter, $mock) { $mock->shouldReceive('put')->andReturn(true, false); $mock->shouldReceive('stat')->andReturn([ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $this->assertTrue($filesystem->update('something', 'something')); @@ -132,9 +132,9 @@ public function testUpdateStream(FilesystemInterface $filesystem, $adapter, $moc $stream = tmpfile(); $mock->shouldReceive('put')->andReturn(true, false); $mock->shouldReceive('stat')->andReturn([ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $this->assertTrue($filesystem->updateStream('something', $stream)); @@ -148,9 +148,9 @@ public function testUpdateStream(FilesystemInterface $filesystem, $adapter, $moc public function testSetVisibility($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->andReturn([ - 'type' => 1, // file - 'mtime' => time(), - 'size' => 20, + 'type' => 1, // file + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $mock->shouldReceive('chmod')->twice()->andReturn(true, false); @@ -165,9 +165,9 @@ public function testSetVisibility($filesystem, $adapter, $mock) public function testSetVisibilityInvalid($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->andReturn([ - 'type' => 1, // file - 'mtime' => time(), - 'size' => 20, + 'type' => 1, // file + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $mock->shouldReceive('stat')->once()->andReturn(true); @@ -180,16 +180,16 @@ public function testSetVisibilityInvalid($filesystem, $adapter, $mock) public function testRename($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->with('old')->andReturn([ - 'type' => NET_SFTP_TYPE_REGULAR, // file - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_REGULAR, // file + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $mock->shouldReceive('stat')->with('old')->andReturn(false); $mock->shouldReceive('stat')->with('.')->andReturn([ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); @@ -205,9 +205,9 @@ public function testRename($filesystem, $adapter, $mock) public function testRenameCreatesDirectory($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->with('old_dir/file.ext')->andReturn([ - 'type' => NET_SFTP_TYPE_REGULAR, // file - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_REGULAR, // file + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $mock->shouldReceive('stat')->with('new_dir/file.ext')->andReturn(false); @@ -235,19 +235,19 @@ public function testDeleteDir($filesystem, $adapter, $mock) public function testListContents($filesystem, $adapter, $mock) { $mock->shouldReceive('rawlist')->andReturn(false, [ - '.' => [], + '.' => [], 'dirname' => [ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ], ], [ - '..' => [], + '..' => [], 'dirname' => [ - 'type' => 1, - 'mtime' => time(), - 'size' => 20, + 'type' => 1, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ], ]); @@ -277,9 +277,9 @@ public function methodProvider() public function testMetaMethods($filesystem, $adapter, $mock, $method, $type) { $mock->shouldReceive('stat')->andReturn([ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $result = $filesystem->{$method}(uniqid() . 'object.ext'); @@ -292,9 +292,9 @@ public function testMetaMethods($filesystem, $adapter, $mock, $method, $type) public function testGetVisibility($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->andReturn([ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $result = $adapter->getVisibility(uniqid() . 'object.ext'); @@ -310,9 +310,9 @@ public function testGetVisibility($filesystem, $adapter, $mock) public function testGetTimestamp($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->andReturn([ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => $time = time(), - 'size' => 20, + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => $time = time(), + 'size' => 20, 'permissions' => 0777, ]); $result = $adapter->getTimestamp('object.ext'); @@ -341,9 +341,9 @@ public function testCreateDir($filesystem, $adapter, $mock) public function testRead($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->andReturn([ - 'type' => 1, - 'mtime' => time(), - 'size' => 20, + 'type' => 1, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); $mock->shouldReceive('get')->andReturn('file contents', false); @@ -375,9 +375,9 @@ public function testReadStream($filesystem, $adapter, $mock) public function testGetMimetype($filesystem, $adapter, $mock) { $mock->shouldReceive('stat')->andReturn([ - 'type' => 1, - 'mtime' => time(), - 'size' => 20, + 'type' => 1, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, ]); @@ -421,7 +421,7 @@ public function testAgentSetGet($filesystem, SftpAdapter $adapter, $mock) */ public function testPrivateKeyFileSetGet($filesystem, $adapter, $mock) { - file_put_contents($key = __DIR__ . '/some.key', 'key contents'); + file_put_contents($key = __DIR__.'/some.key', 'key contents'); $this->assertEquals($adapter, $adapter->setPrivateKey($key)); $this->assertInstanceOf('phpseclib\Crypt\RSA', $adapter->getPrivateKey()); @unlink($key); @@ -521,7 +521,7 @@ public function testConnectWithDoubleAuthentication($filesystem, $adapter, $mock $adapter->setNetSftpConnection($mock); $expectedAuths = [$adapter->getPrivateKey(), 'test']; - $mock->shouldReceive('login')->with('test', Mockery::on(function ($auth) use (&$expectedAuths) { + $mock->shouldReceive('login')->with('test', Mockery::on(function($auth) use (&$expectedAuths) { return $auth == array_shift($expectedAuths); }))->twice()->andReturn(false, true); @@ -606,17 +606,17 @@ public function testListContentsDir($filesystem, $adapter, $mock) [ 'dirname' => [ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), 'permissions' => 0777, - 'filename' => 'dirname' + 'filename' => 'dirname' ], 'filename' => [ - 'mtime' => time(), - 'size' => 20, + 'mtime' => time(), + 'size' => 20, 'permissions' => 0777, - 'filename' => 'filename' + 'filename' => 'filename' ], ] ); @@ -639,7 +639,7 @@ public function testNetSftpConnectionSetter() $this->assertEquals($mock, $adapter->getConnection()); } - public function testHostFingerprintIsVerifiedIfProvided() + public function testHostFingerprintIsVerifiedIfProvided () { $adapter = new SftpAdapter([ 'host' => 'example.org', @@ -662,7 +662,7 @@ public function testHostFingerprintIsVerifiedIfProvided() $adapter->connect(); } - public function testHostFingerprintNotIsVerifiedIfNotProvided() + public function testHostFingerprintNotIsVerifiedIfNotProvided () { $adapter = new SftpAdapter([ 'host' => 'example.org', @@ -753,10 +753,10 @@ public function testListContentsWithZeroNamedDir($filesystem, $adapter, $mock) [ '0' => [ - 'type' => NET_SFTP_TYPE_DIRECTORY, - 'mtime' => time(), + 'type' => NET_SFTP_TYPE_DIRECTORY, + 'mtime' => time(), 'permissions' => 0777, - 'filename' => '0' + 'filename' => '0' ] ] );