Skip to content

Commit 3f1d69b

Browse files
Merge pull request #18 from whisller/feature/abstract-bug
Handle situation when `expect` is executed inside of abstract class.
2 parents 6fbdc35 + 5cd35c5 commit 3f1d69b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

expect.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,8 @@ function expect($sus)
5252
$matchers->add(new StringRegexMatcher($presenter));
5353

5454
$trace = debug_backtrace();
55-
if (isset($trace[1]['class'])) {
56-
57-
$class = $trace[1]['class'];
58-
$serialized = sprintf('O:%u:"%s":0:{}', strlen($class), $class);
59-
$object = unserialize($serialized);
55+
if (isset($trace[1]['object'])) {
56+
$object = $trace[1]['object'];
6057

6158
if ($object instanceof MatchersProviderInterface) {
6259
foreach ($object->getMatchers() as $name => $matcher) {

0 commit comments

Comments
 (0)