/** * Asserts that the Parser finds a class in a file * * The file is created dynamically from the given source. * * @param AutoloaderFileParser $parser This AutoloaderFileParser is tested. * @param String $class This class is expected to be found. * @param String $source This content will be search for the class. * * @return void * @dataProvider provideTestIsClassInSource */ public function testIsClassInFile(AutoloaderFileParser $parser, $class, $source) { $file = $this->_createFile($source); $this->assertTrue($parser->isClassInFile($class, $file), "{$class} not found in {$file}. These classes where found: " . print_r($parser->getClassesInSource($source), true)); $this->assertFalse($parser->isClassInSource($class . uniqid(), $file)); unlink($file); }
/** * Initializes the members with a working configuration * * @see register() * @see buildIndex() * @return void */ private function _initMembers() { $configuration = AutoloaderConfiguration::getInstance(); // set the default index if (empty($this->index)) { $this->setIndex($configuration->getIndex()); } // set the default parser if (empty($this->_parser)) { $this->setParser(AutoloaderFileParser::getInstance()); } // set the timeout for finding a class to max_execution_time if (empty($this->_searchTimeoutSeconds)) { $this->_searchTimeoutSeconds = ini_get('max_execution_time'); } // set the AutoloaderFileIterator if (empty($this->_fileIterator)) { $this->setFileIterator($configuration->getObject(AutoloaderConfiguration::FILE_ITERATOR, array(), 'AutoloaderFileIterator_PriorityList')); } }
/** * Initializes the members with a working configuration * * @see register() * @see buildIndex() * @return void */ private function _initMembers() { // set the default index if (empty($this->index)) { $this->setIndex(new AutoloaderIndex_SerializedHashtable_GZ()); } // set the default parser if (empty($this->_parser)) { $this->setParser(AutoloaderFileParser::getInstance()); } // set the timeout for finding a class to max_execution_time if (empty($this->_searchTimeoutSeconds)) { $this->_searchTimeoutSeconds = ini_get('max_execution_time'); } // set the AutoloaderFileIterator if (empty($this->_fileIterator)) { $this->setFileIterator(new AutoloaderFileIterator_PriorityList()); } }