当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassInfo::classes_for_folder方法代码示例

本文整理汇总了PHP中ClassInfo::classes_for_folder方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassInfo::classes_for_folder方法的具体用法?PHP ClassInfo::classes_for_folder怎么用?PHP ClassInfo::classes_for_folder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClassInfo的用法示例。


在下文中一共展示了ClassInfo::classes_for_folder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testClassesForFolder

 public function testClassesForFolder()
 {
     //$baseFolder = Director::baseFolder() . '/' . FRAMEWORK_DIR . '/tests/_ClassInfoTest';
     //$manifestInfo = ManifestBuilder::get_manifest_info($baseFolder);
     $classes = ClassInfo::classes_for_folder(FRAMEWORK_DIR . '/tests');
     $this->assertContains('classinfotest', $classes, 'ClassInfo::classes_for_folder() returns classes matching the filename');
     $this->assertContains('classinfotest_baseclass', $classes, 'ClassInfo::classes_for_folder() returns additional classes not matching the filename');
 }
开发者ID:miamollie,项目名称:echoAerial,代码行数:8,代码来源:ClassInfoTest.php

示例2: testClassesForFolder

 function testClassesForFolder()
 {
     //$baseFolder = Director::baseFolder() . '/' . SAPPHIRE_DIR . '/tests/_ClassInfoTest';
     //$manifestInfo = ManifestBuilder::get_manifest_info($baseFolder);
     $classes = ClassInfo::classes_for_folder('sapphire/tests');
     $this->assertContains('classinfotest', $classes, 'ClassInfo::classes_for_folder() returns classes matching the filename');
     // $this->assertContains(
     // 			'ClassInfoTest_BaseClass',
     // 			$classes,
     // 			'ClassInfo::classes_for_folder() returns additional classes not matching the filename'
     // 		);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:12,代码来源:ClassInfoTest.php

示例3: get_module_tests

 /**
  * Run tests for one or more "modules".
  * A module is generally a toplevel folder, e.g. "mysite" or "sapphire".
  * 
  * @param String $nameStr
  * @return Array
  */
 protected static function get_module_tests($namesStr)
 {
     $tests = array();
     $names = explode(',', $namesStr);
     foreach ($names as $name) {
         $classesForModule = ClassInfo::classes_for_folder($name);
         if ($classesForModule) {
             foreach ($classesForModule as $class) {
                 if (class_exists($class) && is_subclass_of($class, 'SapphireTest')) {
                     $tests[] = $class;
                 }
             }
         }
     }
     return $tests;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:23,代码来源:FullTestSuite.php

示例4: get_module_tests

	/**
	 * Run tests for one or more "modules".
	 * A module is generally a toplevel folder, e.g. "mysite" or "framework".
	 * 
	 * @param String $nameStr
	 * @return Array
	 */
	protected static function get_module_tests($namesStr) {
		require_once(dirname(__FILE__) . '/bootstrap.php');
		
		$tests = array();
		$names = explode(',', $namesStr);
		foreach($names as $name) {
			$classesForModule = ClassInfo::classes_for_folder($name);
			if($classesForModule) foreach($classesForModule as $class) {
				if(class_exists($class) && is_subclass_of($class, 'SapphireTest')) {
					$tests[] = $class;
				}
			}
		}

		return $tests;
	}
开发者ID:redema,项目名称:sapphire,代码行数:23,代码来源:FullTestSuite.php

示例5: module

 /**
  * Run tests for one or more "modules".
  * A module is generally a toplevel folder, e.g. "mysite" or "sapphire".
  */
 function module($request, $coverage = false)
 {
     ManifestBuilder::load_test_manifest();
     $classNames = array();
     $moduleNames = explode(',', $request->param('ModuleName'));
     foreach ($moduleNames as $moduleName) {
         $classesForModule = ClassInfo::classes_for_folder($moduleName);
         if ($classesForModule) {
             foreach ($classesForModule as $class) {
                 if (class_exists($class) && is_subclass_of($class, 'SapphireTest')) {
                     $classNames[] = $class;
                 }
             }
         }
     }
     $this->runTests($classNames, $coverage);
 }
开发者ID:Raiser,项目名称:Praktikum,代码行数:21,代码来源:TestRunner.php

示例6: getTestsInDirectory

 /**
  * Find all test classes in a directory and return an array of them.
  * @param string $directory To search in
  * @param array $ignore Ignore these test classes if they are found.
  * @return array
  */
 protected function getTestsInDirectory($directory, $ignore = array())
 {
     $classes = ClassInfo::classes_for_folder($directory);
     return $this->filterTestClasses($classes, $ignore);
 }
开发者ID:javabrett,项目名称:silverstripe-framework,代码行数:11,代码来源:TestRunner.php

示例7: module

 /**
  * Run tests for one or more "modules".
  * A module is generally a toplevel folder, e.g. "mysite" or "framework".
  */
 public function module($request, $coverage = false)
 {
     self::use_test_manifest();
     $classNames = array();
     $moduleNames = explode(',', $request->param('ModuleName'));
     $ignored = array('functionaltest', 'phpsyntaxtest');
     foreach ($moduleNames as $moduleName) {
         $classesForModule = ClassInfo::classes_for_folder($moduleName);
         if ($classesForModule) {
             foreach ($classesForModule as $className) {
                 if (class_exists($className) && is_subclass_of($className, 'SapphireTest')) {
                     if (!in_array($className, $ignored)) {
                         $classNames[] = $className;
                     }
                 }
             }
         }
     }
     $this->runTests($classNames, $coverage);
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:24,代码来源:TestRunner.php

示例8: AllEcommerceClasses

 /**
  * extracts other E-commerce Classes
  * @todo: retrieve description
  */
 protected function AllEcommerceClasses()
 {
     $otherClasses = ClassInfo::classes_for_folder("ecommerce");
     foreach ($otherClasses as $otherClass) {
         $this->definitions["AllEcommerceClasses"][$otherClass] = "";
         $this->defaults["AllEcommerceClasses"][$otherClass] = "";
         $this->configs["AllEcommerceClasses"][$otherClass] = "<a href=\"/dev/viewcode/" . $otherClass . "\" target=\"_blank\">view</a>";
     }
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:13,代码来源:EcommerceCheckConfiguration.php

示例9: module

 /**
  * Run tests for one or more "modules".
  * A module is generally a toplevel folder, e.g. "mysite" or "framework".
  * 
  * @OVERRIDE
  * 
  * Over-ridden to allow selection of specific test type if specified on the command line
  * 
  */
 public function module($request, $coverage = false)
 {
     self::use_test_manifest();
     $classNames = array();
     $moduleNames = explode(',', $request->param('ModuleName'));
     $testClassParent = $request->getVar('test_type');
     if (!$testClassParent) {
         $testClassParent = 'SapphireTest';
     }
     $ignored = array('functionaltest', 'phpsyntaxtest');
     foreach ($moduleNames as $moduleName) {
         $classesForModule = ClassInfo::classes_for_folder($moduleName);
         $this->moduleList[] = Director::baseFolder() . DIRECTORY_SEPARATOR . $moduleName;
         if ($classesForModule) {
             foreach ($classesForModule as $className) {
                 if (class_exists($className) && is_subclass_of($className, $testClassParent)) {
                     if (!in_array($className, $ignored)) {
                         $classNames[] = $className;
                     }
                 }
             }
         }
     }
     $this->runTests($classNames, $coverage);
 }
开发者ID:silverstripe-australia,项目名称:ssautesting,代码行数:34,代码来源:ParameterisedTestRunner.php

示例10: dot

 /**
  * Generates a GraphViz dot template
  *
  * @return String a dot compatible data format
  */
 public function dot()
 {
     $opt = array();
     $opt['location'] = $this->paramDefault('location', 'mysite');
     $opt['ancestry'] = $this->paramDefault('ancestry', 1, 'numeric');
     $opt['relations'] = $this->paramDefault('relations', 1, 'numeric');
     $opt['fields'] = $this->paramDefault('fields', 1, 'numeric');
     $opt['include_root'] = $this->paramDefault('include-root', 0, 'numeric');
     $opt['exclude'] = $this->paramDefault('exclude');
     $opt['group'] = $this->paramDefault('group', 0, 'numeric');
     $opt['rankdir'] = $this->paramDefault('rankdir');
     if (!in_array($opt['rankdir'], array('LR', 'TB', 'BT', 'RL'))) {
         $opt['rankdir'] = 'TB';
     }
     $renderClasses = array();
     //Get all DataObject subclasses
     $dataClasses = ClassInfo::subclassesFor('DataObject');
     //Remove DataObject itself
     array_shift($dataClasses);
     //Get all classes in a specific folder(s)
     $folders = explode(",", $opt['location']);
     $folderClasses = array();
     foreach ($folders as $folder) {
         if (!empty($folder)) {
             $folderClasses[$folder] = ClassInfo::classes_for_folder($folder);
         }
     }
     $excludeArray = explode(",", $opt['exclude']);
     //Get the intersection of the two - grouped by the folder
     foreach ($dataClasses as $key => $dataClass) {
         foreach ($folderClasses as $folder => $classList) {
             foreach ($classList as $folderClass) {
                 if (strtolower($dataClass) == strtolower($folderClass)) {
                     //Remove all excluded classes
                     if (!in_array($dataClass, $excludeArray)) {
                         $renderClasses[$folder][$dataClass] = $dataClass;
                     }
                 }
             }
         }
     }
     if (count($renderClasses) == 0) {
         user_error("No classes that extend DataObject found in location: " . Convert::raw2xml($opt['location']));
     }
     $folders = new ArrayList();
     foreach ($renderClasses as $folderName => $classList) {
         $folder = new DataObject();
         $folder->Name = $folderName;
         $folder->Group = $opt['group'] == 1;
         $classes = new ArrayList();
         foreach ($classList as $className) {
             //Create a singleton of the class, to use for has_one,etc  instance methods
             $singleton = singleton($className);
             //Create a blank DO to use for rendering on the template
             $class = new DataObject();
             $class->ClassName = $className;
             //Get all the data fields for the class
             //fields = 0 - No fields
             //fields = 1 - only uninherited fields
             //fields = 2 - inherited fields
             $fields = new ArrayList();
             if ($opt['fields'] > 0) {
                 if ($opt['fields'] > 1) {
                     $dataFields = $singleton->inheritedDatabaseFields();
                 } else {
                     $dataFields = DataObject::custom_database_fields($className);
                 }
                 $fields = self::formatDataFields($dataFields, $fields);
             }
             $class->FieldList = $fields;
             if ($opt['relations'] > 1) {
                 $config = Config::INHERITED;
             } else {
                 $config = Config::UNINHERITED;
             }
             $hasOneArray = Config::inst()->get($className, 'has_one', $config);
             $hasManyArray = Config::inst()->get($className, 'has_many', $config);
             $manyManyArray = Config::inst()->get($className, 'many_many', $config);
             //TODO - what's the difference between:
             /*
             $hasOneArray = Config::inst()->get($className, 'has_one');
             $hasManyArray = Config::inst()->get($className, 'has_many');
             $manyManyArray = Config::inst()->get($className, 'many_many');
             
             //and
             
             $hasOneArray = $singleton->has_one();
             $hasManyArray = $singleton->has_many();
             $manyManyArray = $singleton->many_many();
             //Note - has_() calls are verbose - they retrieve relations all the way down to base class
             // ?? eg; for SiteTree, BackLinkTracking is a belongs_many_many
             */
             //$belongsToArray = $singleton->belongs_to();
             //print_r(ClassInfo::ancestry($className));
             //print_r($singleton->getClassAncestry());
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:froog-silvergraph,代码行数:101,代码来源:Silvergraph.php


注:本文中的ClassInfo::classes_for_folder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。