Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHPUnit - broken public method calls in constructor
<?php
use PHPUnit\Framework\TestCase;
class ExceptionTestCase extends TestCase
{
public function testException()
{
$this->expectException(TypeError::class);
$this->expectExceptionMessage('call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object');
$this->getMockBuilder(Foo::class)
->enableProxyingToOriginalMethods()
->getMock();
}
}
class Foo
{
public function __construct()
{
$this->setBar();
}
public function setBar()
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.