Skip to content

Commit 96b79b0

Browse files
committed
Remove dependencies on codeception/codeception
1 parent 79103a4 commit 96b79b0

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"homepage": "https://codeception.com/",
1515
"require": {
1616
"php": "^8.0",
17+
"ext-mbstring": "*",
1718
"guzzlehttp/psr7": "^2.0",
1819
"symfony/css-selector": ">=4.4.24 <7.0"
1920
},

src/Constraint/Page.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
namespace Codeception\Constraint;
66

7-
use Codeception\Lib\Console\Message;
87
use PHPUnit\Framework\Constraint\Constraint;
98

10-
use function codecept_output_dir;
119
use function mb_stripos;
1210
use function mb_strlen;
1311
use function mb_substr;
@@ -69,25 +67,21 @@ public function toString(): string
6967
protected function failureDescription($pageContent): string
7068
{
7169
$message = $this->uriMessage('on page');
72-
$message->append("\n--> ");
73-
$message->append(mb_substr($pageContent, 0, 300, 'utf-8'));
74-
if (mb_strlen($pageContent, 'utf-8') > 300) {
75-
$debugMessage = new Message(
76-
"[Content too long to display. See complete response in '" . codecept_output_dir() . "' directory]"
77-
);
78-
$message->append("\n")->append($debugMessage);
70+
$message .= "\n--> ";
71+
$message .= mb_substr($pageContent, 0, 300, 'utf-8');
72+
if (mb_strlen($pageContent, 'utf-8') > 300 && function_exists('codecept_output_dir')) {
73+
$message .= "\n[Content too long to display. See complete response in '"
74+
. codecept_output_dir() . "' directory]";
7975
}
80-
$message->append("\n--> ");
81-
return $message->getMessage() . $this->toString();
76+
77+
return $message . "\n--> " . $this->toString();
8278
}
8379

84-
protected function uriMessage(string $onPage = ''): Message
80+
protected function uriMessage(string $onPage = ''): string
8581
{
8682
if (!$this->uri) {
87-
return new Message('');
83+
return '';
8884
}
89-
$message = new Message($this->uri);
90-
$message->prepend(" {$onPage} ");
91-
return $message;
85+
return " {$onPage} {$this->uri}";
9286
}
9387
}

src/Exception/MalformedLocatorException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use function ucfirst;
88

9-
class MalformedLocatorException extends TestRuntimeException
9+
class MalformedLocatorException extends \RuntimeException
1010
{
1111
public function __construct(string $locator, string $type = 'CSS or XPath')
1212
{

0 commit comments

Comments
 (0)