Completed
Pull Request — master (#12)
by ABDULMALIK
01:19
created

BaseTestCase::createRepositoryRegistry()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Tests\Unit;
4
5
use Potievdev\SlimRbac\Models\RepositoryRegistry;
6
use Potievdev\SlimRbac\Structure\AuthOptions;
7
8
/**
9
 * Class BaseTestCase
10
 * @package Tests\Unit
11
 */
12
class BaseTestCase extends \PHPUnit_Framework_TestCase
13
{
14
    /** Moderator user identifier */
15
    const MODERATOR_USER_ID = 1;
16
    /** Admin user identifier */
17
    const ADMIN_USER_ID = 2;
18
    /** User with this id not exists in database */
19
    const NOT_USER_ID = 3;
20
21
    /** @var \Doctrine\ORM\EntityManager $entityManager */
22
    protected $entityManager;
23
24
    /** @var AuthOptions $authOptions */
25
    protected $authOptions;
26
27
    /**
28
     * @return RepositoryRegistry
29
     */
30
    protected function createRepositoryRegistry()
31
    {
32
        return new RepositoryRegistry($this->entityManager);
33
    }
34
35
    /**
36
     * Initializing AuthOptions, AuthManager and AuthOptions
37
     */
38
    public function setUp()
39
    {
40
        $this->entityManager = require __DIR__ . '/../../config/sr-config.php';
41
42
        $this->authOptions = new AuthOptions();
43
44
        $this->authOptions->setEntityManager($this->entityManager);
45
    }
46
}
47