Skip to content

Commit fff51e5

Browse files
authored
Merge pull request #109 from Codeception/fix-tests
Fix tests incompatible with Codeception 5
2 parents 3a0cb1c + f3b2d4b commit fff51e5

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-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: 17 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,27 @@ 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 {
587+
public function login()
588+
{
589+
}
590+
},
591+
'login',
592+
'someCest.php',
593+
);
585594
$module->_failed($cest, new \PHPUnit\Framework\AssertionFailedError());
586595
}
587596

588597
public function testCreateTestScreenshotOnFail()
589598
{
590-
$test = Stub::make(\Codeception\Test\Unit::class, ['getName' => 'testLogin']);
599+
$test = Stub::make(
600+
\Codeception\Test\TestCaseWrapper::class,
601+
[
602+
'getSignature' => 'testLogin',
603+
'getMetadata' => new Metadata(),
604+
]
605+
);
591606
$fakeWd = Stub::make(self::WEBDRIVER_CLASS, [
592607
'takeScreenshot' => Expected::once(function ($filename) use ($test) {
593608
Assert::assertSame(

0 commit comments

Comments
 (0)