Changeset 808
- Timestamp:
- 08/13/07 21:05:39 (1 year ago)
- Files:
-
- trunk/experiments/people/schst (added)
- trunk/experiments/people/schst/ioc (added)
- trunk/experiments/people/schst/ioc/simple.php (added)
- trunk/src/main/php/net/stubbles/ioc/injection/annotations (added)
- trunk/src/main/php/net/stubbles/ioc/injection/annotations/stubInjectAnnotation.php (added)
- trunk/src/main/php/net/stubbles/ioc/injection/injection.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/ioc/injection/stubBinder.php (added)
- trunk/src/main/php/net/stubbles/ioc/injection/stubBinding.php (added)
- trunk/src/main/php/net/stubbles/ioc/injection/stubInjectAnnotation.php (deleted)
- trunk/src/main/php/net/stubbles/ioc/injection/stubInjector.php (added)
- trunk/src/main/php/net/stubbles/stubClassLoader.php (modified) (8 diffs)
- trunk/src/test/php/net/stubbles/ioc/injection/stubInjectAnnotationTestCase.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ioc/injection/injection.php
r314 r808 2 2 /** 3 3 * Injection handling bootstrap file. 4 * 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> 6 6 * @package stubbles … … 10 10 'net.stubbles.ioc.injection.stubInjectionProvider', 11 11 'net.stubbles.ioc.injection.stubInjectionMap', 12 'net.stubbles.ioc.injection. stubInjectAnnotation'12 'net.stubbles.ioc.injection.annotations.stubInjectAnnotation' 13 13 ); 14 14 ?> trunk/src/main/php/net/stubbles/stubClassLoader.php
r777 r808 159 159 self::$useStar = false; 160 160 } 161 161 162 162 self::$sourcePath = stubConfig::getSourcePath() . DIRECTORY_SEPARATOR . 'php' . DIRECTORY_SEPARATOR; 163 163 } … … 188 188 self::init(); 189 189 } 190 190 191 191 foreach ($classNames as $fqClassName) { 192 192 $nqClassName = self::getNonQualifiedClassName($fqClassName); … … 210 210 } 211 211 212 if (( include $uri) == false) {212 if ((@include $uri) == false) { 213 213 throw new stubClassNotFoundException($fqClassName); 214 214 } … … 232 232 self::init(); 233 233 } 234 234 235 235 $dirName = self::$sourcePath . str_replace('.', DIRECTORY_SEPARATOR, $packageName); 236 236 if (file_exists($dirName) == false) { 237 237 return array(); 238 238 } 239 239 240 240 if (false === $recursive) { 241 241 $dirIt = new DirectoryIterator($dirName); … … 243 243 $dirIt = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirName)); 244 244 } 245 245 246 246 $classes = array(); 247 247 foreach ($dirIt as $file) { … … 249 249 continue; 250 250 } 251 251 252 252 $classes[] = str_replace(DIRECTORY_SEPARATOR, '.', str_replace('.php', '', str_replace(self::$sourcePath, '', $file->getPathname()))); 253 253 } 254 254 255 255 if (true === self::$useStar) { 256 256 $starClasses = StarClassRegistry::getClasses(); … … 259 259 continue; 260 260 } 261 261 262 262 $nqClassName = self::getNonQualifiedClassName($fqClassName); 263 263 if (str_replace($nqClassName, '', $fqClassName) != $packageName && false === $recursive) { 264 264 continue; 265 265 } 266 266 267 267 $classes[] = $fqClassName; 268 268 } 269 269 } 270 270 271 271 sort($classes); 272 272 return $classes; … … 336 336 } 337 337 } 338 338 339 339 return null; 340 340 } trunk/src/test/php/net/stubbles/ioc/injection/stubInjectAnnotationTestCase.php
r353 r808 1 1 <?php 2 2 /** 3 * Test for net.stubbles.ioc.injection. stubInjectAnnotation3 * Test for net.stubbles.ioc.injection.annotations.stubInjectAnnotation 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 7 7 * @subpackage ioc_injection_test 8 8 */ 9 stubClassLoader::load('net.stubbles.ioc.injection. stubInjectAnnotation');9 stubClassLoader::load('net.stubbles.ioc.injection.annotations.stubInjectAnnotation'); 10 10 class TestInjection1 extends stubBaseObject {} 11 11 class TestInjection2 extends stubBaseObject {} … … 14 14 /** 15 15 * class for testing injections 16 * 16 * 17 17 * @Inject(TestInjection1:TestInjection2:TestInjection3) 18 18 */ … … 21 21 protected $TestInjection1; 22 22 public $TestInjection2; 23 23 24 24 public function setTestInjection1($i) 25 25 { 26 26 $this->TestInjection1 = $i; 27 27 } 28 28 29 29 public function getTestInjection1() 30 30 { 31 31 return $this->TestInjection1; 32 32 } 33 33 34 34 public function __set($name, $value) 35 35 { … … 39 39 /** 40 40 * class for testing injections 41 * 41 * 42 42 * @Inject(TestInjection1:TestInjection2:TestInjection3) 43 43 */ … … 54 54 protected $TestInjection4; 55 55 public $TestInjection5; 56 56 57 57 public function setTestInjection4($i) 58 58 { 59 59 $this->TestInjection4 = $i; 60 60 } 61 61 62 62 public function getTestInjection4() 63 63 { … … 66 66 } 67 67 /** 68 * Test for net.stubbles.ioc.injection. stubInjectAnnotation68 * Test for net.stubbles.ioc.injection.annotations.stubInjectAnnotation 69 69 * 70 70 * @package stubbles … … 79 79 */ 80 80 protected $injectionMap; 81 81 82 82 /** 83 83 * set up test environment … … 101 101 $this->assertEqual($inject->getInjections(), array('TestInjection1', 'TestInjection2', 'TestInjection3')); 102 102 } 103 103 104 104 /** 105 105 * check that the handling works as expected … … 113 113 $this->assertReference($test1a, $test1b); 114 114 } 115 115 116 116 /** 117 117 * check that the handling works as expected … … 123 123 stubInjectAnnotation::factory(new stubInjectionMap(), $testInjectible); 124 124 } 125 125 126 126 /** 127 127 * check that the handling works as expected … … 133 133 stubInjectAnnotation::factory($this->injectionMap, $testInjectible); 134 134 } 135 135 136 136 /** 137 137 * check that the handling works as expected … … 145 145 stubInjectAnnotation::factory($this->injectionMap, $testInjectible); 146 146 } 147 147 148 148 /** 149 149 * check that the handling works as expected … … 154 154 stubInjectAnnotation::factory($this->injectionMap, 'foo'); 155 155 } 156 156 157 157 public function testStubPrefix() 158 158 {
