Alex\BehatLauncher\Behat\Run::setProjectName PHP Method

setProjectName() public method

Changes the project name.
public setProjectName ( string $projectName ) : Run
$projectName string a project name
return Run
    public function setProjectName($projectName)
    {
        $this->projectName = $projectName;
        return $this;
    }

Usage Example

 /**
  * @Given /^following run for "([^"]+)":$/
  */
 public function followingRunFor($name, TableNode $table)
 {
     $app = $this->getApplication();
     $project = $app['project_list']->get($name);
     $methods = array('created_at' => function (RunUnit $unit, $val) {
         $int = new \DateInterval($val);
         $now = new \DateTime();
         $unit->setCreatedAt($now->sub($int));
     }, 'started_at' => function (RunUnit $unit, $val) {
         $int = new \DateInterval($val);
         $now = new \DateTime();
         $unit->setStartedAt($now->sub($int));
     }, 'finished_at' => function (RunUnit $unit, $val) {
         $int = new \DateInterval($val);
         $now = new \DateTime();
         if (!$unit->getStartedAt()) {
             $unit->setStartedAt($now->sub($int));
         }
         $unit->setFinishedAt($now->sub($int));
     }, 'feature' => function (RunUnit $unit, $val) {
         $unit->setFeature($val);
     }, 'return_code' => function (RunUnit $unit, $val) {
         $unit->setReturnCode($val);
     });
     $headers = $table->getRow(0);
     foreach ($headers as $col) {
         if (!isset($methods[$col])) {
             throw new \RuntimeException(sprintf('No handler for column "%s".', $col));
         }
     }
     $run = new Run();
     $run->setProjectName($name);
     $units = $run->getUnits();
     foreach ($table->getRows() as $i => $row) {
         if ($i == 0) {
             continue;
         }
         $unit = new RunUnit();
         foreach ($headers as $i => $header) {
             $value = $row[$i];
             if ($value === '@null') {
                 continue;
             }
             $methods[$header]($unit, $row[$i]);
         }
         $units->add($unit);
     }
     $app['run_storage']->saveRun($run);
 }
All Usage Examples Of Alex\BehatLauncher\Behat\Run::setProjectName