Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
12b63258
Unverified
Commit
12b63258
authored
8 years ago
by
Roeland Jago Douma
Browse files
Options
Downloads
Patches
Plain Diff
Add mapper unit tests
parent
5e2316d0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/Files/ObjectStore/MapperTest.php
+50
-0
50 additions, 0 deletions
tests/lib/Files/ObjectStore/MapperTest.php
with
50 additions
and
0 deletions
tests/lib/Files/ObjectStore/MapperTest.php
0 → 100644
+
50
−
0
View file @
12b63258
<?php
/**
* @author Roeland Jago Douma <rullzer@owncloud.com>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
namespace
Test\Files\ObjectStore
;
use
OC\Files\ObjectStore\Mapper
;
class
MapperTest
extends
\Test\TestCase
{
public
function
dataGetBucket
()
{
return
[
[
'user'
,
substr
(
md5
(
'user'
),
0
,
3
)],
[
'USER'
,
substr
(
md5
(
'USER'
),
0
,
3
)],
[
'bc0e8b52-a66c-1035-90c6-d9663bda9e3f'
,
substr
(
md5
(
'bc0e8b52-a66c-1035-90c6-d9663bda9e3f'
),
0
,
3
)],
];
}
/**
* @dataProvider dataGetBucket
* @param string $username
* @param string $expectedBucket
*/
public
function
testGetBucket
(
$username
,
$expectedBucket
)
{
$user
=
$this
->
getMock
(
'OCP\IUser'
);
$user
->
method
(
'getUID'
)
->
willReturn
(
$username
);
$mapper
=
new
Mapper
(
$user
);
$this
->
assertSame
(
$expectedBucket
,
$mapper
->
getBucket
());
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment