Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 功能测试问题_Php_Symfony 1.4 - Fatal编程技术网

Php 功能测试问题

Php 功能测试问题,php,symfony-1.4,Php,Symfony 1.4,我为我的项目编写了如下功能测试 <?php include(dirname(__FILE__).'/../../bootstrap/functional.php'); $baseFolder = '/root/nsuhr/apps/backend/modules'; //$browser = new sfTestFunctional(new sfBrowser()); $methodArray = SecurityTest::getRoutes(); $

我为我的项目编写了如下功能测试

<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

    $baseFolder = '/root/nsuhr/apps/backend/modules';
    //$browser = new sfTestFunctional(new sfBrowser());
    $methodArray = SecurityTest::getRoutes();
    $actionVar = new securityReport();
foreach ($methodArray as $module)
{

 $username='012001011';                                                                      $credential = 'financeAdmin';
$password='123';                                                                                  
$f = $baseFolder . DIRECTORY_SEPARATOR . trim($module['module']) . DIRECTORY_SEPARATOR . 'actions';
$actionArray = $actionVar->parseActionFile($f . DIRECTORY_SEPARATOR . 'actions.class.php');
$module = trim($module['module']);

foreach ($actionArray as $action)
{
// if(trim($action) == 'custom' )
//    throw new exception(' custommmmm ') ;
    $browser = new sfTestFunctional(new sfBrowser());


              $browser->
                post('/sfGuardAuth/signin', array('signin' => array('username' =>        $username, 'password' => $password)))->
                with('form')->begin()->
                hasErrors(false)->
                end()->  



              get($module.'/'.$action)->

              with('request')->begin()->
                isParameter('module', $module)->
                isParameter('action', $action)->
              end()->

              with('user')->begin()->                                                                            
                isAuthenticated(true)->                                                                          
                hasCredential(array($credential))->                                                      
              end()->

              with('response')->begin()->
                isStatusCode(200)->
                checkElement('body', '!/This is a temporary page/')->
              end();
}


}
我发现对于这些
facultyPosition
方法的编辑操作需要输入。由于这个原因,它给我这个错误

现在我想找到需要输入的不同方法的所有操作。我该怎么做?请帮帮我

actions.class.php的代码是:

public function executeEdit(sfWebRequest $request)
  {
    $this->faculty_position = $this->getRoute()->getObject();

    $this->employee_id = $this->faculty_position->getEmployeeId();
    $this->employeeType = Employee::getEmployeeTypeByEmployeeId($this->employee_id) ;


    $this->form = $this->configuration->getForm($this->faculty_position);

    $this->organoNode = $this->faculty_position->getOrganoNode () ; 
    //throw new Exception($this->organoNode->getType()."".$this->organoNode->getId());
    $this->form->setDefault('organo_node_type',$this->organoNode->getType());


    $this->form->setDefault('organo_node_id',$this->organoNode->getId());


    $this->positionNode = $this->faculty_position->getPositionNode() ;
    $this->form->setDefault('organo_position_id',$this->positionNode->getId());


    $this->empId = $this->getUser()->getAttribute('employee_id')

}

$module/edit
的功能测试调用需要在请求中传递
$id
参数

没有
$module/$id/edit
就没有要获取的路由对象

您可以通过获取
$id
参数来修复此测试,如下所示:

$id = $objectQuery::create()->select('id')->findOne();
get("$module/$id/$action")->
然后从
$actionArray
中获取编辑操作,并使用包含
$id
的可分辨调用来处理它,如下所示:

$id = $objectQuery::create()->select('id')->findOne();
get("$module/$id/$action")->

你能发布你的行动代码吗?是的,我是,我发布行动代码