示例#1
0
 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);
 }