CmsGuiCreatePageCest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 25
c 0
b 0
f 0
dl 0
loc 56
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 4 1
A testICanCreateCmsPageWithTranslatedPlaceholders() 0 35 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types = 1);
9
10
namespace PyzTest\Zed\CmsGui\Presentation;
11
12
use Codeception\Scenario;
13
use PyzTest\Zed\CmsGui\CmsGuiPresentationTester;
14
use PyzTest\Zed\CmsGui\PageObject\CmsCreateGlossaryPage;
15
use PyzTest\Zed\CmsGui\PageObject\CmsCreatePage;
16
use PyzTest\Zed\CmsGui\PageObject\CmsEditPage;
17
18
/**
19
 * Auto-generated group annotations
20
 *
21
 * @group PyzTest
22
 * @group Zed
23
 * @group CmsGui
24
 * @group Presentation
25
 * @group CmsGuiCreatePageCest
26
 * Add your own group annotations below this line
27
 */
28
class CmsGuiCreatePageCest
29
{
30
    /**
31
     * @param \PyzTest\Zed\CmsGui\CmsGuiPresentationTester $i
32
     *
33
     * @return void
34
     */
35
    public function _before(CmsGuiPresentationTester $i): void
36
    {
37
        $i->amZed();
38
        $i->amLoggedInUser();
39
    }
40
41
    /**
42
     * @todo Add P&S check after it is available
43
     *
44
     * @param \PyzTest\Zed\CmsGui\CmsGuiPresentationTester $i
45
     * @param \Codeception\Scenario $scenario
46
     *
47
     * @return void
48
     */
49
    public function testICanCreateCmsPageWithTranslatedPlaceholders(CmsGuiPresentationTester $i, Scenario $scenario): void // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
0 ignored issues
show
Unused Code introduced by
The parameter $scenario is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

49
    public function testICanCreateCmsPageWithTranslatedPlaceholders(CmsGuiPresentationTester $i, /** @scrutinizer ignore-unused */ Scenario $scenario): void // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        $i->wantTo('Create cms page with multiple translations');
52
        $i->expect('Page is persisted in Zed, exported to Yves and is accessible.');
53
54
        $i->amLoggedInUser();
55
        $i->amOnPage(CmsCreatePage::URL);
56
        $i->selectOption('//*[@id="cms_page_fkTemplate"]', 'Placeholders Title & Content');
57
        $i->setValidFrom('1985-07-01');
58
        $i->setValidTo('2030-07-01');
59
        $i->setIsSearchable();
60
61
        $i->fillLocalizedUrlForm(0, $i->getLocalizedName('en'), $i->getLocalizedUrl('en'));
62
        $i->fillLocalizedUrlForm(1, $i->getLocalizedName('de'), $i->getLocalizedUrl('de'));
63
        $i->clickSubmit();
64
65
        $i->see(CmsCreatePage::PAGE_CREATED_SUCCESS_MESSAGE);
66
67
        $i->includeJquery();
68
69
        $i->fillPlaceholderContents(0, 0, CmsCreateGlossaryPage::getLocalizedPlaceholderData('title', 'en'));
70
        $i->fillPlaceholderContents(0, 1, CmsCreateGlossaryPage::getLocalizedPlaceholderData('title', 'de'));
71
72
        $i->fillPlaceholderContents(1, 0, CmsCreateGlossaryPage::getLocalizedPlaceholderData('contents', 'en'));
73
        $i->fillPlaceholderContents(1, 1, CmsCreateGlossaryPage::getLocalizedPlaceholderData('contents', 'de'));
74
75
        $i->clickSubmit();
76
77
        $idCmsPage = $i->grabCmsPageId();
78
79
        $i->amOnPage(sprintf(CmsEditPage::URL, $idCmsPage));
80
81
        $i->clickPublishButton();
82
83
        $i->see(CmsEditPage::PAGE_PUBLISH_SUCCESS_MESSAGE);
84
    }
85
}
86