function test_should_store_files_in_the_database_without_duplicates() { $FileInstance =& new File(); $this->assertFalse($FileInstance->find()); $SourceAnalyzer = new SourceAnalyzer(); $file_count = count($SourceAnalyzer->getSourceFileDetails()); $SourceAnalyzer = new SourceAnalyzer(); $SourceAnalyzer->storeFilesForIndexing(); $this->assertEqual(count($FileInstance->find()), $file_count); $SourceAnalyzer = new SourceAnalyzer(); $SourceAnalyzer->storeFilesForIndexing(); $this->assertEqual(count($FileInstance->find()), $file_count); }
<?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();
<?php # This file is part of the Akelos Framework # (Copyright) 2004-2010 Bermi Ferrer bermi a t bermilabs com # See LICENSE and CREDITS for details $doc_db_file = AK_DOCS_DIR . DS . 'akelos' . DS . 'doc.sqlite'; $installed = file_exists($doc_db_file); $db = Ak::db('sqlite://' . urlencode($doc_db_file) . '/?persist'); AkConfig::rebaseApp(AK_PLUGINS_DIR . DS . 'doc_builder'); if (!$installed) { $DocInstaller = new DocInstaller($db); $DocInstaller->install(); } $SourceAnalyzer = new SourceAnalyzer(); $SourceAnalyzer->db = $db; $SourceAnalyzer->storeFilesForIndexing(AK_ACTION_MAILER_DIR); $SourceAnalyzer->indexFiles(); //unlink($doc_db_file); return; $dir_iterator = new RecursiveDirectoryIterator(AK_ACTION_MAILER_DIR); $iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $file) { if ($file->isFile()) { echo $file, "\n"; $original_file = file_get_contents($file); $Reflection = new AkReflectionFile($file); foreach ($Reflection->getClasses() as $Class) { echo 'class: ' . $Class->getName() . "\n"; $defined_methods = array('public' => array(), 'protected' => array(), 'private' => array()); foreach ($Class->getMethods() as $Method) { $name = $Method->getName();