Skip to content

Instantly share code, notes, and snippets.

@mlively
Forked from benmatselby/PhakeClass.php
Created December 31, 2010 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlively/761133 to your computer and use it in GitHub Desktop.
Save mlively/761133 to your computer and use it in GitHub Desktop.
<?php
class PhakeClass
{
public function __call($method, $args)
{
return '__call';
}
}
<?php
require_once 'Phake.php';
require_once 'PhakeClass.php';
class PhakeClassTest extends PHPUnit_Framework_TestCase
{
public function testMockingOfMagicCallMethod()
{
$expected = 'magicCalled';
$obj = Phake::Mock('PhakeClass');
Phake::when($obj)->magicCall()->thenReturn($expected);
$value = $obj->magicCall();
$this->assertEquals($expected, $value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment