BetterReflectionTest\Reflection\Adapter\ReflectionObjectTest::testAdapterMethods PHP Method

testAdapterMethods() public method

public testAdapterMethods ( string $methodName, string | null $expectedException, mixed $returnValue, array $args )
$methodName string
$expectedException string | null
$returnValue mixed
$args array
    public function testAdapterMethods($methodName, $expectedException, $returnValue, array $args)
    {
        /* @var BetterReflectionObject|\PHPUnit_Framework_MockObject_MockObject $reflectionStub */
        $reflectionStub = $this->createMock(BetterReflectionObject::class);
        if (null === $expectedException) {
            $reflectionStub->expects($this->once())->method($methodName)->with(...$args)->will($this->returnValue($returnValue));
        }
        if (null !== $expectedException) {
            $this->expectException($expectedException);
        }
        $adapter = new ReflectionObjectAdapter($reflectionStub);
        $adapter->{$methodName}(...$args);
    }