Last active
January 6, 2019 11:49
-
-
Save richlloydmiles/1ea6310f4b23b0ff0115795b204fdec8 to your computer and use it in GitHub Desktop.
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; | |
require('./Person.php'); | |
class PersonTest extends TestCase { | |
public function testPersonClassConstructorIsCalledAsExpected() { | |
$mock = $this->getMockBuilder('Person')->disableOriginalConstructor()->getMock(); | |
$mock->expects($this->once())->method('setName')->with($this->equalTo('richard')); | |
$reflectedClass = new ReflectionClass('Person'); | |
$constructor = $reflectedClass->getConstructor(); | |
$constructor->invoke($mock, 'richard', '[email protected]'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment