Permalink
Browse files

added test to ensure overridden methods in reflection cache class are…

… passed to the handle() method
  • Loading branch information...
1 parent e744736 commit 24bfb4abaa2da458fe38bbdc5e9faa9d4cc3d1f2 @rodnaph rodnaph committed Nov 14, 2010
Showing with 15 additions and 1 deletion.
  1. +15 −1 tests/php/BoxUK/Reflect/CachingTest.php
@@ -18,7 +18,7 @@ public function testReflectionCacheDataIsWrittenToCache() {
public function testCachingReflectorOverridesAllMethodsDefinedInTheReflectorClass() {
$ignoredMethodNames = array( 'addIgnoredClassPattern' );
- $methodNames = get_class_methods( 'BoxUK\Reflect\Caching' );
+ $methodNames = get_class_methods( 'BoxUK\Reflect\Reflector' );
$cachingClassName = 'BoxUK\Reflect\Caching';
foreach ( $methodNames as $methodName ) {
$method = new \ReflectionMethod( $cachingClassName, $methodName );
@@ -29,6 +29,20 @@ public function testCachingReflectorOverridesAllMethodsDefinedInTheReflectorClas
}
}
+ public function testCachingReflectorHandlesAllMethodsDefinedInTheReflectorClass() {
+ $cache = $this->getMock( 'BoxUK\Reflect\Cache\Base' );
+ $reflector = $this->getMock( 'BoxUK\Reflect\Caching', array('handle'), array($cache) );
+ $ignoredMethodNames = array( 'addIgnoredClassPattern' );
+ $methodNames = get_class_methods( 'BoxUK\Reflect\Reflector' );
+ $reflector->expects( $this->exactly(count($methodNames) - count($ignoredMethodNames)) )
+ ->method( 'handle' );
+ $cachingClassName = 'BoxUK\Reflect\Caching';
+ foreach ( $methodNames as $methodName ) {
+ $method = new \ReflectionMethod( $cachingClassName, $methodName );
+ $method->invokeArgs( $reflector, array('','','') );
+ }
+ }
+
public function testDataIsReadFromCacheWhenReflectorIsInitialised() {
$cache = $this->getMock( 'BoxUK\Reflect\Cache\Base' );
$cache->expects( $this->once() )

0 comments on commit 24bfb4a

Please sign in to comment.