-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFeatureContext.php
More file actions
61 lines (53 loc) · 1.75 KB
/
FeatureContext.php
File metadata and controls
61 lines (53 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
class FeatureContext implements Context, SnippetAcceptingContext
{
private $command_output;
/**
* @When I run "ee config set test_key test_value"
*/
public function iRunSetTestKeyCommand()
{
$this->command_output = shell_exec('ee config set test_key test_value');
}
/**
* @Then STDOUT should not return anything
*/
public function stdoutShouldNotReturnAnything()
{
if (trim($this->command_output) !== '') {
throw new Exception("Expected no output, but got '$this->command_output'");
}
}
/**
* @When I run "ee config get test_key"
*/
public function iRunGetTestKeyCommand()
{
$this->command_output = shell_exec('ee config get test_key');
}
/**
* @Then STDOUT should return "test_value"
*/
public function stdoutShouldReturnTestValue()
{
if (trim($this->command_output) !== 'test_value') {
throw new Exception("Expected 'test_value', but got '$this->command_output'");
}
}
/**
* @Then the configuration file should contain "test_key: test_value"
*/
public function theConfigurationFileShouldContainTestKeyTestValue()
{
$config_file_path = '/opt/easyengine/config/config.yml';
if (!file_exists($config_file_path)) {
throw new Exception("Configuration file does not exist at $config_file_path");
}
$config_file_content = file_get_contents($config_file_path);
if (strpos($config_file_content, 'test_key: test_value') === false) {
throw new Exception("Configuration file does not contain 'test_key: test_value'");
}
}
}