fix sharing unit tests

This commit is contained in:
Bjoern Schiessle 2014-02-19 16:56:37 +01:00
parent fc209a5944
commit cf7ef0d356
2 changed files with 7 additions and 7 deletions

View File

@ -57,11 +57,11 @@ class Test_Share_Backend implements OCP\Share_Backend {
public function formatItems($items, $format, $parameters = null) { public function formatItems($items, $format, $parameters = null) {
$testItems = array(); $testItems = array();
foreach ($items as $item) { foreach ($items as $item) {
if ($format == self::FORMAT_SOURCE) { if ($format === self::FORMAT_SOURCE) {
$testItems[] = $item['item_source']; $testItems[] = $item['item_source'];
} else if ($format == self::FORMAT_TARGET) { } else if ($format === self::FORMAT_TARGET) {
$testItems[] = $item['item_target']; $testItems[] = $item['item_target'];
} else if ($format == self::FORMAT_PERMISSIONS) { } else if ($format === self::FORMAT_PERMISSIONS) {
$testItems[] = $item['permissions']; $testItems[] = $item['permissions'];
} }
} }

View File

@ -622,21 +622,21 @@ class Test_Share extends PHPUnit_Framework_TestCase {
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertEquals( $this->assertEquals(
array('test.txt', 'test.txt'), array('test.txt', 'test.txt'),
OCP\Share::getItemsShared('test', 'test.txt'), OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE),
'Failed asserting that the test.txt file is shared exactly two times by user1.' 'Failed asserting that the test.txt file is shared exactly two times by user1.'
); );
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals( $this->assertEquals(
array('test.txt'), array('test.txt'),
OCP\Share::getItemsShared('test', 'test.txt'), OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE),
'Failed asserting that the test.txt file is shared exactly once by user2.' 'Failed asserting that the test.txt file is shared exactly once by user2.'
); );
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$this->assertEquals( $this->assertEquals(
array('test.txt'), array('test.txt'),
OCP\Share::getItemsShared('test', 'test.txt'), OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE),
'Failed asserting that the test.txt file is shared exactly once by user3.' 'Failed asserting that the test.txt file is shared exactly once by user3.'
); );