public function testBuildClassInfosBasedOnPaths() { $annotationReader = new AnnotationReader(); $annotationManager = new AnnotationManager($annotationReader); $classInfos = $annotationManager->buildClassInfosBasedOnPaths(array(dirname(__DIR__) . '/Classes1', dirname(__DIR__) . '/Classes2')); $this->assertCount(3, $classInfos); $this->assertInstanceOf('Saxulum\\AnnotationManager\\Helper\\ClassInfo', $classInfos[0]); $this->assertInstanceOf('Saxulum\\AnnotationManager\\Helper\\ClassInfo', $classInfos[1]); $this->assertInstanceOf('Saxulum\\AnnotationManager\\Helper\\ClassInfo', $classInfos[2]); $this->checkTestClass1($classInfos[0]); $this->checkTestClass2($classInfos[1]); $this->checkTestClass3($classInfos[2]); }
/** * @param AnnotationManager $annotationManager * @param ServiceManager $serviceManager * @param RouteManager $routeManager * @param Standard $prettyPrinter */ public function updateCache(AnnotationManager $annotationManager, ServiceManager $serviceManager, RouteManager $routeManager, Standard $prettyPrinter) { $classInfos = $annotationManager->buildClassInfosBasedOnPaths($this->paths); $code = "<?php\n\n"; foreach ($classInfos as $classInfo) { $code .= $prettyPrinter->prettyPrint($serviceManager->generateCode($classInfo)); $code .= "\n\n"; } foreach ($classInfos as $classInfo) { $code .= $prettyPrinter->prettyPrint($routeManager->generateCode($classInfo)); $code .= "\n\n"; } file_put_contents($this->cacheFile, $code); }