Skip to content

Commit

Permalink
Fix type hints to pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pajon committed Dec 2, 2021
1 parent aa3be7b commit 395005f
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion PHPUnit/Extensions/Selenium2TestCase/CommandsHolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ private function checkArguments(array $arguments): void

/**
* @param string $commandName The called method name defined as a key in initCommands()
* @param string|array|null $jsonParameters
*/
protected function newCommand(string $commandName, array $jsonParameters): Command
protected function newCommand(string $commandName, $jsonParameters): Command
{
if (isset($this->commands[$commandName])) {
$factoryMethod = $this->commands[$commandName];
Expand Down
5 changes: 3 additions & 2 deletions PHPUnit/Extensions/Selenium2TestCase/ElementCommand/Rect.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
*/
class Rect extends Command
{
public function __construct(string $parameter, URL $attributeResourceBaseUrl)
/** @param null $parameter */
public function __construct($parameter, URL $attributeResourceBaseUrl)
{
parent::__construct([], $attributeResourceBaseUrl->descend($parameter));
parent::__construct([], $attributeResourceBaseUrl);
}

public function httpMethod(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use PHPUnit\Extensions\Selenium2TestCase\Command;
use PHPUnit\Extensions\Selenium2TestCase\Element;
use PHPUnit\Extensions\Selenium2TestCase\URL;

/**
* Changes the focus to a frame.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace PHPUnit\Extensions\Selenium2TestCase\SessionCommand;

use PHPUnit\Extensions\Selenium2TestCase\URL;

/**
* Gets or posts an attribute from/to the session (title, alert text, etc.)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace PHPUnit\Extensions\Selenium2TestCase\SessionCommand;

use PHPUnit\Extensions\Selenium2TestCase\Command;
use PHPUnit\Extensions\Selenium2TestCase\URL;

/**
* Get the log for a given log type. Log buffer is reset after each request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace PHPUnit\Extensions\Selenium2TestCase\SessionCommand;

use PHPUnit\Extensions\Selenium2TestCase\URL;

/**
* Gets or posts an attribute from/to the session (title, alert text, etc.)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
class Url extends Command
{
public function __construct(?string $url, URL $commandUrl, SeleniumURL $baseUrl)
public function __construct(?string $url, SeleniumURL $commandUrl, SeleniumURL $baseUrl)
{
if ($url !== null) {
$absoluteLocation = $baseUrl->jump($url)->getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace PHPUnit\Extensions\Selenium2TestCase\SessionCommand;

use PHPUnit\Extensions\Selenium2TestCase\Command;
use PHPUnit\Extensions\Selenium2TestCase\URL;

/**
* Changes the focus to a window.
Expand Down
2 changes: 1 addition & 1 deletion PHPUnit/Extensions/Selenium2TestCase/URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __toString()
return $this->getValue();
}

public function descend(string $addition): URL
public function descend(?string $addition): URL
{
if ($addition === '') {
// if we're adding nothing, respect the current url's choice of
Expand Down
7 changes: 0 additions & 7 deletions Tests/Selenium2TestCase/WaitUntilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ public function testWaitUnsuccessfully()
}, 42);
}

public function testInvalidCallback()
{
$this->expectException(\PHPUnit\Extensions\Selenium2TestCase\Exception::class);
$this->expectExceptionMessage('The valid callback is expected');
$this->waitUntil('not a callback');
}

public function testImplicitWaitIsRestoredAfterFailure()
{
$this->url('html/test_wait.html');
Expand Down

0 comments on commit 395005f

Please sign in to comment.