Completed
Push — master ( 5e7886...331704 )
by Greg
03:33
created

tests/unit/ConfigurationTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace unit;
4
5
use Robo\Robo;
6
use Robo\Task\BaseTask;
7
8
class ConfigurationTest extends \Codeception\TestCase\Test
9
{
10
    public function testDifferentTasksCanHaveSameConfigKeys()
11
    {
12
        ConfigurationTestTaskA::configure('key', 'value-a');
0 ignored issues
show
Deprecated Code introduced by
The method Robo\Common\ConfigAwareTrait::configure() has been deprecated.

This method has been deprecated.

Loading history...
13
        ConfigurationTestTaskB::configure('key', 'value-b');
0 ignored issues
show
Deprecated Code introduced by
The method Robo\Common\ConfigAwareTrait::configure() has been deprecated.

This method has been deprecated.

Loading history...
14
15
        $taskA = new ConfigurationTestTaskA();
16
        $taskA->setConfig(Robo::config());
17
        verify($taskA->run())->equals('value-a');
18
19
        $taskB = new ConfigurationTestTaskB();
20
        $taskB->setConfig(Robo::config());
21
        verify($taskB->run())->equals('value-b');
22
    }
23
24
}
25
26
class ConfigurationTestTaskA extends BaseTask
27
{
28
    public function run()
29
    {
30
        return $this->getConfigValue('key');
31
    }
32
}
33
34
class ConfigurationTestTaskB extends BaseTask
35
{
36
    public function run()
37
    {
38
        return $this->getConfigValue('key');
39
    }
40
}
41