Completed
Push — master ( 59746f...828139 )
by Rafael
04:54
created

StorageContext   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 18
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A grabToUseAs() 0 3 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Behat\Context;
12
13
use Behat\Behat\Context\Context;
14
use Ynlo\GraphQLBundle\Behat\Storage\StorageAwareInterface;
15
use Ynlo\GraphQLBundle\Behat\Storage\StorageAwareTrait;
16
17
/**
18
 * Work with the storage to save values temporarily to re-use during steps
19
 */
20
final class StorageContext implements Context, StorageAwareInterface
21
{
22
    use StorageAwareTrait;
23
24
    /**
25
     * Store a value to re-use later
26
     *
27
     * Example:
28
     *
29
     * <code>
30
     *  - And grab "{response.data.add.order.items}" to use as "orderItems"
31
     * </code>
32
     *
33
     * @Given /^grab "([^"]*)" to use as "([^"]*)"$/
34
     */
35
    public function grabToUseAs($value, $name)
36
    {
37
        $this->storage->setValue($name, $value);
38
    }
39
}
40