Changeset 1004
- Timestamp:
- 11/08/07 19:57:51 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ioc/stubClassBinding.php
r863 r1004 105 105 */ 106 106 public function toInstance($instance) { 107 if (!$instance instanceof $this->type) { 108 throw new stubIllegalArgumentException("Instance of {$this->type} expectected, " . get_class($instance) . " given."); 109 } 107 110 $this->instance = $instance; 108 111 return $this; trunk/src/test/php/net/stubbles/ioc/stubInjectorBasicTestCase.php
r854 r1004 172 172 173 173 /** 174 * test setter injections174 * test bindings to an instance 175 175 */ 176 176 public function testSetterInjectionByInstance() … … 198 198 199 199 /** 200 * test bindings to an instance with an invalid type 201 */ 202 public function testSetterInjectionByInvalidInstance() 203 { 204 $tire = new stubInjectorTestCase_Goodyear(); 205 206 $binder = new stubBinder(); 207 $this->expectException('stubIllegalArgumentException'); 208 $binder->bind('stubInjectorTestCase_Vehicle')->toInstance($tire); 209 } 210 211 212 /** 200 213 * test setter injections 201 214 */
