Code Duplication    Length = 42-42 lines in 2 locations

tests/acceptance/admin/TemplateCest.php 1 location

@@ 11-52 (lines=42) @@
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Admin;
10
11
class TemplateCest
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Admin $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Admin $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@ticket/template'));
27
        $I->see('Answer templates', 'h1');
28
        $I->seeLink('Create template', Url::to('create'));
29
        $this->ensureICanSeeAdvancedSearchBox($I);
30
        $this->ensureICanSeeBulkSearchBox();
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox(Admin $I)
34
    {
35
        $this->index->containsFilters([
36
            Input::asAdvancedSearch($I, 'Name'),
37
            Select2::asAdvancedSearch($I, 'Author'),
38
        ]);
39
    }
40
41
    private function ensureICanSeeBulkSearchBox()
42
    {
43
        $this->index->containsBulkButtons([
44
            'Delete',
45
        ]);
46
        $this->index->containsColumns([
47
            'Author',
48
            'Name',
49
            'Is published',
50
        ]);
51
    }
52
}
53

tests/acceptance/seller/TemplateCest.php 1 location

@@ 11-52 (lines=42) @@
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Seller;
10
11
class TemplateCest
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Seller $I)
19
    {
20
        $this->index = new IndexPage($I);
21
    }
22
23
    public function ensureIndexPageWorks(Seller $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('@ticket/template'));
27
        $I->see('Answer templates', 'h1');
28
        $I->seeLink('Create template', Url::to('create'));
29
        $this->ensureICanSeeAdvancedSearchBox($I);
30
        $this->ensureICanSeeBulkSearchBox();
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox(Seller $I)
34
    {
35
        $this->index->containsFilters([
36
            Input::asAdvancedSearch($I, 'Name'),
37
            Select2::asAdvancedSearch($I, 'Author'),
38
        ]);
39
    }
40
41
    private function ensureICanSeeBulkSearchBox()
42
    {
43
        $this->index->containsBulkButtons([
44
            'Delete',
45
        ]);
46
        $this->index->containsColumns([
47
            'Author',
48
            'Name',
49
            'Is published',
50
        ]);
51
    }
52
}
53