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
6604e76e
Unverified
Commit
6604e76e
authored
8 years ago
by
Roeland Jago Douma
Browse files
Options
Downloads
Patches
Plain Diff
Fix middleware tests
Signed-off-by:
Roeland Jago Douma
<
roeland@famdouma.nl
>
parent
ea07bbc5
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
apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
+17
-13
17 additions, 13 deletions
...es_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
with
17 additions
and
13 deletions
apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php
+
17
−
13
View file @
6604e76e
...
@@ -2,9 +2,11 @@
...
@@ -2,9 +2,11 @@
namespace
OCA\Files_Sharing\Tests\Middleware
;
namespace
OCA\Files_Sharing\Tests\Middleware
;
use
OCA\Files_Sharing
\Controller\ShareAPIController
;
use
OCA\Files_Sharing
\Middleware\OCSShareAPIMiddleware
;
use
OCA\Files_Sharing
\Middleware\OCSShareAPIMiddleware
;
use
OCP\AppFramework\Controller
;
use
OCP\AppFramework\Controller
;
use
OCP\AppFramework\OCS\OCSNotFoundException
;
use
OCP\AppFramework\OCS\OCSNotFoundException
;
use
OCP\AppFramework\OCSController
;
use
OCP\IL10N
;
use
OCP\IL10N
;
use
OCP\Share\IManager
;
use
OCP\Share\IManager
;
...
@@ -13,7 +15,7 @@ use OCP\Share\IManager;
...
@@ -13,7 +15,7 @@ use OCP\Share\IManager;
*/
*/
class
OCSShareAPIMiddlewareTest
extends
\Test\TestCase
{
class
OCSShareAPIMiddlewareTest
extends
\Test\TestCase
{
/** @var IManager */
/** @var IManager
|\PHPUnit_Framework_MockObject_MockObject
*/
private
$shareManager
;
private
$shareManager
;
/** @var IL10N */
/** @var IL10N */
private
$l
;
private
$l
;
...
@@ -21,8 +23,10 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
...
@@ -21,8 +23,10 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
private
$middleware
;
private
$middleware
;
public
function
setUp
()
{
public
function
setUp
()
{
$this
->
shareManager
=
$this
->
getMockBuilder
(
'OCP\Share\IManager'
)
->
getMock
();
parent
::
setUp
();
$this
->
l
=
$this
->
getMockBuilder
(
'OCP\IL10N'
)
->
getMock
();
$this
->
shareManager
=
$this
->
createMock
(
IManager
::
class
);
$this
->
l
=
$this
->
createMock
(
IL10N
::
class
);
$this
->
l
->
method
(
't'
)
->
will
(
$this
->
returnArgument
(
0
));
$this
->
l
->
method
(
't'
)
->
will
(
$this
->
returnArgument
(
0
));
...
@@ -32,32 +36,32 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
...
@@ -32,32 +36,32 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
public
function
dataBeforeController
()
{
public
function
dataBeforeController
()
{
return
[
return
[
[
[
$this
->
getMockBuilder
(
'OCP\AppFramework\Controller'
)
->
disableOriginalConstructor
()
->
getMock
(
),
$this
->
createMock
(
Controller
::
class
),
false
,
false
,
false
false
],
],
[
[
$this
->
getMockBuilder
(
'OCP\AppFramework\Controller'
)
->
disableOriginalConstructor
()
->
getMock
(
),
$this
->
createMock
(
Controller
::
class
),
true
,
true
,
false
false
],
],
[
[
$this
->
getMockBuilder
(
'OCP\AppFramework\OCSController'
)
->
disableOriginalConstructor
()
->
getMock
(
),
$this
->
createMock
(
OCSController
::
class
),
false
,
false
,
false
false
],
],
[
[
$this
->
getMockBuilder
(
'OCP\AppFramework\OCSController'
)
->
disableOriginalConstructor
()
->
getMock
(
),
$this
->
createMock
(
OCSController
::
class
),
true
,
true
,
false
false
],
],
[
[
$this
->
getMockBuilder
(
'OCA\Files_Sharing\API\Share20OCS'
)
->
disableOriginal
Con
s
tr
uctor
()
->
getMock
(
),
$this
->
createMock
(
ShareAPI
Contr
oller
::
class
),
false
,
false
,
true
true
],
],
[
[
$this
->
getMockBuilder
(
'OCA\Files_Sharing\API\Share20OCS'
)
->
disableOriginal
Con
s
tr
uctor
()
->
getMock
(
),
$this
->
createMock
(
ShareAPI
Contr
oller
::
class
),
true
,
true
,
false
false
],
],
...
@@ -85,13 +89,13 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
...
@@ -85,13 +89,13 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
public
function
dataAfterController
()
{
public
function
dataAfterController
()
{
return
[
return
[
[
[
$this
->
getMockBuilder
(
'OCP\AppFramework\Controller'
)
->
disableOriginalConstructor
()
->
getMock
(
),
$this
->
createMock
(
Controller
::
class
),
],
],
[
[
$this
->
getMockBuilder
(
'OCP\AppFramework\OCSController'
)
->
disableOriginalConstructor
()
->
getMock
(
),
$this
->
createMock
(
OCSController
::
class
),
],
],
[
[
$this
->
getMockBuilder
(
'OCA\Files_Sharing\API\Share20OCS'
)
->
disableOriginal
Con
s
tr
uctor
()
->
getMock
(
),
$this
->
createMock
(
ShareAPI
Contr
oller
::
class
),
],
],
];
];
}
}
...
@@ -103,7 +107,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
...
@@ -103,7 +107,7 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase {
* @param bool $called
* @param bool $called
*/
*/
public
function
testAfterController
(
Controller
$controller
)
{
public
function
testAfterController
(
Controller
$controller
)
{
if
(
$controller
instanceof
OCA\Files_Sharing\API\Share20OCS
)
{
if
(
$controller
instanceof
ShareAPIController
)
{
$controller
->
expects
(
$this
->
once
())
->
method
(
'cleanup'
);
$controller
->
expects
(
$this
->
once
())
->
method
(
'cleanup'
);
}
}
...
...
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