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>2018-12-29 00:33:31 +0300
committerdartcafe <github@dartcafe.de>2018-12-29 00:33:31 +0300
commitc76b51d26bdf184a6b15e81dc80ef8ae78c7785f (patch)
treef47aa2694173c8051b4483493e62401a086a382d /tests
parent4b4599c49cd56786868e68898c6c6b820ecf2b0d (diff)
Grammar
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Controller/PageControllerTest.php8
-rw-r--r--tests/Unit/Db/OptionMapperTest.php (renamed from tests/Unit/Db/OptionsMapperTest.php)46
-rw-r--r--tests/Unit/Db/VoteMapperTest.php (renamed from tests/Unit/Db/VotesMapperTest.php)48
-rw-r--r--tests/Unit/Factories/OptionFactory.php (renamed from tests/Unit/Factories/OptionsFactory.php)2
-rw-r--r--tests/Unit/Factories/VoteFactory.php (renamed from tests/Unit/Factories/VotesFactory.php)4
5 files changed, 54 insertions, 54 deletions
diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php
index b828eba0..2ae99703 100644
--- a/tests/Unit/Controller/PageControllerTest.php
+++ b/tests/Unit/Controller/PageControllerTest.php
@@ -74,7 +74,7 @@ class PageControllerTest extends UnitTestCase {
$commentMapper = $this->getMockBuilder('OCA\Polls\Db\CommentMapper')
->disableOriginalConstructor()
->getMock();
- $optionsMapper = $this->getMockBuilder('OCA\Polls\Db\OptionsMapper')
+ $optionMapper = $this->getMockBuilder('OCA\Polls\Db\OptionMapper')
->disableOriginalConstructor()
->getMock();
$eventMapper = $this->getMockBuilder('OCA\Polls\Db\EventMapper')
@@ -83,7 +83,7 @@ class PageControllerTest extends UnitTestCase {
$notificationMapper = $this->getMockBuilder('OCA\Polls\Db\NotificationMapper')
->disableOriginalConstructor()
->getMock();
- $votesMapper = $this->getMockBuilder('OCA\Polls\Db\VotesMapper')
+ $voteMapper = $this->getMockBuilder('OCA\Polls\Db\VoteMapper')
->disableOriginalConstructor()
->getMock();
@@ -100,10 +100,10 @@ class PageControllerTest extends UnitTestCase {
$urlGenerator,
$this->userId,
$commentMapper,
- $optionsMapper,
+ $optionMapper,
$eventMapper,
$notificationMapper,
- $votesMapper,
+ $voteMapper,
$mailer
);
}
diff --git a/tests/Unit/Db/OptionsMapperTest.php b/tests/Unit/Db/OptionMapperTest.php
index 61654f14..4dd99e72 100644
--- a/tests/Unit/Db/OptionsMapperTest.php
+++ b/tests/Unit/Db/OptionMapperTest.php
@@ -25,18 +25,18 @@ namespace OCA\Polls\Tests\Unit\Db;
use OCA\Polls\Db\Event;
use OCA\Polls\Db\EventMapper;
-use OCA\Polls\Db\Options;
-use OCA\Polls\Db\OptionsMapper;
+use OCA\Polls\Db\Option;
+use OCA\Polls\Db\OptionMapper;
use OCA\Polls\Tests\Unit\UnitTestCase;
use OCP\IDBConnection;
use League\FactoryMuffin\Faker\Facade as Faker;
-class OptionsMapperTest extends UnitTestCase {
+class OptionMapperTest extends UnitTestCase {
/** @var IDBConnection */
private $con;
- /** @var OptionsMapper */
- private $optionsMapper;
+ /** @var OptionMapper */
+ private $optionMapper;
/** @var EventMapper */
private $eventMapper;
@@ -46,52 +46,52 @@ class OptionsMapperTest extends UnitTestCase {
public function setUp() {
parent::setUp();
$this->con = \OC::$server->getDatabaseConnection();
- $this->optionsMapper = new OptionsMapper($this->con);
+ $this->optionMapper = new OptionMapper($this->con);
$this->eventMapper = new EventMapper($this->con);
}
/**
* Create some fake data and persist them to the database.
*
- * @return Options
+ * @return Option
*/
public function testCreate() {
/** @var Event $event */
$event = $this->fm->instance('OCA\Polls\Db\Event');
$this->assertInstanceOf(Event::class, $this->eventMapper->insert($event));
- /** @var Options $options */
- $options = $this->fm->instance('OCA\Polls\Db\Options');
- $options->setPollId($event->getId());
- $this->assertInstanceOf(Options::class, $this->optionsMapper->insert($options));
+ /** @var Option $option */
+ $option = $this->fm->instance('OCA\Polls\Db\Option');
+ $option->setPollId($event->getId());
+ $this->assertInstanceOf(Option::class, $this->optionMapper->insert($option));
- return $options;
+ return $option;
}
/**
* Update the previously created entry and persist the changes.
*
* @depends testCreate
- * @param Options $options
- * @return Options
+ * @param Option $option
+ * @return Option
*/
- public function testUpdate(Options $options) {
+ public function testUpdate(Option $option) {
$newPollOptionText = Faker::paragraph();
- $options->setPollOptionText($newPollOptionText());
- $this->optionsMapper->update($options);
+ $option->setPollOptionText($newPollOptionText());
+ $this->optionMapper->update($option);
- return $options;
+ return $option;
}
-
+
/**
* Delete the previously created entries from the database.
*
* @depends testUpdate
- * @param Options $options
+ * @param Option $option
*/
- public function testDelete(Options $options) {
- $event = $this->eventMapper->find($options->getPollId());
- $this->optionsMapper->delete($options);
+ public function testDelete(Option $option) {
+ $event = $this->eventMapper->find($option->getPollId());
+ $this->optionMapper->delete($option);
$this->eventMapper->delete($event);
}
}
diff --git a/tests/Unit/Db/VotesMapperTest.php b/tests/Unit/Db/VoteMapperTest.php
index f2617ec9..db4dbd6f 100644
--- a/tests/Unit/Db/VotesMapperTest.php
+++ b/tests/Unit/Db/VoteMapperTest.php
@@ -25,18 +25,18 @@ namespace OCA\Polls\Tests\Unit\Db;
use OCA\Polls\Db\Event;
use OCA\Polls\Db\EventMapper;
-use OCA\Polls\Db\Votes;
-use OCA\Polls\Db\VotesMapper;
+use OCA\Polls\Db\Vote;
+use OCA\Polls\Db\VoteMapper;
use OCA\Polls\Tests\Unit\UnitTestCase;
use OCP\IDBConnection;
use League\FactoryMuffin\Faker\Facade as Faker;
-class VotesMapperTest extends UnitTestCase {
+class VoteMapperTest extends UnitTestCase {
/** @var IDBConnection */
private $con;
- /** @var VotesMapper */
- private $votesMapper;
+ /** @var VoteMapper */
+ private $voteMapper;
/** @var EventMapper */
private $eventMapper;
@@ -46,54 +46,54 @@ class VotesMapperTest extends UnitTestCase {
public function setUp() {
parent::setUp();
$this->con = \OC::$server->getDatabaseConnection();
- $this->votesMapper = new VotesMapper($this->con);
+ $this->voteMapper = new VoteMapper($this->con);
$this->eventMapper = new EventMapper($this->con);
}
/**
* Create some fake data and persist them to the database.
*
- * @return Votes
+ * @return Vote
*/
public function testCreate() {
/** @var Event $event */
$event = $this->fm->instance('OCA\Polls\Db\Event');
$this->assertInstanceOf(Event::class, $this->eventMapper->insert($event));
-
- /** @var Votes $votes */
- $votes = $this->fm->instance('OCA\Polls\Db\Votes');
- $votes->setPollId($event->getId());
- $votes->setVoteOptionId(1);
- $this->assertInstanceOf(Votes::class, $this->votesMapper->insert($votes));
- return $votes;
+ /** @var Vote $vote */
+ $vote = $this->fm->instance('OCA\Polls\Db\Vote');
+ $vote->setPollId($event->getId());
+ $vote->setVoteOptionId(1);
+ $this->assertInstanceOf(Vote::class, $this->voteMapper->insert($vote));
+
+ return $vote;
}
/**
* Update the previously created entry and persist the changes.
*
* @depends testCreate
- * @param Votes $votes
- * @return Votes
+ * @param Vote $vote
+ * @return Vote
*/
- public function testUpdate(Votes $votes) {
+ public function testUpdate(Vote $vote) {
$newVoteOptionText = Faker::date('Y-m-d H:i:s');
- $votes->setVoteOptionText($newVoteOptionText());
- $this->votesMapper->update($votes);
+ $vote->setVoteOptionText($newVoteOptionText());
+ $this->voteMapper->update($vote);
- return $votes;
+ return $vote;
}
/**
* Delete the previously created entries from the database.
*
* @depends testUpdate
- * @param Votes $votes
+ * @param Vote $vote
*/
- public function testDelete(Votes $votes) {
- $event = $this->eventMapper->find($votes->getPollId());
- $this->votesMapper->delete($votes);
+ public function testDelete(Vote $vote) {
+ $event = $this->eventMapper->find($vote->getPollId());
+ $this->voteMapper->delete($vote);
$this->eventMapper->delete($event);
}
}
diff --git a/tests/Unit/Factories/OptionsFactory.php b/tests/Unit/Factories/OptionFactory.php
index d1185a3b..872b2d0e 100644
--- a/tests/Unit/Factories/OptionsFactory.php
+++ b/tests/Unit/Factories/OptionFactory.php
@@ -26,6 +26,6 @@ use League\FactoryMuffin\Faker\Facade as Faker;
/**
* General factory for the text model.
*/
-$fm->define('OCA\Polls\Db\Options')->setDefinitions([
+$fm->define('OCA\Polls\Db\Option')->setDefinitions([
'pollOptionText' => Faker::text(255)
]);
diff --git a/tests/Unit/Factories/VotesFactory.php b/tests/Unit/Factories/VoteFactory.php
index 4d8f7529..5e5828fa 100644
--- a/tests/Unit/Factories/VotesFactory.php
+++ b/tests/Unit/Factories/VoteFactory.php
@@ -24,9 +24,9 @@
use League\FactoryMuffin\Faker\Facade as Faker;
/**
- * General factory for the votes model.
+ * General factory for the vote model.
*/
-$fm->define('OCA\Polls\Db\Votes')->setDefinitions([
+$fm->define('OCA\Polls\Db\Vote')->setDefinitions([
'voteOptionText' => Faker::text(255),
'userId' => Faker::firstNameMale(),
'voteAnswer' => 'yes'