Changeset 884
- Timestamp:
- 08/27/07 12:19:30 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessor.php
r852 r884 301 301 throw new stubException('Invalid amount of parameters passed.'); 302 302 } 303 $binder = new stubBinder(); 304 $binder->bind('stubSession')->toInstance($this->session); 305 $instance = $binder->getInjector()->getInstance($class->getName()); 303 304 $binder = stubRegistry::get('net.stubbles.ioc.stubBinder'); 305 if (($binder instanceof stubBinder) === false) { 306 throw new stubException('No instance of net.stubbles.ioc.stubBinder in registry.'); 307 } 308 309 $instance = $binder->getInjector()->getInstance($class->getName()); 306 310 return $method->invokeArgs($instance, $params); 307 311 } trunk/src/test/php/net/stubbles/service/jsonrpc/stubJsonRpcProcessorTestCase.php
r793 r884 121 121 ) 122 122 ); 123 stubRegistry::set('net.stubbles.ioc.stubBinder', new stubBinder()); 124 } 125 126 /** 127 * clear test environment 128 */ 129 public function tearDown() 130 { 131 stubRegistry::remove('net.stubbles.ioc.stubBinder'); 123 132 } 124 133 … … 235 244 $this->proc->processPostRequest(); 236 245 } 246 247 /** 248 * assure that missing binder triggers an exception 249 */ 250 public function testWithoutBinderInRegistry() 251 { 252 stubRegistry::remove('net.stubbles.ioc.stubBinder'); 253 $this->mockRequest->setReturnValue('getValidatedRawData', '{"method":"Test.add","params":["2","2"],"id":"1"}'); 254 $this->mockResponse->expect('write', array('{"id":"1","result":null,"error":"No instance of net.stubbles.ioc.stubBinder in registry."}')); 255 $this->proc->processPostRequest(); 256 } 237 257 } 238 258 ?>
