Completed
Push — master ( ce58c6...c67fb3 )
by Henry
09:17
created

RecoverTest::testTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Redaxscript\Tests;
3
4
use Facebook\WebDriver\WebDriverBy;
5
use Facebook\WebDriver\WebDriverExpectedCondition;
6
7
/**
8
 * RecoverTest
9
 *
10
 * @since 4.2.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 */
16
17
class RecoverTest extends TestCaseAbstract
18
{
19
	/**
20
	 * setUp
21
	 *
22
	 * @since 4.2.0
23
	 */
24
25
	public function setUp() : void
26
	{
27
		parent::setUp();
28
		$this->_driver->get('http://localhost:8000/?p=login/recover');
29
	}
30
31
	/**
32
	 * testTitle
33
	 *
34
	 * @since 4.2.0
35
	 */
36
37
	public function testTitle() : void
38
	{
39
		/* expect and actual */
40
41
		$expect = $this->_language->get('recovery') . ' - ' . $this->_language->get('_package')['name'];
42
		$actual = $this->_driver->getTitle();
43
44
		/* compare */
45
46
		$this->assertEquals($expect, $actual);
47
	}
48
49
	/**
50
	 * testRecover
51
	 *
52
	 * @since 4.2.0
53
	 */
54
55
	public function testRecover() : void
56
	{
57
		/* setup */
58
59
		$formElement = $this->_driver->findElement(WebDriverBy::tagName('form'));
60
		$emailElement = $formElement->findElement(WebDriverBy::id('email'));
61
		$buttonElement = $formElement->findElement(WebDriverBy::tagName('button'));
62
63
		/* interact */
64
65
		$emailElement->sendKeys('[email protected]');
66
		$buttonElement->click();
67
68
		/* compare */
69
70
		$this->_driver->wait(5)->until(WebDriverExpectedCondition::urlIs('http://localhost:8000/?p=login'));
0 ignored issues
show
Documentation introduced by redaxmedia
\Facebook\WebDriver\WebD...calhost:8000/?p=login') is of type object<Facebook\WebDrive...riverExpectedCondition>, but the function expects a callable.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
71
		$this->expectNotToPerformAssertions();
72
	}
73
}
74