Created
September 25, 2019 10:13
-
-
Save jurchiks/fd690dee6f7215a2eab1d90712463950 to your computer and use it in GitHub Desktop.
PHPUnit - broken public method calls in constructor
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
<?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