SubscriptionRepositoryTest added.

This commit is contained in:
Alexey Skobkin 2017-01-09 22:47:15 +03:00
parent 00b7c1d2f5
commit 0cf5814c7a
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
<?php
namespace Tests\Skobkin\PointToolsBundle\Repository;
use Doctrine\ORM\EntityManager;
use Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionRepository;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class SubscriptionRepositoryTest extends KernelTestCase
{
/**
* @var EntityManager
*/
private $em;
/**
* @var SubscriptionRepository
*/
private $subscriptionRepo;
protected function setUp()
{
self::bootKernel();
$this->em = static::$kernel->getContainer()->get('doctrine')->getManager();
$this->subscriptionRepo = $this->em->getRepository('SkobkinPointToolsBundle:Subscription');
}
public function testGetUserSubscribersCountById(): int
{
$count = $this->subscriptionRepo->getUserSubscribersCountById(99999);
$this->assertInternalType('int', $count, 'Not integer returned');
$this->assertGreaterThanOrEqual(2, $count, 'Lesser than 2 subscribers found');
$this->assertLessThanOrEqual(5, $count, 'More than 5 subscribers found');
return $count;
}
}