/
4139-php7.phpt
51 lines (42 loc) · 1.46 KB
/
4139-php7.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/4139
--SKIPIF--
<?php declare(strict_types=1);
if (PHP_MAJOR_VERSION >= 8) {
print 'skip: PHP 7 is required.';
}
--FILE--
<?php declare(strict_types=1);
interface InterfaceWithConstructor
{
public function __construct();
}
require_once __DIR__ . '/../../../bootstrap.php';
$generator = new \PHPUnit\Framework\MockObject\Generator;
$mock = $generator->generate(InterfaceWithConstructor::class);
print $mock->getClassCode();
--EXPECTF--
declare(strict_types=1);
class %s implements PHPUnit\Framework\MockObject\MockObject, InterfaceWithConstructor
{
use \PHPUnit\Framework\MockObject\Api;
use \PHPUnit\Framework\MockObject\Method;
use \PHPUnit\Framework\MockObject\MockedCloneMethodWithoutReturnType;
public function __construct()
{
$__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(
'InterfaceWithConstructor', '__construct', $__phpunit_arguments, '', $this, true
)
);
return $__phpunit_result;
}
}