summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/core/lostpassword/controller/lostcontrollertest.php195
-rw-r--r--tests/lib/files/filesystem.php163
-rw-r--r--tests/lib/share/share.php61
-rw-r--r--tests/phpunit-autotest.xml1
-rw-r--r--tests/phpunit.xml.dist2
-rw-r--r--tests/settings/controller/mailsettingscontrollertest.php2
6 files changed, 353 insertions, 71 deletions
diff --git a/tests/core/lostpassword/controller/lostcontrollertest.php b/tests/core/lostpassword/controller/lostcontrollertest.php
new file mode 100644
index 00000000000..5da9e5ce48d
--- /dev/null
+++ b/tests/core/lostpassword/controller/lostcontrollertest.php
@@ -0,0 +1,195 @@
+<?php
+/**
+ * Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+namespace OC\Core\LostPassword\Controller;
+use OC\Core\Application;
+use OCP\AppFramework\Http\TemplateResponse;
+
+/**
+ * Class LostControllerTest
+ *
+ * @package OC\Core\LostPassword\Controller
+ */
+class LostControllerTest extends \PHPUnit_Framework_TestCase {
+
+ private $container;
+ /** @var LostController */
+ private $lostController;
+
+ protected function setUp() {
+ $app = new Application();
+ $this->container = $app->getContainer();
+ $this->container['AppName'] = 'core';
+ $this->container['Config'] = $this->getMockBuilder('\OCP\IConfig')
+ ->disableOriginalConstructor()->getMock();
+ $this->container['L10N'] = $this->getMockBuilder('\OCP\IL10N')
+ ->disableOriginalConstructor()->getMock();
+ $this->container['Defaults'] = $this->getMockBuilder('\OC_Defaults')
+ ->disableOriginalConstructor()->getMock();
+ $this->container['UserManager'] = $this->getMockBuilder('\OCP\IUserManager')
+ ->disableOriginalConstructor()->getMock();
+ $this->container['Config'] = $this->getMockBuilder('\OCP\IConfig')
+ ->disableOriginalConstructor()->getMock();
+ $this->container['URLGenerator'] = $this->getMockBuilder('\OCP\IURLGenerator')
+ ->disableOriginalConstructor()->getMock();
+ $this->container['SecureRandom'] = $this->getMockBuilder('\OCP\Security\ISecureRandom')
+ ->disableOriginalConstructor()->getMock();
+ $this->container['IsEncryptionEnabled'] = true;
+ $this->lostController = $this->container['LostController'];
+ }
+
+ public function testResetFormUnsuccessful() {
+ $userId = 'admin';
+ $token = 'MySecretToken';
+
+ $this->container['URLGenerator']
+ ->expects($this->once())
+ ->method('linkToRouteAbsolute')
+ ->with('core.lost.setPassword', array('userId' => 'admin', 'token' => 'MySecretToken'))
+ ->will($this->returnValue('https://ownCloud.com/index.php/lostpassword/'));
+
+ $response = $this->lostController->resetform($token, $userId);
+ $expectedResponse = new TemplateResponse('core/lostpassword',
+ 'resetpassword',
+ array(
+ 'link' => 'https://ownCloud.com/index.php/lostpassword/',
+ ),
+ 'guest');
+ $this->assertEquals($expectedResponse, $response);
+ }
+
+ public function testEmailUnsucessful() {
+ $existingUser = 'ExistingUser';
+ $nonExistingUser = 'NonExistingUser';
+ $this->container['UserManager']
+ ->expects($this->any())
+ ->method('userExists')
+ ->will($this->returnValueMap(array(
+ array(true, $existingUser),
+ array(false, $nonExistingUser)
+ )));
+ $this->container['L10N']
+ ->expects($this->any())
+ ->method('t')
+ ->will(
+ $this->returnValueMap(
+ array(
+ array('Couldn\'t send reset email. Please make sure your username is correct.', array(),
+ 'Couldn\'t send reset email. Please make sure your username is correct.'),
+
+ )
+ ));
+
+ // With a non existing user
+ $response = $this->lostController->email($nonExistingUser);
+ $expectedResponse = array('status' => 'error', 'msg' => 'Couldn\'t send reset email. Please make sure your username is correct.');
+ $this->assertSame($expectedResponse, $response);
+
+ // With no mail address
+ $this->container['Config']
+ ->expects($this->any())
+ ->method('getUserValue')
+ ->with($existingUser, 'settings', 'email')
+ ->will($this->returnValue(null));
+ $response = $this->lostController->email($existingUser);
+ $expectedResponse = array('status' => 'error', 'msg' => 'Couldn\'t send reset email. Please make sure your username is correct.');
+ $this->assertSame($expectedResponse, $response);
+ }
+
+ public function testEmailSuccessful() {
+ $randomToken = $this->container['SecureRandom'];
+ $this->container['SecureRandom']
+ ->expects($this->once())
+ ->method('generate')
+ ->with('21')
+ ->will($this->returnValue('ThisIsMaybeANotSoSecretToken!'));
+ $this->container['UserManager']
+ ->expects($this->once())
+ ->method('userExists')
+ ->with('ExistingUser')
+ ->will($this->returnValue(true));
+ $this->container['Config']
+ ->expects($this->once())
+ ->method('getUserValue')
+ ->with('ExistingUser', 'settings', 'email')
+ ->will($this->returnValue('test@example.com'));
+ $this->container['SecureRandom']
+ ->expects($this->once())
+ ->method('getMediumStrengthGenerator')
+ ->will($this->returnValue($randomToken));
+ $this->container['Config']
+ ->expects($this->once())
+ ->method('setUserValue')
+ ->with('ExistingUser', 'owncloud', 'lostpassword', 'ThisIsMaybeANotSoSecretToken!');
+ $this->container['URLGenerator']
+ ->expects($this->once())
+ ->method('linkToRouteAbsolute')
+ ->with('core.lost.resetform', array('userId' => 'ExistingUser', 'token' => 'ThisIsMaybeANotSoSecretToken!'))
+ ->will($this->returnValue('https://ownCloud.com/index.php/lostpassword/'));
+
+ $response = $this->lostController->email('ExistingUser');
+ $expectedResponse = array('status' => 'success');
+ $this->assertSame($expectedResponse, $response);
+ }
+
+ public function testSetPasswordUnsuccessful() {
+ $this->container['L10N']
+ ->expects($this->any())
+ ->method('t')
+ ->will(
+ $this->returnValueMap(
+ array(
+ array('Couldn\'t reset password because the token is invalid', array(),
+ 'Couldn\'t reset password because the token is invalid'),
+ )
+ ));
+ $this->container['Config']
+ ->expects($this->once())
+ ->method('getUserValue')
+ ->with('InvalidTokenUser', 'owncloud', 'lostpassword')
+ ->will($this->returnValue('TheOnlyAndOnlyOneTokenToResetThePassword'));
+
+ // With an invalid token
+ $userName = 'InvalidTokenUser';
+ $response = $this->lostController->setPassword('wrongToken', $userName, 'NewPassword', true);
+ $expectedResponse = array('status' => 'error', 'msg' => 'Couldn\'t reset password because the token is invalid');
+ $this->assertSame($expectedResponse, $response);
+
+ // With a valid token and no proceed
+ $response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword!', $userName, 'NewPassword', false);
+ $expectedResponse = array('status' => 'error', 'msg' => '', 'encryption' => true);
+ $this->assertSame($expectedResponse, $response);
+ }
+
+ public function testSetPasswordSuccessful() {
+ $this->container['Config']
+ ->expects($this->once())
+ ->method('getUserValue')
+ ->with('ValidTokenUser', 'owncloud', 'lostpassword')
+ ->will($this->returnValue('TheOnlyAndOnlyOneTokenToResetThePassword'));
+ $user = $this->getMockBuilder('\OCP\IUser')
+ ->disableOriginalConstructor()->getMock();
+ $user->expects($this->once())
+ ->method('setPassword')
+ ->with('NewPassword')
+ ->will($this->returnValue(true));
+ $this->container['UserManager']
+ ->expects($this->once())
+ ->method('get')
+ ->with('ValidTokenUser')
+ ->will($this->returnValue($user));
+ $this->container['Config']
+ ->expects($this->once())
+ ->method('deleteUserValue')
+ ->with('ValidTokenUser', 'owncloud', 'lostpassword');
+
+ $response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', true);
+ $expectedResponse = array('status' => 'success');
+ $this->assertSame($expectedResponse, $response);
+ }
+}
diff --git a/tests/lib/files/filesystem.php b/tests/lib/files/filesystem.php
index 88e98fbb8c6..f24d86b212d 100644
--- a/tests/lib/files/filesystem.php
+++ b/tests/lib/files/filesystem.php
@@ -75,71 +75,112 @@ class Filesystem extends \Test\TestCase {
$this->assertEquals('folder', $internalPath);
}
- public function testNormalize() {
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath(''));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('/'));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('/', false));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('//'));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('//', false));
- $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('/path/'));
- $this->assertEquals('/path/', \OC\Files\Filesystem::normalizePath('/path/', false));
- $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('path'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo//bar/'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo//bar/', false));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo////bar'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/////bar'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/.'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/./'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo/bar/./', false));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/./.'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/bar/././'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo/bar/././', false));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('/foo/./bar/'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('/foo/./bar/', false));
- $this->assertEquals('/foo/.bar', \OC\Files\Filesystem::normalizePath('/foo/.bar/'));
- $this->assertEquals('/foo/.bar/', \OC\Files\Filesystem::normalizePath('/foo/.bar/', false));
- $this->assertEquals('/foo/.bar/tee', \OC\Files\Filesystem::normalizePath('/foo/.bar/tee'));
-
- // normalize does not resolve '..' (by design)
- $this->assertEquals('/foo/..', \OC\Files\Filesystem::normalizePath('/foo/../'));
-
- if (class_exists('Patchwork\PHP\Shim\Normalizer')) {
- $this->assertEquals("/foo/bar\xC3\xBC", \OC\Files\Filesystem::normalizePath("/foo/baru\xCC\x88"));
+ public function normalizePathData() {
+ return array(
+ array('/', ''),
+ array('/', '/'),
+ array('/', '//'),
+ array('/', '/', false),
+ array('/', '//', false),
+
+ array('/path', '/path/'),
+ array('/path/', '/path/', false),
+ array('/path', 'path'),
+
+ array('/foo/bar', '/foo//bar/'),
+ array('/foo/bar/', '/foo//bar/', false),
+ array('/foo/bar', '/foo////bar'),
+ array('/foo/bar', '/foo/////bar'),
+ array('/foo/bar', '/foo/bar/.'),
+ array('/foo/bar', '/foo/bar/./'),
+ array('/foo/bar/', '/foo/bar/./', false),
+ array('/foo/bar', '/foo/bar/./.'),
+ array('/foo/bar', '/foo/bar/././'),
+ array('/foo/bar/', '/foo/bar/././', false),
+ array('/foo/bar', '/foo/./bar/'),
+ array('/foo/bar/', '/foo/./bar/', false),
+ array('/foo/.bar', '/foo/.bar/'),
+ array('/foo/.bar/', '/foo/.bar/', false),
+ array('/foo/.bar/tee', '/foo/.bar/tee'),
+
+ // Windows paths
+ array('/', ''),
+ array('/', '\\'),
+ array('/', '\\', false),
+ array('/', '\\\\'),
+ array('/', '\\\\', false),
+
+ array('/path', '\\path'),
+ array('/path', '\\path', false),
+ array('/path', '\\path\\'),
+ array('/path/', '\\path\\', false),
+
+ array('/foo/bar', '\\foo\\\\bar\\'),
+ array('/foo/bar/', '\\foo\\\\bar\\', false),
+ array('/foo/bar', '\\foo\\\\\\\\bar'),
+ array('/foo/bar', '\\foo\\\\\\\\\\bar'),
+ array('/foo/bar', '\\foo\\bar\\.'),
+ array('/foo/bar', '\\foo\\bar\\.\\'),
+ array('/foo/bar/', '\\foo\\bar\\.\\', false),
+ array('/foo/bar', '\\foo\\bar\\.\\.'),
+ array('/foo/bar', '\\foo\\bar\\.\\.\\'),
+ array('/foo/bar/', '\\foo\\bar\\.\\.\\', false),
+ array('/foo/bar', '\\foo\\.\\bar\\'),
+ array('/foo/bar/', '\\foo\\.\\bar\\', false),
+ array('/foo/.bar', '\\foo\\.bar\\'),
+ array('/foo/.bar/', '\\foo\\.bar\\', false),
+ array('/foo/.bar/tee', '\\foo\\.bar\\tee'),
+
+ // Absolute windows paths NOT marked as absolute
+ array('/C:', 'C:\\'),
+ array('/C:/', 'C:\\', false),
+ array('/C:/tests', 'C:\\tests'),
+ array('/C:/tests', 'C:\\tests', false),
+ array('/C:/tests', 'C:\\tests\\'),
+ array('/C:/tests/', 'C:\\tests\\', false),
+
+ // normalize does not resolve '..' (by design)
+ array('/foo/..', '/foo/../'),
+ array('/foo/..', '\\foo\\..\\'),
+ );
+ }
+
+ /**
+ * @dataProvider normalizePathData
+ */
+ public function testNormalizePath($expected, $path, $stripTrailingSlash = true) {
+ $this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash));
+ }
+
+ public function normalizePathWindowsAbsolutePathData() {
+ return array(
+ array('C:/', 'C:\\'),
+ array('C:/', 'C:\\', false),
+ array('C:/tests', 'C:\\tests'),
+ array('C:/tests', 'C:\\tests', false),
+ array('C:/tests', 'C:\\tests\\'),
+ array('C:/tests/', 'C:\\tests\\', false),
+ );
+ }
+
+ /**
+ * @dataProvider normalizePathWindowsAbsolutePathData
+ */
+ public function testNormalizePathWindowsAbsolutePath($expected, $path, $stripTrailingSlash = true) {
+ if (!\OC_Util::runningOnWindows()) {
+ $this->markTestSkipped('This test is Windows only');
}
+
+ $this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash, true));
}
- public function testNormalizeWindowsPaths() {
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath(''));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\'));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\', false));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\\\'));
- $this->assertEquals('/', \OC\Files\Filesystem::normalizePath('\\\\', false));
- $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('\\path'));
- $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('\\path', false));
- $this->assertEquals('/path', \OC\Files\Filesystem::normalizePath('\\path\\'));
- $this->assertEquals('/path/', \OC\Files\Filesystem::normalizePath('\\path\\', false));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\\\bar\\'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\\\bar\\', false));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\\\\\\\bar'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\\\\\\\\\bar'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\', false));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\.'));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\.\\'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\bar\\.\\.\\', false));
- $this->assertEquals('/foo/bar', \OC\Files\Filesystem::normalizePath('\\foo\\.\\bar\\'));
- $this->assertEquals('/foo/bar/', \OC\Files\Filesystem::normalizePath('\\foo\\.\\bar\\', false));
- $this->assertEquals('/foo/.bar', \OC\Files\Filesystem::normalizePath('\\foo\\.bar\\'));
- $this->assertEquals('/foo/.bar/', \OC\Files\Filesystem::normalizePath('\\foo\\.bar\\', false));
- $this->assertEquals('/foo/.bar/tee', \OC\Files\Filesystem::normalizePath('\\foo\\.bar\\tee'));
-
- // normalize does not resolve '..' (by design)
- $this->assertEquals('/foo/..', \OC\Files\Filesystem::normalizePath('\\foo\\..\\'));
-
- if (class_exists('Patchwork\PHP\Shim\Normalizer')) {
- $this->assertEquals("/foo/bar\xC3\xBC", \OC\Files\Filesystem::normalizePath("\\foo\\baru\xCC\x88"));
+ public function testNormalizePathUTF8() {
+ if (!class_exists('Patchwork\PHP\Shim\Normalizer')) {
+ $this->markTestSkipped('UTF8 normalizer Patchwork was not found');
}
+
+ $this->assertEquals("/foo/bar\xC3\xBC", \OC\Files\Filesystem::normalizePath("/foo/baru\xCC\x88"));
+ $this->assertEquals("/foo/bar\xC3\xBC", \OC\Files\Filesystem::normalizePath("\\foo\\baru\xCC\x88"));
}
public function testHooks() {
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 3d99883f2de..7644dadadc7 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -19,7 +19,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_Share extends PHPUnit_Framework_TestCase {
+class Test_Share extends Test\TestCase {
protected $itemType;
protected $userBackend;
@@ -27,6 +27,7 @@ class Test_Share extends PHPUnit_Framework_TestCase {
protected $user2;
protected $user3;
protected $user4;
+ protected $groupAndUser;
protected $groupBackend;
protected $group1;
protected $group2;
@@ -34,29 +35,35 @@ class Test_Share extends PHPUnit_Framework_TestCase {
protected $dateInFuture;
protected $dateInPast;
- public function setUp() {
+ protected function setUp() {
+ parent::setUp();
OC_User::clearBackends();
OC_User::useBackend('dummy');
- $this->user1 = uniqid('user1_');
- $this->user2 = uniqid('user2_');
- $this->user3 = uniqid('user3_');
- $this->user4 = uniqid('user4_');
+ $this->user1 = $this->getUniqueID('user1_');
+ $this->user2 = $this->getUniqueID('user2_');
+ $this->user3 = $this->getUniqueID('user3_');
+ $this->user4 = $this->getUniqueID('user4_');
+ $this->groupAndUser = $this->getUniqueID('groupAndUser_');
OC_User::createUser($this->user1, 'pass');
OC_User::createUser($this->user2, 'pass');
OC_User::createUser($this->user3, 'pass');
OC_User::createUser($this->user4, 'pass');
+ OC_User::createUser($this->groupAndUser, 'pass');
OC_User::setUserId($this->user1);
OC_Group::clearBackends();
OC_Group::useBackend(new OC_Group_Dummy);
- $this->group1 = uniqid('group1_');
- $this->group2 = uniqid('group2_');
+ $this->group1 = $this->getUniqueID('group1_');
+ $this->group2 = $this->getUniqueID('group2_');
OC_Group::createGroup($this->group1);
OC_Group::createGroup($this->group2);
+ OC_Group::createGroup($this->groupAndUser);
OC_Group::addToGroup($this->user1, $this->group1);
OC_Group::addToGroup($this->user2, $this->group1);
OC_Group::addToGroup($this->user3, $this->group1);
OC_Group::addToGroup($this->user2, $this->group2);
OC_Group::addToGroup($this->user4, $this->group2);
+ OC_Group::addToGroup($this->user2, $this->groupAndUser);
+ OC_Group::addToGroup($this->user3, $this->groupAndUser);
OCP\Share::registerBackend('test', 'Test_Share_Backend');
OC_Hook::clear('OCP\\Share');
OC::registerShareHooks();
@@ -70,10 +77,11 @@ class Test_Share extends PHPUnit_Framework_TestCase {
$this->dateInFuture = date($dateFormat, $now + 20 * 60);
}
- public function tearDown() {
+ protected function tearDown() {
$query = OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?');
$query->execute(array('test'));
OC_Appconfig::setValue('core', 'shareapi_allow_resharing', $this->resharing);
+ parent::tearDown();
}
public function testShareInvalidShareType() {
@@ -600,6 +608,41 @@ class Test_Share extends PHPUnit_Framework_TestCase {
$this->assertEquals(array(), OCP\Share::getItemsShared('test'));
}
+
+ public function testShareWithGroupAndUserBothHaveTheSameId() {
+
+ $this->shareUserTestFileWithUser($this->user1, $this->groupAndUser);
+
+ OC_User::setUserId($this->groupAndUser);
+
+ $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ '"groupAndUser"-User does not see the file but it was shared with him');
+
+ OC_User::setUserId($this->user2);
+ $this->assertEquals(array(), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ 'User2 sees test.txt but it was only shared with the user "groupAndUser" and not with group');
+
+ OC_User::setUserId($this->user1);
+ $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt'));
+
+ $this->assertTrue(
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->groupAndUser, OCP\PERMISSION_READ),
+ 'Failed asserting that user 1 successfully shared text.txt with group 1.'
+ );
+
+ OC_User::setUserId($this->groupAndUser);
+ $this->assertEquals(array(), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ '"groupAndUser"-User sees test.txt but it was only shared with the group "groupAndUser" and not with the user');
+
+ OC_User::setUserId($this->user2);
+ $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ 'User2 does not see test.txt but it was shared with the group "groupAndUser"');
+
+ OC_User::setUserId($this->user1);
+ $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt'));
+
+ }
+
/**
* @param boolean|string $token
*/
diff --git a/tests/phpunit-autotest.xml b/tests/phpunit-autotest.xml
index 3805bb1ac79..282f5477c30 100644
--- a/tests/phpunit-autotest.xml
+++ b/tests/phpunit-autotest.xml
@@ -9,6 +9,7 @@
<testsuite name='ownCloud'>
<directory suffix='.php'>lib/</directory>
<directory suffix='.php'>settings/</directory>
+ <directory suffix='.php'>core/</directory>
<file>apps.php</file>
</testsuite>
<!-- filters for code coverage -->
diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist
index 21c63ea0469..95abe473965 100644
--- a/tests/phpunit.xml.dist
+++ b/tests/phpunit.xml.dist
@@ -2,6 +2,8 @@
<phpunit bootstrap="bootstrap.php">
<testsuite name='ownCloud'>
<directory suffix='.php'>lib/</directory>
+ <directory suffix='.php'>settings/</directory>
+ <directory suffix='.php'>core/</directory>
<file>apps.php</file>
</testsuite>
<!-- filters for code coverage -->
diff --git a/tests/settings/controller/mailsettingscontrollertest.php b/tests/settings/controller/mailsettingscontrollertest.php
index 6d3485d28e4..789b6ce8fb0 100644
--- a/tests/settings/controller/mailsettingscontrollertest.php
+++ b/tests/settings/controller/mailsettingscontrollertest.php
@@ -14,7 +14,7 @@ use \OC\Settings\Application;
/**
* @package OC\Settings\Controller
*/
-class MailSettingscontrollerTest extends \PHPUnit_Framework_TestCase {
+class MailSettingsControllerTest extends \PHPUnit_Framework_TestCase {
private $container;