Skip to content

Commit fcec23a

Browse files
committed
Fix tests incompatible with Codeception 5
1 parent 3a0cb1c commit fcec23a

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

tests/web/TestsForWeb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function testSeeLinkFailsIfHrefDoesNotMatch()
150150
public function testSeeLinkFailsIfHrefDoesNotMatchExactly()
151151
{
152152
$this->expectException('PHPUnit\Framework\AssertionFailedError');
153-
$this->expectExceptionMessage("No links containing text 'Next' and URL 'http://codeception' were found in page /external_url");
153+
$this->expectExceptionMessage("No links containing text 'Next' and URL 'https://codeception' were found in page /external_url");
154154
$this->module->amOnPage('/external_url');
155155
$this->module->seeLink('Next', 'https://codeception');
156156
}

tests/web/WebDriverTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Codeception\Module\WebDriver;
88
use Codeception\Stub;
99
use Codeception\Stub\Expected;
10+
use Codeception\Test\Metadata;
1011
use Codeception\Util\Maybe;
1112
use data;
1213
use Facebook\WebDriver\Cookie;
@@ -581,13 +582,23 @@ public function testCreateCestScreenshotOnFail()
581582
]),
582583
]);
583584
$module = Stub::make(self::MODULE_CLASS, ['webDriver' => $fakeWd]);
584-
$cest = new \Codeception\Test\Cest(new \stdClass(), 'login', 'someCest.php');
585+
$cest = new \Codeception\Test\Cest(
586+
new class { public function login() {}},
587+
'login',
588+
'someCest.php',
589+
);
585590
$module->_failed($cest, new \PHPUnit\Framework\AssertionFailedError());
586591
}
587592

588593
public function testCreateTestScreenshotOnFail()
589594
{
590-
$test = Stub::make(\Codeception\Test\Unit::class, ['getName' => 'testLogin']);
595+
$test = Stub::make(
596+
\Codeception\Test\TestCaseWrapper::class,
597+
[
598+
'getSignature' => 'testLogin',
599+
'getMetadata' => new Metadata(),
600+
]
601+
);
591602
$fakeWd = Stub::make(self::WEBDRIVER_CLASS, [
592603
'takeScreenshot' => Expected::once(function ($filename) use ($test) {
593604
Assert::assertSame(

0 commit comments

Comments
 (0)