Exemplo n.º 1
0
 public function testIncludeFileRepeatedly()
 {
     $dbFileIncludes = new Scisr_Db_FileIncludes($this->getDb());
     $dbFileIncludes->init();
     $dbFileIncludes->registerFileInclude('/x/y/myfile.php', '/x/z/otherfile.php');
     $dbFileIncludes->registerFileInclude('/x/y/myfile.php', '/x/z/otherfile.php');
     $this->assertSame(array('/x/z/otherfile.php'), $dbFileIncludes->getIncludedFiles('/x/y/myfile.php'));
 }
Exemplo n.º 2
0
 public static function createRunner($className = 'ScisrRunner', $db = null)
 {
     if ($db === null) {
         $db_path = dirname(__FILE__) . '/cache.db';
         $db = new PDO("sqlite:{$db_path}", null, null, array(PDO::ATTR_PERSISTENT => true));
     }
     $dbFiles = new Scisr_Db_Files($db);
     $dbFiles->init();
     $dbFileIncludes = new Scisr_Db_FileIncludes($db);
     $dbFileIncludes->init();
     $dbClasses = new Scisr_Db_Classes($db);
     $dbClasses->init();
     $dbVariableTypes = new Scisr_Db_VariableTypes($db);
     $dbVariableTypes->init();
     $variableTypes = new Scisr_Operations_VariableTypes($dbClasses, $dbFileIncludes, $dbVariableTypes);
     $changeRegistry = new Scisr_ChangeRegistry();
     $sniffer = new Scisr_CodeSniffer($dbFiles);
     $operationsFactory = new Scisr_Operations_Factory(array($changeRegistry, $dbFiles, $dbFileIncludes, $dbClasses, $dbVariableTypes, $variableTypes));
     return new $className($changeRegistry, $sniffer, $dbClasses, $operationsFactory);
 }