liangzai-cool / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

PHP: Need matcher to check for built-in types #115

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
anInstanceOf() doesn't work because you cannot call get_class() on an array. I 
need typeOf() which would use gettype() instead. PHPUnit has an IsType 
constraint for an example, though all the named constants aren't really 
necessary.

    assertThat($anArray, typeOf('array'));

Original issue reported on code.google.com by emperorf...@gmail.com on 2 Jul 2010 at 10:11

GoogleCodeExporter commented 9 years ago
Added Hamcrest_Core_IsTypeOf() and typeOf($type).

    assertThat($array, typeOf('array'));

It ignores case when performing the assertion but does not validate against a 
set of known built-in types.

Original comment by dharkn...@gmail.com on 12 Jul 2010 at 6:44