-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for save action, move token test to base.
- Loading branch information
1 parent
e1900f2
commit 78d4009
Showing
4 changed files
with
87 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
/* | ||
* Copyright the Collabora Online contributors. | ||
* | ||
* SPDX-License-Identifier: MPL-2.0 | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\Tests\collabora_online\Kernel\Controller; | ||
|
||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
/** | ||
* Tests the 'save' action in WopiController. | ||
* | ||
* @see \Drupal\collabora_online\Controller\WopiController::wopiPutFile() | ||
*/ | ||
class WopiControllerSaveTest extends WopiControllerTestBase { | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
const METHOD = 'POST'; | ||
|
||
/** | ||
* Tests a successful response. | ||
*/ | ||
public function testSuccess(): void { | ||
$request = $this->createRequest( | ||
[ | ||
'id' => $this->media->id(), | ||
'access_token' => $this->getAccessToken(), | ||
] | ||
); | ||
|
||
$mtime = date_create_immutable_from_format('U', (string) $this->file->getChangedTime()); | ||
|
||
$this->assertResponse( | ||
Response::HTTP_OK, | ||
json_encode([ | ||
'LastModifiedTime' => $mtime->format('c'), | ||
]), | ||
$this->file->getMimeType(), | ||
$request | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected function getRequestUri(): string { | ||
return '/cool/wopi/files/' . $this->media->id() . '/contents'; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters