diff options
author | dartcafe <github@dartcafe.de> | 2019-12-21 23:01:06 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2019-12-21 23:01:06 +0300 |
commit | 923fe1897f3f6962d95a94577b2d03ae5bc512ad (patch) | |
tree | 5c9031d3dfdf4969d98c2377767045e2294a9c35 /tests | |
parent | 9d015be1fa920e002a2f9cbacdfdafacbe807357 (diff) |
Prepare mail notification and update tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Unit/Controller/PageControllerTest.php | 4 | ||||
-rw-r--r-- | tests/Unit/Db/SubscriptionMapperTest.php (renamed from tests/Unit/Db/NotificationMapperTest.php) | 44 | ||||
-rw-r--r-- | tests/Unit/Factories/SubscriptionFactory.php (renamed from tests/Unit/Factories/NotificationFactory.php) | 4 |
3 files changed, 26 insertions, 26 deletions
diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php index e73f8c0a..cbf14159 100644 --- a/tests/Unit/Controller/PageControllerTest.php +++ b/tests/Unit/Controller/PageControllerTest.php @@ -80,7 +80,7 @@ class PageControllerTest extends UnitTestCase { $eventMapper = $this->getMockBuilder('OCA\Polls\Db\EventMapper') ->disableOriginalConstructor() ->getMock(); - $notificationMapper = $this->getMockBuilder('OCA\Polls\Db\NotificationMapper') + $subscriptionMapper = $this->getMockBuilder('OCA\Polls\Db\SubscriptionMapper') ->disableOriginalConstructor() ->getMock(); $voteMapper = $this->getMockBuilder('OCA\Polls\Db\VoteMapper') @@ -102,7 +102,7 @@ class PageControllerTest extends UnitTestCase { $commentMapper, $optionMapper, $eventMapper, - $notificationMapper, + $subscriptionMapper, $voteMapper, $mailer ); diff --git a/tests/Unit/Db/NotificationMapperTest.php b/tests/Unit/Db/SubscriptionMapperTest.php index 6f07eb50..4a2c64d2 100644 --- a/tests/Unit/Db/NotificationMapperTest.php +++ b/tests/Unit/Db/SubscriptionMapperTest.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\Notification; -use OCA\Polls\Db\NotificationMapper; +use OCA\Polls\Db\Subscription; +use OCA\Polls\Db\SubscriptionMapper; use OCA\Polls\Tests\Unit\UnitTestCase; use OCP\IDBConnection; use League\FactoryMuffin\Faker\Facade as Faker; -class NotificationMapperTest extends UnitTestCase { +class SubscriptionMapperTest extends UnitTestCase { /** @var IDBConnection */ private $con; - /** @var NotificationMapper */ - private $notificationMapper; + /** @var SubscriptionMapper */ + private $subscriptionMapper; /** @var EventMapper */ private $eventMapper; @@ -46,52 +46,52 @@ class NotificationMapperTest extends UnitTestCase { protected function setUp(): void { parent::setUp(); $this->con = \OC::$server->getDatabaseConnection(); - $this->notificationMapper = new NotificationMapper($this->con); + $this->subscriptionMapper = new SubscriptionMapper($this->con); $this->eventMapper = new EventMapper($this->con); } /** * Create some fake data and persist them to the database. * - * @return Notification + * @return Subscription */ public function testCreate() { /** @var Event $event */ $event = $this->fm->instance('OCA\Polls\Db\Event'); $this->assertInstanceOf(Event::class, $this->eventMapper->insert($event)); - /** @var Notification $notification */ - $notification = $this->fm->instance('OCA\Polls\Db\Notification'); - $notification->setPollId($event->getId()); - $this->assertInstanceOf(Notification::class, $this->notificationMapper->insert($notification)); + /** @var Subscription $subscription */ + $subscription = $this->fm->instance('OCA\Polls\Db\Subscription'); + $subscription->setPollId($event->getId()); + $this->assertInstanceOf(Subscription::class, $this->subscriptionMapper->insert($subscription)); - return $notification; + return $subscription; } /** * Update the previously created entry and persist the changes. * * @depends testCreate - * @param Notification $notification - * @return Notification + * @param Subscription $subscription + * @return Subscription */ - public function testUpdate(Notification $notification) { + public function testUpdate(Subscription $subscription) { $newUserId = Faker::firstNameMale(); - $notification->setUserId($newUserId()); - $this->notificationMapper->update($notification); + $subscription->setUserId($newUserId()); + $this->subscriptionMapper->update($subscription); - return $notification; + return $subscription; } /** * Delete the previously created entries from the database. * * @depends testUpdate - * @param Notification $notification + * @param Subscription $subscription */ - public function testDelete(Notification $notification) { - $event = $this->eventMapper->find($notification->getPollId()); - $this->notificationMapper->delete($notification); + public function testDelete(Subscription $subscription) { + $event = $this->eventMapper->find($subscription->getPollId()); + $this->subscriptionMapper->delete($subscription); $this->eventMapper->delete($event); } } diff --git a/tests/Unit/Factories/NotificationFactory.php b/tests/Unit/Factories/SubscriptionFactory.php index 6db9d60b..4e97f153 100644 --- a/tests/Unit/Factories/NotificationFactory.php +++ b/tests/Unit/Factories/SubscriptionFactory.php @@ -24,8 +24,8 @@ use League\FactoryMuffin\Faker\Facade as Faker; /** - * General factory for the notification model. + * General factory for the Subscription model. */ -$fm->define('OCA\Polls\Db\Notification')->setDefinitions([ +$fm->define('OCA\Polls\Db\Subscription')->setDefinitions([ 'userId' => Faker::firstNameMale() ]); |