Completed
Pull Request — master (#12)
by ABDULMALIK
02:03
created

BaseTestCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 35
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createRepositoryRegistry() 0 4 1
A setUp() 0 8 1
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