Completed
Push — master ( 16ddfb...0ea243 )
by Henry
09:18
created

tests/acceptance/LoginTest.php (1 issue)

mismatching argument types.

Documentation Minor

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript\Tests;
3
4
use Facebook\WebDriver\WebDriverBy;
5
use Facebook\WebDriver\WebDriverExpectedCondition;
6
7
/**
8
 * LoginTest
9
 *
10
 * @since 4.0.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 */
16
17
class LoginTest extends TestCaseAbstract
18
{
19
	/**
20
	 * setUp
21
	 *
22
	 * @since 4.0.0
23
	 */
24
25
	public function setUp() : void
26
	{
27
		parent::setUp();
28
		$this->_driver->get('http://localhost:8000/?p=login');
29
	}
30
31
	/**
32
	 * testTitle
33
	 *
34
	 * @since 4.0.0
35
	 */
36
37
	public function testTitle() : void
38
	{
39
		/* expect and actual */
40
41
		$expect = $this->_language->get('login') . ' - ' . $this->_language->get('name', '_package');
42
		$actual = $this->_driver->getTitle();
43
44
		/* compare */
45
46
		$this->assertEquals($expect, $actual);
47
	}
48
49
	/**
50
	 * testLogin
51
	 *
52
	 * @since 4.0.0
53
	 */
54
55
	public function testLogin() : void
56
	{
57
		/* prepare */
58
59
		$formElement = $this->_driver->findElement(WebDriverBy::tagName('form'));
60
		$userElement = $formElement->findElement(WebDriverBy::id('user'));
61
		$passwordElement = $formElement->findElement(WebDriverBy::id('password'));
62
		$buttonElement = $formElement->findElement(WebDriverBy::tagName('button'));
63
64
		/* setup */
65
66
		$userElement->sendKeys('test');
67
		$passwordElement->sendKeys('test');
68
		$buttonElement->click();
69
70
		/* compare */
71
72
		$this->_driver->wait(5)->until(WebDriverExpectedCondition::urlIs('http://localhost:8000/?p=admin'));
0 ignored issues
show
\Facebook\WebDriver\WebD...calhost:8000/?p=admin') 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...
73
		$this->expectNotToPerformAssertions();
74
	}
75
}
76