Code Duplication    Length = 69-69 lines in 3 locations

features/bootstrap/AttributeFeatureContext.php 1 location

@@ 10-78 (lines=69) @@
7
/**
8
 * Defines application features from the specific context.
9
 */
10
class AttributeFeatureContext implements Context
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 attributes have been imported
32
     */
33
    public function attributesHaveBeenImported()
34
    {
35
        $this->filesWithAttributesToBeUpdatedAreAvailable();
36
        $this->theAttributeImportProcessHasBeenStarted();
37
    }
38
39
    /**
40
     * @Given files with attributes to be updated are available
41
     * @Given files with attributes to be replaced are available
42
     * @Given files with attributes to be deleted are available
43
     */
44
    public function filesWithAttributesToBeUpdatedAreAvailable()
45
    {
46
        $this->consoleContext->aThirdPartySystemHasCopiedTheFileIntoTheImportFolder(
47
            'vendor/techdivision/import-sample-data/generic/data/attributes/add-update/attribute-import_20170428-124902_01.csv',
48
            'var/importexport'
49
        );
50
    }
51
52
    /**
53
     * @Given the attribute(s) import process has been started
54
     */
55
    public function theAttributeImportProcessHasBeenStarted()
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));
59
    }
60
61
    /**
62
     * @Given the attribute(s) deletion process has been started
63
     */
64
    public function theAttributeDeletionProcessHasBeenStarted()
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));
68
    }
69
70
    /**
71
     * @Given the attribute(s) replacement process has been started
72
     */
73
    public function theAttributeReplacementProcessHasBeenStarted()
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));
77
    }
78
}
79

features/bootstrap/AttributeSetFeatureContext.php 1 location

@@ 10-78 (lines=69) @@
7
/**
8
 * Defines application features from the specific context.
9
 */
10
class AttributeSetFeatureContext implements Context
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

features/bootstrap/CategoryFeatureContext.php 1 location

@@ 10-78 (lines=69) @@
7
/**
8
 * Defines application features from the specific context.
9
 */
10
class CategoryFeatureContext implements Context
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 categories have been imported
32
     */
33
    public function categoriesHaveBeenImported()
34
    {
35
        $this->filesWithCategoriesToBeUpdatedAreAvailable();
36
        $this->theCategoryImportProcessHasBeenStarted();
37
    }
38
39
    /**
40
     * @Given files with categories to be updated are available
41
     * @Given files with categories to be deleted are available
42
     * @Given files with categories to be replaced are available
43
     */
44
    public function filesWithCategoriesToBeUpdatedAreAvailable()
45
    {
46
        $this->consoleContext->aThirdPartySystemHasCopiedTheFileIntoTheImportFolder(
47
            'vendor/techdivision/import-sample-data/generic/data/categories/add-update/category-import_20161024-194026_01.csv',
48
            'var/importexport'
49
        );
50
    }
51
52
    /**
53
     * @Given the category import process has been started
54
     */
55
    public function theCategoryImportProcessHasBeenStarted()
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_CATEGORIES));
59
    }
60
61
    /**
62
     * @Given the category deletion process has been started
63
     */
64
    public function theCategoryDeletionProcessHasBeenStarted()
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_CATEGORIES));
68
    }
69
70
    /**
71
     * @Given the category replacement process has been started
72
     */
73
    public function theCategoryReplacementProcessHasBeenStarted()
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_CATEGORIES));
77
    }
78
}
79