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

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Rudolf <github.com@daniel-rudolf.de>2021-04-16 20:16:51 +0300
committerDaniel Rudolf <github.com@daniel-rudolf.de>2021-04-16 20:16:51 +0300
commit7a745074a5c982c121c1f5a01e15d755ea306228 (patch)
treea70e9bf1188c408ecf30bac4d038b2725b4053ba /tests
parent4d2d973c06aa0e36762286b65a60d83a3064ac40 (diff)
Fix PHPUnit integration tests for polls:share:* commands
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Integration/Command/Share/AddTest.php14
-rw-r--r--tests/Integration/Command/Share/RemoveTest.php4
2 files changed, 9 insertions, 9 deletions
diff --git a/tests/Integration/Command/Share/AddTest.php b/tests/Integration/Command/Share/AddTest.php
index 8d064722..79506f10 100644
--- a/tests/Integration/Command/Share/AddTest.php
+++ b/tests/Integration/Command/Share/AddTest.php
@@ -94,15 +94,15 @@ class AddTest extends TestCase
* @dataProvider validProvider
*/
public function testValid(array $input, array $pollData): void {
- $expectedShareCount = count($pollData['expectedShares']['user'])
- + count($pollData['expectedShares']['group'])
- + count($pollData['expectedShares']['email']);
- $expectedInvitationCount = count($pollData['expectedInvitations']['user'])
- + count($pollData['expectedInvitations']['group'])
- + count($pollData['expectedInvitations']['email']);
+ $expectedShareCount = count($pollData['expectedShares']['user'] ?? [])
+ + count($pollData['expectedShares']['group'] ?? [])
+ + count($pollData['expectedShares']['email'] ?? []);
+ $expectedInvitationCount = count($pollData['expectedInvitations']['user'] ?? [])
+ + count($pollData['expectedInvitations']['group'] ?? [])
+ + count($pollData['expectedInvitations']['email'] ?? []);
$expectedInvitationShareTokens = [];
- foreach ($pollData['expectedInvitations'] as $type => $shares) {
+ foreach ($pollData['expectedInvitations'] ?? [] as $type => $shares) {
foreach ($shares as $userId) {
$expectedInvitationShareTokens[] = $this->getShareToken($pollData['pollId'], $type, $userId);
}
diff --git a/tests/Integration/Command/Share/RemoveTest.php b/tests/Integration/Command/Share/RemoveTest.php
index 39960707..9df87373 100644
--- a/tests/Integration/Command/Share/RemoveTest.php
+++ b/tests/Integration/Command/Share/RemoveTest.php
@@ -92,11 +92,11 @@ class RemoveTest extends TestCase
$initialShares = [];
$expectedShareCount = 0;
$expectedShareTokens = [];
- foreach ($pollData['initialShares'] as $type => $shares) {
+ foreach ($pollData['initialShares'] ?? [] as $type => $shares) {
foreach ($shares as $userId) {
$initialShares[] = $this->createShareMock($pollData['pollId'], $type, $userId);
- if (in_array($userId, $pollData['expectedShares'][$type])) {
+ if (in_array($userId, $pollData['expectedShares'][$type] ?? [])) {
$expectedShareTokens[] = $this->getShareToken($pollData['pollId'], $type, $userId);
$expectedShareCount++;
}