Completed
Pull Request — master (#49)
by
unknown
14:56
created

TicketStatisticsCest::_before()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace hipanel\modules\ticket\tests\acceptance\seller;
4
5
use hipanel\helpers\Url;
6
use hipanel\tests\_support\Page\IndexPage;
7
use hipanel\tests\_support\Page\Widget\Input\Input;
8
use hipanel\tests\_support\Page\Widget\Input\Select2;
9
use hipanel\tests\_support\Step\Acceptance\Seller;
10
11
class TicketStatisticsCest
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type hipanel\modules\ticket\t...er\TicketStatisticsCest has been defined more than once; this definition is ignored, only the first definition in tests/acceptance/admin/TicketCreationCest.php (L10-41) is considered.

This check looks for classes that have been defined more than once.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
12
{
13
    /**
14
     * @var IndexPage
15
     */
16
    private $index;
17
18
    public function _before(Seller $I)
19
    {
20
        $this->index = new IndexPage($I);
0 ignored issues
show
Bug introduced by
The property index does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
21
    }
22
23
    public function ensureIndexPageWorks(Seller $I)
24
    {
25
        $I->login();
26
        $I->needPage(Url::to('/ticket/statistic'));
27
        $I->see('Tickets statistics', 'h1');
28
        $I->seeLink('Create ticket', Url::to('@ticket/create'));
29
        $this->ensureICanSeeAdvancedSearchBox($I);
0 ignored issues
show
Bug introduced by
The method ensureICanSeeAdvancedSearchBox() does not seem to exist on object<hipanel\modules\t...r\TicketStatisticsCest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
        $this->ensureICanSeeBulkSearchBox();
0 ignored issues
show
Bug introduced by
The method ensureICanSeeBulkSearchBox() does not seem to exist on object<hipanel\modules\t...r\TicketStatisticsCest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
    }
32
33
    private function ensureICanSeeAdvancedSearchBox(Seller $I)
34
    {
35
        $this->index->containsFilters([
36
            Input::asAdvancedSearch($I, 'Anytext'),
37
            Select2::asAdvancedSearch($I, 'Author'),
38
            Select2::asAdvancedSearch($I, 'Recipient'),
39
            Select2::asAdvancedSearch($I, 'Status'),
40
            Select2::asAdvancedSearch($I, 'Assignee'),
41
            Select2::asAdvancedSearch($I, 'Priority'),
42
            Select2::asAdvancedSearch($I, 'Watchers'),
43
            Select2::asAdvancedSearch($I, 'Topics'),
44
        ]);
45
    }
46
47
    private function ensureICanSeeBulkSearchBox()
48
    {
49
        $this->index->containsColumns([
50
            'Client',
51
            'Spent',
52
            'Tickets',
53
        ]);
54
    }
55
}
56