GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( fb9f08...545a0a )
by Андрей
06:33
created

DefaultVariableResolverTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 56
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testTranslateVariablesResolveFromTransientVars() 0 15 1
A testTranslateVariablesMultiVariables() 0 16 1
1
<?php
2
/**
3
 * @link    https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\PhpUnitTest\Util;
7
8
use PHPUnit_Framework_TestCase as TestCase;
9
use OldTown\Workflow\TransientVars\BaseTransientVars;
10
use OldTown\PropertySet\PropertySetInterface;
11
use OldTown\Workflow\Util\DefaultVariableResolver;
12
13
/**
14
 * Class DefaultVariableResolverTest
15
 *
16
 * @package OldTown\Workflow\PhpUnitTest\Util
17
 */
18
class  DefaultVariableResolverTest extends TestCase
19
{
20
    /**
21
     * @var DefaultVariableResolver
22
     */
23
    protected $variableResolver;
24
25
    /**
26
     * @return void
27
     */
28
    protected function setUp()
29
    {
30
        $this->variableResolver = new DefaultVariableResolver();
31
        parent::setUp();
32
    }
33
34
    /**
35
     * Проверка получения значения из TransientVars.
36
     *
37
     */
38
    public function testTranslateVariablesResolveFromTransientVars()
39
    {
40
        $tv = new BaseTransientVars();
41
        /** @var PropertySetInterface $ps */
42
        $ps = $this->getMock(PropertySetInterface::class);
43
44
        $var = '${testVariable}';
45
46
        $expected = new \stdClass();
47
48
        $tv['testVariable'] = $expected;
49
        $actual = $this->variableResolver->translateVariables($var, $tv, $ps);
50
51
        static::assertTrue($expected === $actual, $actual);
52
    }
53
54
    /**
55
     * Проверка замены нескольких переменных из TransientVars
56
     */
57
    public function testTranslateVariablesMultiVariables()
58
    {
59
        $str = 'text1 ${var1} text2 ${var2} ${var3}';
60
61
        $tv = new BaseTransientVars();
62
        $tv['var1'] = 'var1_value';
63
        $tv['var2'] = 'var2_value';
64
        $tv['var3'] = 'var3_value';
65
66
        /** @var PropertySetInterface $ps */
67
        $ps = $this->getMock(PropertySetInterface::class);
68
69
        $actual = $this->variableResolver->translateVariables($str, $tv, $ps);
70
71
        static::assertEquals('text1 var1_value text2 var2_value var3_value', $actual);
72
    }
73
}
74