Completed
Push — feature/EVO-7278-tracking-info... ( e99586...a5fe2c )
by
unknown
11:44
created

ActivityManagerTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Basic functional test for ActivityManager
4
 */
5
namespace Graviton\AuditTrackingBundle\Tests\Manager;
6
7
use Graviton\AuditTrackingBundle\Manager\ActivityManager;
8
use Graviton\TestBundle\Test\RestTestCase;
9
10
/**
11
 * @category GravitonCoreBundle
12
 * @package  Graviton
13
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
14
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
15
 * @link     http://swisscom.ch
16
 */
17
class ActivityManagerTest extends RestTestCase
18
{
19
    /** @var ActivityManager */
20
    private $activityManager;
21
22
    /**
23
     * Ensure a clean Db for test
24
     *
25
     * @return void
26
     */
27
    public function setUp()
28
    {
29
        $this->activityManager = $this->getContainer()->get('graviton.audit.manager.activity');
30
    }
31
32
    /**
33
     * Verifies the correct behavior of:
34
     * setConfiguration()
35
     * getConfigValue()
36
     *
37
     * @return void
38
     */
39
    public function testGetConfigValue()
40
    {
41
        $keys = [
42
            'bool_true' => true,
43
            'bool_false' => false,
44
            'int_1' => 1,
45
            'int' => 14,
46
            'string_a' => "simple string",
47
            'array_a' => ['item1', 'item2']
48
        ];
49
50
        $this->activityManager->setConfiguration($keys);
51
52
        foreach ($keys as $key => $val) {
53
            $type = explode('_', $key);
54
            $value = $this->activityManager->getConfigValue($key, $type[0]);
55
            $this->assertEquals($value, $val, 'Key '.$key.' was not handled as expected');
56
        }
57
    }
58
}
59