Completed
Push — 3.8.x ( 2cd6fd...b176ac )
by Tim
07:26
created

theAttributeSetDeletionProcessHasBeenStarted()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use Behat\Behat\Context\Context;
4
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
5
use TechDivision\Import\Utils\CommandNames;
6
7
/**
8
 * Defines application features from the specific context.
9
 */
10 View Code Duplication
class AttributeSetFeatureContext implements Context
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
13
    /**
14
     * @var \ConsoleContext
15
     */
16
    private $consoleContext;
17
18
    /** @BeforeScenario */
19
    public function before(BeforeScenarioScope $scope)
20
    {
21
22
        // load the environment
23
        /** @var Behat\Behat\Context\Environment\InitializedContextEnvironment $environment */
24
        $environment = $scope->getEnvironment();
25
26
        // make the console context available
27
        $this->consoleContext = $environment->getContext(ConsoleContext::class);
28
    }
29
30
    /**
31
     * @Given attribute sets have been imported
32
     */
33
    public function attributeSetsHaveBeenImported()
34
    {
35
        $this->filesWithAttributeSetsToBeUpdatedAreAvailable();
36
        $this->theAttributeSetImportProcessHasBeenStarted();
37
    }
38
39
    /**
40
     * @Given files with attribute sets to be updated are available
41
     * @Given files with attribute sets to be deleted are available
42
     * @Given files with attribute sets to be replaced are available
43
     */
44
    public function filesWithAttributeSetsToBeUpdatedAreAvailable()
45
    {
46
        $this->consoleContext->aThirdPartySystemHasCopiedTheFileIntoTheImportFolder(
47
            'vendor/techdivision/import-sample-data/generic/data/attributes-set/add-update/attribute-set-import_20190104-114000_01.csv',
48
            'var/importexport'
49
        );
50
    }
51
52
    /**
53
     * @Given the attribute set import process has been started
54
     */
55
    public function theAttributeSetImportProcessHasBeenStarted()
56
    {
57
        $this->consoleContext->theCommandHasBeenExecuted(sprintf('bin/import-simple %s', CommandNames::IMPORT_CREATE_OK_FILE));
58
        $this->consoleContext->theCommandHasBeenExecuted(sprintf('bin/import-simple %s add-update', CommandNames::IMPORT_ATTRIBUTES_SET));
59
    }
60
61
    /**
62
     * @Given the attribute set deletion process has been started
63
     */
64
    public function theAttributeSetDeletionProcessHasBeenStarted()
65
    {
66
        $this->consoleContext->theCommandHasBeenExecuted(sprintf('bin/import-simple %s', CommandNames::IMPORT_CREATE_OK_FILE));
67
        $this->consoleContext->theCommandHasBeenExecuted(sprintf('bin/import-simple %s delete', CommandNames::IMPORT_ATTRIBUTES_SET));
68
    }
69
70
    /**
71
     * @Given the attribute set replacement process has been started
72
     */
73
    public function theAttributeSetReplacementProcessHasBeenStarted()
74
    {
75
        $this->consoleContext->theCommandHasBeenExecuted(sprintf('bin/import-simple %s', CommandNames::IMPORT_CREATE_OK_FILE));
76
        $this->consoleContext->theCommandHasBeenExecuted(sprintf('bin/import-simple %s replace', CommandNames::IMPORT_ATTRIBUTES_SET));
77
    }
78
}
79