1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace hipanel\modules\ticket\tests\_support\Page\ticket; |
4
|
|
|
|
5
|
|
|
use hipanel\tests\_support\Page\Authenticated; |
6
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Input; |
7
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Select2; |
8
|
|
|
use yii\helpers\Url; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class Create |
12
|
|
|
* |
13
|
|
|
* @author Dmytro Naumenko <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class Create extends Authenticated |
16
|
|
|
{ |
17
|
|
|
public function createTicket($subject, $message, $topic) |
18
|
|
|
{ |
19
|
|
|
$I = $this->tester; |
20
|
|
|
|
21
|
|
|
$I->amOnPage(Url::to(['@ticket/create'])); |
22
|
|
|
|
23
|
|
|
(new Select2($I, '#thread-topics'))->setValue($topic); |
|
|
|
|
24
|
|
|
|
25
|
|
|
(new Input($I, '#thread-subject'))->setValue($subject); |
|
|
|
|
26
|
|
|
(new Input($I, '#thread-message'))->setValue($message); |
|
|
|
|
27
|
|
|
|
28
|
|
|
$this->seePreviewWorks($message); |
29
|
|
|
|
30
|
|
|
$I->click('Create ticket', '#create-thread-form'); |
31
|
|
|
$this->seeTicketWasCreated($message, $topic); |
32
|
|
|
|
33
|
|
|
return $I->grabValueFrom(View::THREAD_ID_SELECTOR); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
protected function seePreviewWorks($message) |
37
|
|
|
{ |
38
|
|
|
$I = $this->tester; |
39
|
|
|
|
40
|
|
|
$I->click('a[href="#preview-create-thread-form"]'); |
41
|
|
|
$I->waitForText($message, 30, '#preview-create-thread-form'); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
protected function seeTicketWasCreated($message, $topic) |
45
|
|
|
{ |
46
|
|
|
$I = $this->tester; |
47
|
|
|
|
48
|
|
|
$I->waitForText('Ticket posted', 30); |
49
|
|
|
$I->seeInCurrentUrl('/ticket/view?id='); |
50
|
|
|
$I->see($topic); |
51
|
|
|
$I->see('Close ticket', 'a'); |
52
|
|
|
$I->see($message); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: