Skip to content

Commit d5a20ab

Browse files
committed
Fix testMarkTestSkipped compatibility
1 parent a499352 commit d5a20ab

File tree

20 files changed

+52
-35
lines changed

20 files changed

+52
-35
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
php: [8.1, 8.2, 8.3, 8.4]
11+
php: [8.2, 8.3, 8.4]
1212

1313
steps:
1414
- name: Checkout code

codeception.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
namespace: Tests
2+
support_namespace: Support
3+
4+
settings:
5+
shuffle: true
6+
lint: true
17
paths:
28
tests: tests
39
output: tests/_output
4-
data: tests/_data
5-
support: tests/_support
6-
envs: tests/_envs
7-
actor_suffix: Tester
10+
support: tests/Support
11+
data: tests/Support/Data
12+

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
],
2323
"homepage": "https://codeception.com/",
2424
"require": {
25-
"php": "^8.1",
25+
"php": "^8.2",
2626
"codeception/codeception": "*@dev",
2727
"codeception/lib-asserts": "^2.2"
2828
},

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A Codeception module containing various assertions.
99

1010
## Requirements
1111

12-
* `PHP 8.1` or higher.
12+
* `PHP 8.2` or higher.
1313

1414
## Installation
1515

src/Codeception/Module/Asserts.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace Codeception\Module;
66

7+
use Throwable;
8+
use function get_debug_type;
9+
710
/**
811
* Special module for using asserts in your tests.
912
*/
@@ -31,10 +34,8 @@ class Asserts extends AbstractAsserts
3134
* $this->doSomethingBad();
3235
* });
3336
* ```
34-
*
35-
* @param \Throwable|string $throwable
3637
*/
37-
public function expectThrowable($throwable, callable $callback): void
38+
public function expectThrowable(string|Throwable $throwable, callable $callback): void
3839
{
3940
if (is_object($throwable)) {
4041
$class = get_class($throwable);
@@ -48,7 +49,7 @@ public function expectThrowable($throwable, callable $callback): void
4849

4950
try {
5051
$callback();
51-
} catch (\Throwable $t) {
52+
} catch (Throwable $t) {
5253
$this->checkThrowable($t, $class, $msg, $code);
5354
return;
5455
}
@@ -60,13 +61,13 @@ public function expectThrowable($throwable, callable $callback): void
6061
* Check if the given throwable matches the expected data,
6162
* fail (throws an exception) if it does not.
6263
*/
63-
protected function checkThrowable(\Throwable $throwable, string $expectedClass, ?string $expectedMsg, $expectedCode = null): void
64+
protected function checkThrowable(Throwable $throwable, string $expectedClass, ?string $expectedMsg, int|null $expectedCode = null): void
6465
{
6566
if (!($throwable instanceof $expectedClass)) {
6667
$this->fail(sprintf(
6768
"Exception of class '%s' expected to be thrown, but class '%s' was caught",
6869
$expectedClass,
69-
get_class($throwable)
70+
get_debug_type($throwable)
7071
));
7172
}
7273

tests/_data/DummyClass.php renamed to tests/Support/Data/DummyClass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
declare(strict_types=1);
44

5+
namespace Support\Data;
6+
57
class DummyClass
68
{
79
private int $foo;
8-
10+
911
private static int $staticFoo;
1012
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)