本文整理汇总了PHP中KAutoloader::getClassFilePath方法的典型用法代码示例。如果您正苦于以下问题:PHP KAutoloader::getClassFilePath方法的具体用法?PHP KAutoloader::getClassFilePath怎么用?PHP KAutoloader::getClassFilePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAutoloader
的用法示例。
在下文中一共展示了KAutoloader::getClassFilePath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
*
* Creates a new Kaltura test Object
* @param string $name
* @param array $data
* @param string $dataName
*/
public function __construct($name = null, array $data = array(), $dataName = '')
{
parent::__construct($name, $data, $dataName);
$class = get_class($this);
if ($name) {
KalturaLog::info("_____________________________________ [{$class}] [{$name}] ___________________________________");
} else {
KalturaLog::info("__________________________________________ [{$class}] ______________________________________");
}
$testFilePath = KAutoloader::getClassFilePath($class);
$this->testFolder = dirname($testFilePath);
$this->inputs = $data;
KalturaLog::info("Loads config file [{$testFilePath}.ini]");
$this->config = new KalturaTestConfig("{$testFilePath}.ini");
$testConfig = $this->config->get('config');
if (!$testConfig) {
$testConfig = new Zend_Config(array('source' => KalturaTestSource::XML), true);
$this->config->config = $testConfig;
$this->config->saveToIniFile();
}
$this->dataSource = $testConfig->source;
$this->outputFolder = $testConfig->outputFolder;
if ($this->outputFolder && !is_dir($this->outputFolder)) {
KalturaLog::info("Creating folder output [{$this->outputFolder}]");
mkdir($this->outputFolder, 777, true);
}
}
示例2: testAddWithCategories
/**
* Test the addition of a mediaEntry with proeprty "categories" set.
* @param string $categories
* @dataProvider provideData
*/
public function testAddWithCategories($categories)
{
$mediaEntry = new KalturaMediaEntry();
$mediaEntry->name = uniqid();
$mediaEntry->mediaType = KalturaMediaType::VIDEO;
$mediaEntry->categories = $categories;
$mediaEntry = $this->client->media->add($mediaEntry);
var_dump(KAutoloader::getClassFilePath(get_class($this->client)));
$categoryNames = explode(",", $categories);
foreach ($categoryNames as $categoryName) {
$filter = new KalturaCategoryFilter();
$filter->fullNameEqual = $categoryName;
$results = $this->client->category->listAction($filter);
$this->assertEquals(1, $results->totalCount, "Unexpected number of categories with fullname {$categoryName}.");
$catId = $results->objects[0]->id;
// Assert that the entry's "categoriesIds" property was updated properly.
$entryCatIds = explode(',', $mediaEntry->categoriesIds);
$this->assertTrue(in_array($catId, $entryCatIds), "Entry's categoriesIds property should containt category Id [{$catId}] for category [{$categoryName}]");
//Assert that a KalturaCategoryEntry object was created for the entry and each category it was associated with.
$catEntryFilter = new KalturaCategoryEntryFilter();
$catEntryFilter->categoryIdEqual = $catId;
$catEntryFilter->entryIdEqual = $mediaEntry->id;
try {
$res = $this->client->categoryEntry->listAction($catEntryFilter);
$this->assertGreaterThan(0, $res->totalCount > 0);
} catch (Exception $e) {
$this->assertEquals(0, 1, "Unexpected exception thrown - expected categoryEntry object for entry Id" . $mediaEntry->id . " and category Id {$catId}");
}
}
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:35,代码来源:MediaServiceEntitlementTest.php
示例3: provider
/**
*
* The test data provider (gets the data for the different tests)
* @param string $className - The class name
* @param string $procedureName - The current method (test) name
* @return array<array>();
*/
public function provider($className, $procedureName)
{
//print("In provider for $className, $procedureName \n");
//Gets from the given class the class data file
$class = get_class($this);
$classFilePath = KAutoloader::getClassFilePath($class);
$testClassDir = dirname($classFilePath);
$dataFilePath = $testClassDir . DIRECTORY_SEPARATOR . "testsData/{$className}.data";
KalturaLog::debug("The data file path [" . $dataFilePath . "]");
if (file_exists($dataFilePath)) {
$simpleXML = kXml::openXmlFile($dataFilePath);
} else {
//TODO: Give notice or create the file don't throw an exception
throw new Exception("Data file [{$dataFilePath}] not found");
}
$inputsForTestProcedure = array();
foreach ($simpleXML->TestProcedureData as $xmlTestProcedureData) {
if ($xmlTestProcedureData["testProcedureName"] != $procedureName) {
continue;
}
foreach ($xmlTestProcedureData->TestCaseData as $xmlTestCaseData) {
$testCaseInstanceInputs = array();
foreach ($xmlTestCaseData->Input as $input) {
$object = KalturaTestDataObject::generatefromXml($input);
//Add the new input to the test case instance data
$testCaseInstanceInputs[] = $object;
}
foreach ($xmlTestCaseData->OutputReference as $output) {
$object = KalturaTestDataObject::generatefromXml($output);
//Add the new output reference to the test case instance data
$testCaseInstanceInputs[] = $object;
}
//Add the test case into the test procedure data
$inputsForTestProcedure[] = $testCaseInstanceInputs;
}
}
KalturaLog::info("Tests data provided Before transformation to objects: \n[" . print_r($inputsForTestProcedure, true) . "]");
$inputsForTestProcedure = $this->transformToObjects($inputsForTestProcedure);
KalturaLog::info("Tests data provided [" . print_r($inputsForTestProcedure, true) . "]");
return $inputsForTestProcedure;
}
示例4: writeAfterService
protected function writeAfterService(KalturaServiceReflector $serviceReflector)
{
$this->writeTest("\t/**");
$this->writeTest("\t * Called when all tests are done");
$this->writeTest("\t * @param int \$id");
$this->writeTest("\t * @return int");
$this->writeTest("\t * @depends {$this->lastDependencyTest} - TODO: replace {$this->lastDependencyTest} with last test function that uses that id");
$this->writeTest("\t */");
$this->writeTest("\tpublic function testFinished(\$id)");
$this->writeTest("\t{");
$this->writeTest("\t\treturn \$id;");
$this->writeTest("\t}");
$this->writeTest("");
$this->writeTest("}");
$this->writeBase("\t/**");
$this->writeBase("\t * Called when all tests are done");
$this->writeBase("\t * @param int \$id");
$this->writeBase("\t * @return int");
$this->writeBase("\t */");
$this->writeBase("\tabstract public function testFinished(\$id);");
$this->writeBase("");
$this->writeBase("}");
$serviceName = $serviceReflector->getServiceName();
$serviceClass = $serviceReflector->getServiceClass();
$testPath = realpath(dirname(__FILE__) . '/../') . "/tests/api/{$serviceName}";
if ($serviceReflector->isFromPlugin()) {
$servicePath = KAutoloader::getClassFilePath($serviceClass);
$testPath = realpath(dirname($servicePath) . '/../') . "/tests/services/{$serviceName}";
}
$this->writeToFile("{$testPath}/{$serviceClass}BaseTest.php", $this->_txtBase);
$this->writeToFile("{$testPath}/{$serviceClass}Test.php", $this->_txtTest, false);
$this->writeToFile("{$testPath}/{$serviceClass}Test.php.ini", $this->_txtIni, false);
}
示例5: initDataFile
/**
*
* Inits the global data file
* @return true - If global exists or was created, null other wise
*/
private static function initDataFile()
{
if (is_null(KalturaGlobalData::$dataFilePath)) {
$classFilePath = KAutoloader::getClassFilePath("KalturaGlobalData");
$dir = dirname($classFilePath);
KalturaGlobalData::setDataFilePath($dir . "/" . KalturaGlobalData::DEFAULT_DATA_PATH);
}
if (file_exists(KalturaGlobalData::$dataFilePath)) {
KalturaGlobalData::$dataFile = new KalturaTestConfig(KalturaGlobalData::$dataFilePath);
} else {
print "Global file no found at: " . KalturaGlobalData::$dataFilePath . "\n";
return null;
}
return true;
}
示例6: startTestSuite
public function startTestSuite(PHPUnit_Framework_TestSuite $suite)
{
// print("In startTestSuite - for suite = {$suite->getName()}\n");
KalturaLog::debug("In startTestSuite - for suite = {$suite->getName()}");
if ($suite instanceof PHPUnit_Framework_TestSuite_DataProvider) {
//Get the test procedure name from the suite name which is (testCase::testProcedure)
$testNames = explode("::", $suite->getName());
$testName = $testNames[0];
if (isset($testNames[1])) {
$testName = $testNames[1];
}
$testCase = $testNames[0];
if (is_null(KalturaTestListener::$testCaseFailures)) {
KalturaLog::debug("KalturaTestCaseFailures is null creating empty test case failures for {$testCase}\n");
KalturaTestListener::$testCaseFailures = new KalturaTestCaseFailures($testName);
}
$testProcedure = KalturaTestListener::$testCaseFailures->getTestProcedureFailure($testName);
//if the test procedure exists
if (!$testProcedure) {
KalturaTestListener::$testCaseFailures->addTestProcedureFailure(new KalturaTestProcedureFailure($testName));
} else {
KalturaLog::alert("Test procedure [{$testName}] already added");
}
} else {
//Check if the test belongs to the same test case failures (by the first test of the suite)
$test = $suite->testAt(0);
if ($test instanceof PHPUnit_Framework_TestSuite_DataProvider) {
$test = $test->testAt(0);
}
$class = get_class($test);
//if the new test comes from a new file (testCase)
if (KalturaTestListener::$currentTestCase != $class) {
//Gets the class path for the failure file
$classPath = KAutoloader::getClassFilePath($class);
KalturaTestListener::$failureFilePath = dirname($classPath) . "/testsData/{$class}.failures";
KalturaTestListener::$dataFilePath = dirname($classPath) . "/testsData/{$class}.data";
$this->writeFailuresToFile();
//Opens the new failure file for the new test
KalturaTestListener::$failuresFile = fopen(KalturaTestListener::$failureFilePath, "w+");
//Change the current test case
KalturaTestListener::$currentTestCase = $class;
//Create new test case failures for the new test case
KalturaTestListener::$testCaseFailures = new KalturaTestCaseFailures(KalturaTestListener::$currentTestCase);
//TODO: get the test procedure name from the suite
KalturaTestListener::$testCaseFailures->setTestProceduresFailures(array(new KalturaTestProcedureFailure("Unknown")));
} else {
}
}
}