Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS fixes #1

Merged
merged 1 commit into from Jan 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/SftpAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,10 @@ protected function normalizeListingObject($path, array $object)
$permissions = $this->normalizePermissions($object['permissions']);

return [
'path' => $path,
'size' => $object['size'],
'timestamp' => $object['mtime'],
'type' => ($object['type'] === 1 ? 'file' : 'dir'),
'path' => $path,
'size' => $object['size'],
'timestamp' => $object['mtime'],
'type' => ($object['type'] === 1 ? 'file' : 'dir'),
'visibility' => $permissions & 0044 ? AdapterInterface::VISIBILITY_PUBLIC : AdapterInterface::VISIBILITY_PRIVATE,
];
}
Expand Down
72 changes: 36 additions & 36 deletions tests/SftpAdapterTests.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use League\Flysystem\Sftp\SftpAdapter as Sftp;
use League\Flysystem\Filesystem;
use League\Flysystem\FilesystemInterface;
use League\Flysystem\Sftp\SftpAdapter as Sftp;

class SftpTests extends PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -33,9 +33,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,
]);

Expand Down Expand Up @@ -71,9 +71,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'));
Expand All @@ -87,9 +87,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'));
Expand Down Expand Up @@ -122,9 +122,9 @@ public function testSetVisibilityInvalid($filesystem, $adapter, $mock)
public function testRename($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,
], false);
$mock->shouldReceive('rename')->andReturn(true);
Expand All @@ -148,19 +148,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,
],
]);
Expand Down Expand Up @@ -190,9 +190,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');
Expand All @@ -205,9 +205,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');
Expand All @@ -223,9 +223,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');
Expand All @@ -251,9 +251,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);
Expand All @@ -269,9 +269,9 @@ public function testRead($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,
]);

Expand Down