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:
authordartcafe <github@dartcafe.de>2021-06-06 19:45:12 +0300
committerdartcafe <github@dartcafe.de>2021-06-06 21:01:08 +0300
commit34579344a07686228db9c04c6ccacb2b5e7d929a (patch)
tree2ceaa83a4c6cc83643010d7ec0cfe792582bbf67 /tests
parent36c8db50d0c1f8c03c202a60b489659f52a3046b (diff)
fix some tests
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Factories/CommentFactory.php78
-rw-r--r--tests/Unit/Factories/OptionFactory.php76
-rw-r--r--tests/Unit/Factories/PollFactory.php118
-rw-r--r--tests/Unit/Factories/ShareFactory.php71
-rw-r--r--tests/Unit/Factories/VoteFactory.php68
5 files changed, 215 insertions, 196 deletions
diff --git a/tests/Unit/Factories/CommentFactory.php b/tests/Unit/Factories/CommentFactory.php
index 6a3d1e3e..d7290f45 100644
--- a/tests/Unit/Factories/CommentFactory.php
+++ b/tests/Unit/Factories/CommentFactory.php
@@ -1,40 +1,38 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
- *
- * @author Kai Schröer <git@schroeer.co>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-use League\FactoryMuffin\Faker\Facade as Faker;
-
-/**
- * General factory for the comment model.
- */
-$fm->define('OCA\Polls\Db\Comment')->setDefinitions([
- 'userId' => Faker::firstNameMale(),
- 'dt' => function () {
- $date = new DateTime('today');
- return $date->format('Y-m-d H:i:s');
- },
- 'timestamp' => function () {
- $date = new DateTime('today');
- return $date->getTimestamp();
- },
- 'comment' => Faker::text(255)
-]);
+<?php
+/**
+ * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
+ *
+ * @author Kai Schröer <git@schroeer.co>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+use League\FactoryMuffin\Faker\Facade as Faker;
+
+/**
+ * General factory for the comment model.
+ */
+$fm->define('OCA\Polls\Db\Comment')->setDefinitions([
+ 'userId' => Faker::firstNameMale(),
+ 'timestamp' => function () {
+ $date = new DateTime('today');
+ return $date->getTimestamp();
+ },
+ 'comment' => Faker::text(255),
+ 'isNoUser' => 0,
+ 'displayName' => Faker::text(255),
+]);
diff --git a/tests/Unit/Factories/OptionFactory.php b/tests/Unit/Factories/OptionFactory.php
index 07f5f442..e13a3f9d 100644
--- a/tests/Unit/Factories/OptionFactory.php
+++ b/tests/Unit/Factories/OptionFactory.php
@@ -1,34 +1,42 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
- *
- * @author Kai Schröer <git@schroeer.co>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-use League\FactoryMuffin\Faker\Facade as Faker;
-
-/**
- * General factory for the text model.
- */
-$fm->define('OCA\Polls\Db\Option')->setDefinitions([
- 'pollOptionText' => Faker::text(255),
- 'timestamp' => 0,
- 'order' => 0,
- 'confirmed' => 0
-]);
+<?php
+/**
+ * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
+ *
+ * @author Kai Schröer <git@schroeer.co>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+use League\FactoryMuffin\Faker\Facade as Faker;
+
+/**
+ * General factory for the text model.
+ */
+$fm->define('OCA\Polls\Db\Option')->setDefinitions([
+ 'owner' => Faker::text(255),
+ 'ownerDisplayName' => Faker::text(255),
+ 'ownerIsNoUser' => 0,
+ 'released' => function () {
+ $date = new DateTime('now');
+ return $date->getTimestamp();
+ },
+ 'pollOptionText' => Faker::text(255),
+ 'timestamp' => 0,
+ 'order' => 0,
+ 'confirmed' => 0,
+ 'duration' => 0,
+]);
diff --git a/tests/Unit/Factories/PollFactory.php b/tests/Unit/Factories/PollFactory.php
index e2e0de33..01d3ee12 100644
--- a/tests/Unit/Factories/PollFactory.php
+++ b/tests/Unit/Factories/PollFactory.php
@@ -1,56 +1,62 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
- *
- * @author Kai Schröer <git@schroeer.co>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-use League\FactoryMuffin\Faker\Facade as Faker;
-
-/**
- * General factory for the poll model.
- */
-$fm->define('OCA\Polls\Db\Poll')->setDefinitions([
- 'type' => 'textPoll',
- 'title' => Faker::text(124),
- 'description' => Faker::text(255),
- 'owner' => Faker::firstNameMale(),
- 'created' => function () {
- $date = new DateTime('today');
- return $date->getTimestamp();
- },
- 'expire' => function () {
- $date = new DateTime('tomorrow');
- return $date->getTimestamp();
- },
- 'deleted' => function () {
- $date = new DateTime('+1 month');
- return $date->getTimestamp();
- },
- 'access' => 'public',
- 'anonymous' => 0,
- 'fullAnonymous' => 0,
- 'allowMaybe' => 1,
- 'options' => '["yes","no","maybe"]',
- 'settings' => '{"someJSON":0}',
- 'voteLimit' => 0,
- 'showResults' => 'always',
- 'adminAccess' => 0,
- 'important' => 0
-]);
+<?php
+/**
+ * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
+ *
+ * @author Kai Schröer <git@schroeer.co>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+use League\FactoryMuffin\Faker\Facade as Faker;
+
+/**
+ * General factory for the poll model.
+ */
+$fm->define('OCA\Polls\Db\Poll')->setDefinitions([
+ 'type' => 'textPoll',
+ 'title' => Faker::text(124),
+ 'description' => Faker::text(255),
+ 'owner' => Faker::firstNameMale(),
+ 'created' => function () {
+ $date = new DateTime('today');
+ return $date->getTimestamp();
+ },
+ 'expire' => function () {
+ $date = new DateTime('tomorrow');
+ return $date->getTimestamp();
+ },
+ 'deleted' => function () {
+ $date = new DateTime('+1 month');
+ return $date->getTimestamp();
+ },
+ 'access' => 'public',
+ 'anonymous' => 0,
+ 'allowComment' => 1,
+ 'allowMaybe' => 1,
+ 'allowProposals' => 1,
+ 'proposalsExpire' => function () {
+ $date = new DateTime('tomorrow');
+ return $date->getTimestamp();
+ },
+ 'voteLimit' => 0,
+ 'optionLimit' => 0,
+ 'showResults' => 'always',
+ 'adminAccess' => 0,
+ 'important' => 0,
+ 'hideBookedUp' => 0,
+ 'useNo' => 0,
+]);
diff --git a/tests/Unit/Factories/ShareFactory.php b/tests/Unit/Factories/ShareFactory.php
index 389ea222..2e72ce1e 100644
--- a/tests/Unit/Factories/ShareFactory.php
+++ b/tests/Unit/Factories/ShareFactory.php
@@ -1,33 +1,38 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
- *
- * @author Kai Schröer <git@schroeer.co>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-use League\FactoryMuffin\Faker\Facade as Faker;
-
-/**
- * General factory for the poll model.
- */
-$fm->define('OCA\Polls\Db\Share')->setDefinitions([
- 'userId' => Faker::firstNameMale(),
- 'emailAddress' => Faker::safeEmail(),
- 'displayName' => Faker::lastName()
-]);
+<?php
+/**
+ * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
+ *
+ * @author Kai Schröer <git@schroeer.co>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+use League\FactoryMuffin\Faker\Facade as Faker;
+
+/**
+ * General factory for the poll model.
+ */
+$fm->define('OCA\Polls\Db\Share')->setDefinitions([
+ 'userId' => Faker::firstNameMale(),
+ 'emailAddress' => Faker::safeEmail(),
+ 'invitationSent' => function () {
+ $date = new DateTime('today');
+ return $date->getTimestamp();
+ },
+ 'displayName' => Faker::lastName(),
+ 'isNoUser' => 0,
+]);
diff --git a/tests/Unit/Factories/VoteFactory.php b/tests/Unit/Factories/VoteFactory.php
index eee744b2..acc4281b 100644
--- a/tests/Unit/Factories/VoteFactory.php
+++ b/tests/Unit/Factories/VoteFactory.php
@@ -1,33 +1,35 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
- *
- * @author Kai Schröer <git@schroeer.co>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-use League\FactoryMuffin\Faker\Facade as Faker;
-
-/**
- * General factory for the vote model.
- */
-$fm->define('OCA\Polls\Db\Vote')->setDefinitions([
- 'userId' => Faker::firstNameMale(),
- 'voteOptionText' => Faker::text(255),
- 'voteAnswer' => 'yes'
-]);
+<?php
+/**
+ * @copyright Copyright (c) 2017 Kai Schröer <git@schroeer.co>
+ *
+ * @author Kai Schröer <git@schroeer.co>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+use League\FactoryMuffin\Faker\Facade as Faker;
+
+/**
+ * General factory for the vote model.
+ */
+$fm->define('OCA\Polls\Db\Vote')->setDefinitions([
+ 'userId' => Faker::firstNameMale(),
+ 'voteOptionText' => Faker::text(255),
+ 'voteAnswer' => 'yes',
+ 'displayName' => Faker::firstNameMale(),
+ 'isNoUser' => 0,
+]);