Example #1
0
 function test_should_update_components()
 {
     $SourceAnalyzer = new SourceAnalyzer();
     $FileInstance =& new File();
     $this->assertTrue($Files =& $FileInstance->find());
     foreach (array_keys($Files) as $k) {
         $details = $SourceAnalyzer->getFileDetails($Files[$k]->body);
         $this->assertFalse($Files[$k]->has_been_analyzed);
     }
     unset($Files);
     $SourceAnalyzer->indexFiles();
     $this->assertTrue($Files =& $FileInstance->find());
     $SourceAnalyzer = new SourceAnalyzer();
     $ComponentInstance =& new Component();
     foreach (array_keys($Files) as $k) {
         $details = $SourceAnalyzer->getFileDetails($Files[$k]->body);
         $this->assertTrue($Files[$k]->has_been_analyzed);
         $this->assertTrue($Package =& $ComponentInstance->findFirstBy('name', $details['package']));
         $this->assertTrue($Subpackage =& $ComponentInstance->findFirstBy('name', $details['subpackage']));
         if (!empty($Package->parent_id)) {
             $this->assertTrue(in_array($Subpackage->id, $Package->collect($Package->tree->getChildren(), 'id', 'id')));
         }
     }
 }
Example #2
0
<?php

require_once AK_LIB_DIR . DS . 'AkActiveRecord.php';
require_once AK_APP_DIR . DS . 'shared_model.php';
require_once AK_MODELS_DIR . DS . 'source_analyzer.php';
require_once AK_MODELS_DIR . DS . 'source_parser.php';
$SourceAnalyzer = new SourceAnalyzer();
$SourceAnalyzer->storeFilesForIndexing();
$SourceAnalyzer->indexFiles();