use PHPUnit\Framework\TestCase;
trait Greeting
{
public function hello($name)
{
return 'Hello '.$name;
}
}
class GreetingTest extends TestCase
{
public function testSayHello()
{
$greeting = $this->getMockForTrait(Greeting::class);
$this->assertEquals('Hello Lucas', $greeting->hello('Lucas'));
}
}
Last active
March 14, 2017 01:55
-
-
Save flyingluscas/e2ab418298339bef38d0bad70db528ab to your computer and use it in GitHub Desktop.
PHPUnit: Mocking Trait
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment