-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
503ae4c
commit 2c47a3e
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
tests/end-to-end/mock-objects/generator/3967-php7-php80.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--TEST-- | ||
https://github.com/sebastianbergmann/phpunit/issues/3967 | ||
--SKIPIF-- | ||
<?php declare(strict_types=1); | ||
if (!(new ReflectionMethod(Exception::class, '__clone'))->isFinal()) { | ||
print 'skip: PHP < 8.1 required'; | ||
} | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
interface Bar extends \Throwable | ||
{ | ||
public function foo(): string; | ||
} | ||
|
||
interface Baz extends Bar | ||
{ | ||
} | ||
|
||
require __DIR__ . '/../../../../vendor/autoload.php'; | ||
|
||
$generator = new \PHPUnit\Framework\MockObject\Generator; | ||
|
||
$mock = $generator->generate( | ||
'Baz', | ||
[], | ||
'MockBaz', | ||
true, | ||
true | ||
); | ||
|
||
print $mock->getClassCode(); | ||
--EXPECT-- | ||
declare(strict_types=1); | ||
|
||
class MockBaz extends Exception implements Baz, PHPUnit\Framework\MockObject\MockObject | ||
{ | ||
use \PHPUnit\Framework\MockObject\Api; | ||
use \PHPUnit\Framework\MockObject\Method; | ||
|
||
public function foo(): string | ||
{ | ||
$__phpunit_arguments = []; | ||
$__phpunit_count = func_num_args(); | ||
|
||
if ($__phpunit_count > 0) { | ||
$__phpunit_arguments_tmp = func_get_args(); | ||
|
||
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { | ||
$__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i]; | ||
} | ||
} | ||
|
||
$__phpunit_result = $this->__phpunit_getInvocationHandler()->invoke( | ||
new \PHPUnit\Framework\MockObject\Invocation( | ||
'Bar', 'foo', $__phpunit_arguments, ': string', $this, true | ||
) | ||
); | ||
|
||
return $__phpunit_result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters