Creates a special mock of $type which wraps the given $matcher.
public static argOfTypeThat ( string $type, Hamcrest_Matcher $matcher ) : Object | ||
$type | string | Name of the class to subtype |
$matcher | Hamcrest_Matcher | The matcher to proxy |
return | Object | A special mock of type $type that wraps $matcher, circumventing type issues. |
function argOfTypeThat($type, \Hamcrest_Matcher $matcher) { HamcrestTypeBridge::argOfTypeThat($type, $matcher); }
function testCanBridgeNamespacedClass() { $mockMatcher = new \Hamcrest_Core_IsInstanceOf('\\org\\phockito\\tests\\PhockitoNamespaceTest_MockMe'); $typeBridge = \HamcrestTypeBridge::argOfTypeThat('\\org\\phockito\\tests\\PhockitoNamespaceTest_MockMe', $mockMatcher); $this->assertThat($typeBridge, $this->isInstanceOf('\\org\\phockito\\tests\\PhockitoNamespaceTest_MockMe')); }
/** * @expectedException PHPUnit_Framework_Error * @expectedExceptionCode E_USER_ERROR */ function testCannotBridgeFinalType() { HamcrestTypeBridge::argOfTypeThat('PhockitoHamcrestTypeBridgeTest_MockMe_Final', anArray()); }