Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-17 17:37:48 +0300
committerJoas Schilling <coding@schilljs.com>2020-06-29 16:50:20 +0300
commit9357f4672de0425ee6b64c26d2fd535ab18021ac (patch)
treec1ec9569f7daa0595ceb86df6198f2178463e942 /tests
parent31c20949b4132e0024446a30f0f3a423bf145906 (diff)
Move the validation and preparation of the name to the RoomService
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/php/Command/Room/CreateTest.php28
1 files changed, 11 insertions, 17 deletions
diff --git a/tests/php/Command/Room/CreateTest.php b/tests/php/Command/Room/CreateTest.php
index 7c126c47f..22868f054 100644
--- a/tests/php/Command/Room/CreateTest.php
+++ b/tests/php/Command/Room/CreateTest.php
@@ -287,11 +287,17 @@ class CreateTest extends TestCase {
* @dataProvider invalidProvider
*/
public function testInvalid(array $input, string $expectedOutput): void {
- $this->roomService
- ->method('createConversation')
- ->willReturnCallback(function (int $type, string $name): Room {
- return $this->roomMockContainer->create(['name' => $name, 'type' => $type]);
- });
+ if ($input['name'] !== 'PHPUnit Test Room') {
+ $this->roomService
+ ->method('createConversation')
+ ->willThrowException(new \InvalidArgumentException('name'));
+ } else {
+ $this->roomService
+ ->method('createConversation')
+ ->willReturnCallback(function (int $type, string $name): Room {
+ return $this->roomMockContainer->create(['name' => $name, 'type' => $type]);
+ });
+ }
$this->roomMockContainer->registerCallback(function (object $room) {
/** @var Room|MockObject $room */
@@ -315,18 +321,6 @@ class CreateTest extends TestCase {
],
[
[
- 'name' => ' ',
- ],
- "Invalid room name.\n",
- ],
- [
- [
- 'name' => str_repeat('x', 256),
- ],
- "Invalid room name.\n",
- ],
- [
- [
'name' => 'PHPUnit Test Room',
'--password' => 'my-secret-password',
],