|
| 1 | +<?php |
| 2 | + |
| 3 | +use Behat\Behat\Tester\Exception\PendingException; |
| 4 | +use Behat\Behat\Context\Context; |
| 5 | +use Behat\Gherkin\Node\PyStringNode; |
| 6 | +use Behat\Gherkin\Node\TableNode; |
| 7 | +use OpenFeature\OpenFeatureAPI; |
| 8 | +use OpenFeature\OpenFeatureClient; |
| 9 | + |
| 10 | +/** |
| 11 | + * Defines application features from the specific context. |
| 12 | + */ |
| 13 | +class FeatureContext implements Context |
| 14 | +{ |
| 15 | + private OpenFeatureClient $client; |
| 16 | + |
| 17 | + /** |
| 18 | + * Initializes context. |
| 19 | + * |
| 20 | + * Every scenario gets its own context instance. |
| 21 | + * You can also pass arbitrary arguments to the |
| 22 | + * context constructor through behat.yml. |
| 23 | + */ |
| 24 | + public function __construct() |
| 25 | + { |
| 26 | + $this->client = OpenFeatureAPI::getInstance()->getClient('features', '1.0'); |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * @When a boolean flag with key :arg1 is evaluated with default value :arg2 |
| 31 | + */ |
| 32 | + public function aBooleanFlagWithKeyIsEvaluatedWithDefaultValue($arg1, $arg2) |
| 33 | + { |
| 34 | + throw new PendingException(); |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * @Then the resolved boolean value should be :arg1 |
| 39 | + */ |
| 40 | + public function theResolvedBooleanValueShouldBe($arg1) |
| 41 | + { |
| 42 | + throw new PendingException(); |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @When a string flag with key :arg1 is evaluated with default value :arg2 |
| 47 | + */ |
| 48 | + public function aStringFlagWithKeyIsEvaluatedWithDefaultValue($arg1, $arg2) |
| 49 | + { |
| 50 | + throw new PendingException(); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * @Then the resolved string value should be :arg1 |
| 55 | + */ |
| 56 | + public function theResolvedStringValueShouldBe($arg1) |
| 57 | + { |
| 58 | + throw new PendingException(); |
| 59 | + } |
| 60 | + |
| 61 | + /** |
| 62 | + * @When an integer flag with key :arg1 is evaluated with default value :arg2 |
| 63 | + */ |
| 64 | + public function anIntegerFlagWithKeyIsEvaluatedWithDefaultValue($arg1, $arg2) |
| 65 | + { |
| 66 | + throw new PendingException(); |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @Then the resolved integer value should be :arg1 |
| 71 | + */ |
| 72 | + public function theResolvedIntegerValueShouldBe($arg1) |
| 73 | + { |
| 74 | + throw new PendingException(); |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * @When a float flag with key :arg1 is evaluated with default value :arg2 |
| 79 | + */ |
| 80 | + public function aFloatFlagWithKeyIsEvaluatedWithDefaultValue($arg1, $arg2) |
| 81 | + { |
| 82 | + throw new PendingException(); |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * @Then the resolved float value should be :arg1 |
| 87 | + */ |
| 88 | + public function theResolvedFloatValueShouldBe($arg1) |
| 89 | + { |
| 90 | + throw new PendingException(); |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | + * @When an object flag with key :arg1 is evaluated with a null default value |
| 95 | + */ |
| 96 | + public function anObjectFlagWithKeyIsEvaluatedWithANullDefaultValue($arg1) |
| 97 | + { |
| 98 | + throw new PendingException(); |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * @Then the resolved object value should be contain fields :arg1, :arg2, and :arg3, with values :arg4, :arg5 and 100, respectively |
| 103 | + */ |
| 104 | + public function theResolvedObjectValueShouldBeContainFieldsAndWithValuesAndRespectively($arg1, $arg2, $arg3, $arg4, $arg5) |
| 105 | + { |
| 106 | + throw new PendingException(); |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * @When a boolean flag with key :arg1 is evaluated with details and default value :arg2 |
| 111 | + */ |
| 112 | + public function aBooleanFlagWithKeyIsEvaluatedWithDetailsAndDefaultValue($arg1, $arg2) |
| 113 | + { |
| 114 | + throw new PendingException(); |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * @Then the resolved boolean details value should be :arg1, the variant should be :arg2, and the reason should be :arg3 |
| 119 | + */ |
| 120 | + public function theResolvedBooleanDetailsValueShouldBeTheVariantShouldBeAndTheReasonShouldBe($arg1, $arg2, $arg3) |
| 121 | + { |
| 122 | + throw new PendingException(); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * @When a string flag with key :arg1 is evaluated with details and default value :arg2 |
| 127 | + */ |
| 128 | + public function aStringFlagWithKeyIsEvaluatedWithDetailsAndDefaultValue($arg1, $arg2) |
| 129 | + { |
| 130 | + throw new PendingException(); |
| 131 | + } |
| 132 | + |
| 133 | + /** |
| 134 | + * @Then the resolved string details value should be :arg1, the variant should be :arg2, and the reason should be :arg3 |
| 135 | + */ |
| 136 | + public function theResolvedStringDetailsValueShouldBeTheVariantShouldBeAndTheReasonShouldBe($arg1, $arg2, $arg3) |
| 137 | + { |
| 138 | + throw new PendingException(); |
| 139 | + } |
| 140 | + |
| 141 | + /** |
| 142 | + * @When an integer flag with key :arg1 is evaluated with details and default value :arg2 |
| 143 | + */ |
| 144 | + public function anIntegerFlagWithKeyIsEvaluatedWithDetailsAndDefaultValue($arg1, $arg2) |
| 145 | + { |
| 146 | + throw new PendingException(); |
| 147 | + } |
| 148 | + |
| 149 | + /** |
| 150 | + * @Then the resolved integer details value should be 10, the variant should be :arg1, and the reason should be :arg2 |
| 151 | + */ |
| 152 | + public function theResolvedIntegerDetailsValueShouldBeTheVariantShouldBeAndTheReasonShouldBe($arg1, $arg2) |
| 153 | + { |
| 154 | + throw new PendingException(); |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * @When a float flag with key :arg1 is evaluated with details and default value :arg2 |
| 159 | + */ |
| 160 | + public function aFloatFlagWithKeyIsEvaluatedWithDetailsAndDefaultValue($arg1, $arg2) |
| 161 | + { |
| 162 | + throw new PendingException(); |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * @Then the resolved float details value should be 0.5, the variant should be :arg1, and the reason should be :arg2 |
| 167 | + */ |
| 168 | + public function theResolvedFloatDetailsValueShouldBeTheVariantShouldBeAndTheReasonShouldBe($arg1, $arg2) |
| 169 | + { |
| 170 | + throw new PendingException(); |
| 171 | + } |
| 172 | + |
| 173 | + /** |
| 174 | + * @When an object flag with key :arg1 is evaluated with details and a null default value |
| 175 | + */ |
| 176 | + public function anObjectFlagWithKeyIsEvaluatedWithDetailsAndANullDefaultValue($arg1) |
| 177 | + { |
| 178 | + throw new PendingException(); |
| 179 | + } |
| 180 | + |
| 181 | + /** |
| 182 | + * @Then the resolved object details value should be contain fields :arg1, :arg2, and :arg3, with values :arg4, :arg5 and 100, respectively |
| 183 | + */ |
| 184 | + public function theResolvedObjectDetailsValueShouldBeContainFieldsAndWithValuesAndRespectively($arg1, $arg2, $arg3, $arg4, $arg5) |
| 185 | + { |
| 186 | + throw new PendingException(); |
| 187 | + } |
| 188 | + |
| 189 | + /** |
| 190 | + * @Then the variant should be :arg1, and the reason should be :arg2 |
| 191 | + */ |
| 192 | + public function theVariantShouldBeAndTheReasonShouldBe($arg1, $arg2) |
| 193 | + { |
| 194 | + throw new PendingException(); |
| 195 | + } |
| 196 | + |
| 197 | + /** |
| 198 | + * @When context contains keys :arg1, :arg2, :arg3, :arg4 with values :arg5, :arg6, 29, :arg7 |
| 199 | + */ |
| 200 | + public function contextContainsKeysWithValues($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7) |
| 201 | + { |
| 202 | + throw new PendingException(); |
| 203 | + } |
| 204 | + |
| 205 | + /** |
| 206 | + * @When a flag with key :arg1 is evaluated with default value :arg2 |
| 207 | + */ |
| 208 | + public function aFlagWithKeyIsEvaluatedWithDefaultValue($arg1, $arg2) |
| 209 | + { |
| 210 | + throw new PendingException(); |
| 211 | + } |
| 212 | + |
| 213 | + /** |
| 214 | + * @Then the resolved string response should be :arg1 |
| 215 | + */ |
| 216 | + public function theResolvedStringResponseShouldBe($arg1) |
| 217 | + { |
| 218 | + throw new PendingException(); |
| 219 | + } |
| 220 | + |
| 221 | + /** |
| 222 | + * @Then the resolved flag value is :arg1 when the context is empty |
| 223 | + */ |
| 224 | + public function theResolvedFlagValueIsWhenTheContextIsEmpty($arg1) |
| 225 | + { |
| 226 | + throw new PendingException(); |
| 227 | + } |
| 228 | + |
| 229 | + /** |
| 230 | + * @When a non-existent string flag with key :arg1 is evaluated with details and a default value :arg2 |
| 231 | + */ |
| 232 | + public function aNonExistentStringFlagWithKeyIsEvaluatedWithDetailsAndADefaultValue($arg1, $arg2) |
| 233 | + { |
| 234 | + throw new PendingException(); |
| 235 | + } |
| 236 | + |
| 237 | + /** |
| 238 | + * @Then then the default string value should be returned |
| 239 | + */ |
| 240 | + public function thenTheDefaultStringValueShouldBeReturned() |
| 241 | + { |
| 242 | + throw new PendingException(); |
| 243 | + } |
| 244 | + |
| 245 | + /** |
| 246 | + * @Then the reason should indicate an error and the error code should indicate a missing flag with :arg1 |
| 247 | + */ |
| 248 | + public function theReasonShouldIndicateAnErrorAndTheErrorCodeShouldIndicateAMissingFlagWith($arg1) |
| 249 | + { |
| 250 | + throw new PendingException(); |
| 251 | + } |
| 252 | + |
| 253 | + /** |
| 254 | + * @When a string flag with key :arg1 is evaluated as an integer, with details and a default value :arg2 |
| 255 | + */ |
| 256 | + public function aStringFlagWithKeyIsEvaluatedAsAnIntegerWithDetailsAndADefaultValue($arg1, $arg2) |
| 257 | + { |
| 258 | + throw new PendingException(); |
| 259 | + } |
| 260 | + |
| 261 | + /** |
| 262 | + * @Then then the default integer value should be returned |
| 263 | + */ |
| 264 | + public function thenTheDefaultIntegerValueShouldBeReturned() |
| 265 | + { |
| 266 | + throw new PendingException(); |
| 267 | + } |
| 268 | + |
| 269 | + /** |
| 270 | + * @Then the reason should indicate an error and the error code should indicate a type mismatch with :arg1 |
| 271 | + */ |
| 272 | + public function theReasonShouldIndicateAnErrorAndTheErrorCodeShouldIndicateATypeMismatchWith($arg1) |
| 273 | + { |
| 274 | + throw new PendingException(); |
| 275 | + } |
| 276 | +} |
0 commit comments